<?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>USB Mass Storage file transfert extremely slow</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/125087/usb-mass-storage-file-transfert-extremely-slow</link><description>Hi, 
 I have a FAT file system that I use with an USB Mass Storage feature. I use the mx25r64 NOR flash (the same as the nrf7002dk evalboard). I am working on ncs 3.0.2. 
 It takes around 50s to transfert a file of 1Mo. This is extremely slow and I would</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 Oct 2025 15:43:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/125087/usb-mass-storage-file-transfert-extremely-slow" /><item><title>RE: USB Mass Storage file transfert extremely slow</title><link>https://devzone.nordicsemi.com/thread/552179?ContentTypeID=1</link><pubDate>Wed, 22 Oct 2025 15:43:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcfb217f-bfdb-4ef8-a93b-13993997001d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Benoît,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Glad to hear that you see an improvement as well.&lt;/p&gt;
[quote user="Ben_Squar3d"]&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you have improved speed when setting&amp;nbsp;&lt;span&gt;CONFIG_MASS_STORAGE_STACK_SIZE to at least 5000?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;I did try to adjust a bit here and there, and no option seemed to give a higher throughput, as the bottle neck does seem to be the external flash.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tested on ubuntu 24.04.&lt;/p&gt;
&lt;p&gt;If you are testing on Windows, there will be a bit of a USB CDC_ACM throughput difference as compared to linux. See here for similar test vectors:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38822/usbd-with-cdc-acm-class-windows-10-maximum-data-rate"&gt;USBD with CDC ACM class Windows 10 maximum data rate&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Slightly newer measurement here:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/85903/nrf52840-usb-cdc-baud-rate/358927"&gt;RE: [nRF52840] USB CDC baud rate&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Mass Storage file transfert extremely slow</title><link>https://devzone.nordicsemi.com/thread/552024?ContentTypeID=1</link><pubDate>Tue, 21 Oct 2025 08:12:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a7f700f-a324-4848-81d1-fa40f42570e5</guid><dc:creator>Ben_Squar3d</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you very much for your quick and accurate answer! Indeed I see an improvement of the performance, but not as much as you.&lt;/p&gt;
&lt;p&gt;For the 1mb_random file : ~20s&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For the all zero file : ~30s&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is a real improvement (regarding the 49s at the beginning), but I need to estimate the additionnal current consumption to know if this tradeoff is acceptable.&lt;/p&gt;
&lt;p&gt;Do you have improved speed when setting&amp;nbsp;&lt;span&gt;CONFIG_MASS_STORAGE_STACK_SIZE to at least 5000?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you very much for your help&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Mass Storage file transfert extremely slow</title><link>https://devzone.nordicsemi.com/thread/551934?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 12:11:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:158183e1-faf1-488b-bf55-01e629be89bf</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Benoît,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Transferring 1 MB over USB should ideally be done in approx. ~5 seconds over the USB interface using USBD peripheral (200-300 kB/s max throughput), so I suspect that the delay is in the external flash.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have two test files, created with dd:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;dd if=/dev/urandom of=1mb_random_file.txt bs=1000K count=1
dd if=/dev/zero of=1mb_file.txt bs=1000K count=1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I consistently see a difference between the timing on these devices where all zero&amp;#39;s will use approx. 45-46 seconds:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;pv 1mb_file.txt | dd of=/media/hkn/5961-0800/1mb_file.txt
1000KiB 0:00:00 [95,2MiB/s] [===========================================================&amp;gt;] 100%            
2000+0 records in
2000+0 records out
1024000 bytes (1,0 MB, 1000 KiB) copied, 45,4911 s, 22,5 kB/s&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And a random pattern will use approx. 34 seconds:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;pv 1mb_random_file.txt | dd of=/media/hkn/5961-0800/1mb_file.txt
1000KiB 0:00:05 [ 167KiB/s] [===========================================================&amp;gt;] 100%            
2000+0 records in
2000+0 records out
1024000 bytes (1,0 MB, 1000 KiB) copied, 27,5651 s, 37,1 kB/s
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So there is a dependency on writing bitwise &amp;#39;1&amp;#39; vs writing &amp;#39;0&amp;#39;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What you could try is to set it up in a &amp;quot;high performance mode&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;mx25r64 {
	mxicy,mx25r-power-mode = &amp;quot;high-performance&amp;quot;;
	partitions {
		compatible = &amp;quot;fixed-partitions&amp;quot;;
		#address-cells = &amp;lt;1&amp;gt;;
		#size-cells = &amp;lt;1&amp;gt;;

		storage_partition: partition@0 {
			label = &amp;quot;storage&amp;quot;;
			reg = &amp;lt;0x00000000 0x00100000&amp;gt;;
		};
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I believe the default boot up mode is a ultra-low power mode.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using this high performance mode of the mx25r64, I see these numbers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;pv 1mb_ones_file.txt | dd of=/media/hkn/5961-0800/1mb_file.txt
1000KiB 0:00:00 [84,5MiB/s] [===========================================================&amp;gt;] 100%            
2000+0 records in
2000+0 records out
1024000 bytes (1,0 MB, 1000 KiB) copied, 15,6999 s, 65,2 kB/s
pv 1mb_file.txt | dd of=/media/hkn/5961-0800/1mb_file.txt
1000KiB 0:00:00 [98,6MiB/s] [===========================================================&amp;gt;] 100%            
2000+0 records in
2000+0 records out
1024000 bytes (1,0 MB, 1000 KiB) copied, 20,7949 s, 49,2 kB/s
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you check if adding this mode also increases the performance to approx. 15-20 seconds at your end as well?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my test files:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1mb_5F00_random_5F00_file.txt"&gt;devzone.nordicsemi.com/.../1mb_5F00_random_5F00_file.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/1mb_5F00_ones_5F00_file.txt"&gt;devzone.nordicsemi.com/.../1mb_5F00_ones_5F00_file.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/1mb_5F00_file.txt"&gt;devzone.nordicsemi.com/.../1mb_5F00_file.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>