<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>using smp to download/upload files from fs is extremely slow in compare to custom service</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105501/using-smp-to-download-upload-files-from-fs-is-extremely-slow-in-compare-to-custom-service</link><description>hello Nordic 
 
 i am using nrf52832 +and nrf52840 with ncs v2.3.0 
 i am using little fs in the nrfs (which are the servers), i use SMP service for DFU. 
 when implementing smp service on my client and try to upload or download files to the servers i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Nov 2023 09:05:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105501/using-smp-to-download-upload-files-from-fs-is-extremely-slow-in-compare-to-custom-service" /><item><title>RE: using smp to download/upload files from fs is extremely slow in compare to custom service</title><link>https://devzone.nordicsemi.com/thread/457484?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 09:05:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:feb645ae-0ee2-4a70-b2b2-ca03d8e29e94</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;figured it out myself eventually&lt;/p&gt;
&lt;p&gt;so one of the reason for the slow transmission using the SMP&amp;nbsp;service with file system is cause every event that generates a fs_mgmt_file_download/upload there is a file open operation which reads the data base in search for the file path. when working with external flash, which is much bigger then internal flash, it can take a lot of read operations. so solutions:&lt;/p&gt;
&lt;p&gt;1. there is this config&amp;nbsp;CONFIG_MCUMGR_BUF_SIZE (in ncs v.2.3.0, in v2.5.0 there is a different config for that) as large as we can make it the less events calling for open file operations we will have so larger buff will make transmission much faster.&lt;/p&gt;
&lt;p&gt;2. in ncs v.2.5.0 there was a change that avoid the multiplication of fs_open operation, so&amp;nbsp;fs_open is called once in the start of transmission and another time before the end (not sure yet why it is called the second time) which is much more efective&amp;nbsp;&lt;/p&gt;
&lt;p&gt;hope it helps someone, good luck all&amp;nbsp;&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using smp to download/upload files from fs is extremely slow in compare to custom service</title><link>https://devzone.nordicsemi.com/thread/454906?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2023 12:29:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3c3e68e-9b93-4eed-9fd8-fd8112869075</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi AHaug&lt;/p&gt;
&lt;p&gt;i am referring to BLE only&lt;/p&gt;
&lt;p&gt;i am not taking about dfu but uploading/downloading from fs with no regards to dfu (which probably works with internal flash and not external flash or fs).&lt;/p&gt;
&lt;p&gt;i add a log file from rtt on the nrf52840. the prints &amp;quot;read flash:&amp;quot; log appear once in the code under the flash_read implementation in the driver.&lt;/p&gt;
&lt;p&gt;one file is for upload and one is for download (using the mcumgr cli)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/canary_5F00_upload.txt"&gt;/cfs-file/__key/communityserver-discussions-components-files/4/canary_5F00_upload.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/canary_5F00_download.txt"&gt;/cfs-file/__key/communityserver-discussions-components-files/4/canary_5F00_download.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;this are the commands i used in cli:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; sudo ./mcumgr --conntype ble --connstring &amp;#39;peer_id=cb:73:d2:ed:41:24&amp;#39; fs download /lfs/slim_shady.txt ~/workspace/slim_return.txt

sudo ./mcumgr --conntype ble --connstring &amp;#39;peer_id=cb:73:d2:ed:41:24&amp;#39; fs upload ~/workspace/slim_shady.txt /lfs/slim_shady.txt  &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;it does not make sense to me that i get so many reads operation while uploading a file to the nrf52840.&lt;/p&gt;
&lt;p&gt;also it does not make sense to me why same addresses are read over and over, a random address i looked in the file of the download read 118 time (this could definitely explain the delay but why is it behave like this ????&lt;/p&gt;
&lt;p&gt;also even looking for a segment of read that correlates to the size of the entire file are read 5 times (which is only 5 probably because of the time change at the start of each line), as can be seen in the download file and in this picture:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/home/ziv/Pictures/Screenshots/Screenshot%20from%202023-11-12%2015-37-23.png" /&gt;&lt;a href="https://devzone.nordicsemi.com/home/ziv/Pictures/Screenshots/Screenshot%20from%202023-11-12%2015-37-23.png"&gt;https://devzone.nordicsemi.com/home/ziv/Pictures/Screenshots/Screenshot%20from%202023-11-12%2015-37-23.png&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;reading the flash so many extra time, is the reason it is extremely slow ?? maybe it does that because it reads the whole file every time but sends only a small part of it (which seems too wasteful for me to think this is how lfs and smp&amp;nbsp;work together) any&amp;nbsp;idea why i see this behaviour of too many readings (if i am talking about downloading a file of 100kb i see reads, from the log of external flash driver, of several mega bytes from flash which does not make sense) ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;is there some example or guide for working with smp and fs (not dfu) ?&lt;/p&gt;
&lt;p&gt;hope to read you soon&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using smp to download/upload files from fs is extremely slow in compare to custom service</title><link>https://devzone.nordicsemi.com/thread/454866?ContentTypeID=1</link><pubDate>Thu, 09 Nov 2023 10:24:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20f018d7-7920-423e-bccf-17e640b7233f</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you clarify what transport you&amp;#39;re using for the image transport? Is it BLE or UART? If it is BLE&amp;nbsp;you could check out this to see &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/788b23cf8e20e9dcb1c5b1325c2142db947efb3b/samples/common/mcumgr_bt_ota_dfu/Kconfig#L122-L134"&gt;https://github.com/nrfconnect/sdk-nrf/blob/788b23cf8e20e9dcb1c5b1325c2142db947efb3b/samples/common/mcumgr_bt_ota_dfu/Kconfig#L122-L134&amp;nbsp;&lt;/a&gt;&amp;nbsp;to see how you can speed up the transport&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>