<?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>Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101040/zephyr-fatfs-flash-disk-cache-commit-slow-down-by-200x-when-mass-storage-usb-disconnected</link><description>I am using nrf5340 on a custom board with NRF Connect sdk 2.3 with an SPI (Not QSPI) external NOR flash configured as a flash disk for use by USB mass storage and for access by my application. 
 With the board connected to my pc everything works as expected</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Jun 2023 08:40:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101040/zephyr-fatfs-flash-disk-cache-commit-slow-down-by-200x-when-mass-storage-usb-disconnected" /><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432467?ContentTypeID=1</link><pubDate>Thu, 22 Jun 2023 08:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6c81e9d-f4bc-4f0a-a0cc-1bd65bb0886e</guid><dc:creator>JustinL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The issue is resolved.&lt;br /&gt;&lt;br /&gt;I had a old compilation unit still in the cmake which should not have been there. The file did contain some old SPI initialisation code. It was obtaining a handle to the nrfx SPIM instance. Not sure why that caused this issue but removing it from cmake resolved the issue.&lt;br /&gt;&lt;br /&gt;Thanks for you help along the way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432397?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 16:55:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edf2b7bb-702b-4ad0-8e8d-f717750f38a7</guid><dc:creator>JustinL</dc:creator><description>&lt;p&gt;I have narrowed it down to the&amp;nbsp;spi_context_wait_for_completion() function. When the USB is not connected every third SPI transaction this function it takes 200ms, which is the configured SPI transaction timeout.&lt;br /&gt;&lt;br /&gt;With the USB plugged in every third transaction takes just 1ms. So right there is the 200x difference.&lt;br /&gt;(See output below).&lt;br /&gt;&lt;br /&gt;The spi_context_wait_for_completion() function is waiting on a semaphore&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;k_sem_take&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;sync&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;timeout&lt;/span&gt;&lt;span&gt;) where timeout is 200ms in my case.&lt;br /&gt;&lt;br /&gt;So for some reason when the SPI transaction has finished it is not being signalled when there is no USB device.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:24.977,600] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 200ms

[00:00:24.986,877] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:24.995,971] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.205,139] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 200ms

[00:00:25.214,416] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.223,510] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.432,678] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 200ms

[00:00:25.441,955] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.451,049] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.660,186] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 200ms

[00:00:25.669,464] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:25.678,558] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:14.746,673] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 1ms

[00:00:14.755,798] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.764,892] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.774,688] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 1ms

[00:00:14.783,782] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.792,877] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.802,673] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 1ms

[00:00:14.811,798] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.820,892] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 0ms

[00:00:14.830,688] &amp;lt;err&amp;gt; spi_nrfx_spim: spi_context_wait_for_completion elasped time: 1ms&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432379?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 14:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffcb933e-87c1-45fa-986d-c7d60db4faf2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you able to narrow it down to the exact location within this snippet where the code is stuck?&lt;/p&gt;
&lt;p&gt;I will then check with out developers if they have any explanation to why this could happen.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432107?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 16:10:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb77a503-518f-42bb-88f2-821b31b78371</guid><dc:creator>JustinL</dc:creator><description>&lt;p&gt;I think I have narrowed down the issue to to the&amp;nbsp;&lt;span&gt;transceive function of&amp;nbsp;&lt;/span&gt;spi_nrfx_spim.c&lt;/p&gt;
&lt;p&gt;Using a processor ticks timer I find that the following code within the transceive&amp;nbsp; function is around 8.9 million ticks with the usb cable out and 128k ticks with the cable in which is a factor of 70X.&lt;br /&gt;&lt;br /&gt;What can be conflicting with the SPI when the USB is not attached? I have usb_cdc and usb mass storage.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;spi_context_lock&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;asynchronous&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;cb&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;userdata&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;spi_cfg&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;error&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;configure&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;spi_cfg&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;error&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;==&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;busy&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;spi_context_buffers_setup&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;tx_bufs&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;rx_bufs&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;spi_context_cs_control&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;transfer_next_chunk&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;error&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;spi_context_wait_for_completion&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;spi_context_release&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;dev_data&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ctx&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;error&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432077?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 14:41:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb5fe1f4-253e-4010-bb2d-2c7774300205</guid><dc:creator>JustinL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have used the Thread Analyzer library starting with no usb and then plugging it in.&lt;br /&gt;&lt;br /&gt;There doesn&amp;#39;t seem to be much difference from the thread stats. In both cases about 80% of time is spent in idle and 18% in main.&lt;/p&gt;
&lt;p&gt;I have also put the SPI bus on the scope and can confirm there is no change in bus frequency, but there is a massive change in the bus transactions. Without the usb plugged in the SPI bus becomes very quite with sporadic transactions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would imagine you are right that the SPI thread is waiting for something held by another thread. I would think the disk access api must be synchronising access to the flash disk between threads? Unless the USB peripheral and the SPIM need to be synchronised, I guess they both us DMA?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I am not sure how to find out time a thread spends on waiting for what?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Below is the thread library output if it helps. Starts with no usb, then is plugged in.&lt;/p&gt;
&lt;p&gt;[00:00:16.696,166] &amp;lt;inf&amp;gt; wr_ecm: Writen 2000 bytes to target file. took 7283 ms&lt;br /&gt;[00:00:16.708,862] &amp;lt;inf&amp;gt; wr_ecm: Writen 3000 bytes to target file. took 7295 ms&lt;br /&gt;[00:00:16.721,557] &amp;lt;inf&amp;gt; wr_ecm: Writen 4000 bytes to target file. took 7308 ms&lt;br /&gt;[00:00:16.817,626] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;Thread analyze:&lt;br /&gt; thread_analyzer : STACK: unused 200 usage 824 / 1024 (80 %); CPU: 1 %&lt;br /&gt; : Total CPU cycles used: 7651&lt;br /&gt; usb_mass : STACK: unused 3976 usage 120 / 4096 (2 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbd_workq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; sysworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 1&lt;br /&gt; idle : STACK: unused 252 usage 68 / 320 (21 %); CPU: 81 %&lt;br /&gt; : Total CPU cycles used: 489880&lt;br /&gt; main : STACK: unused 3032 usage 1064 / 4096 (25 %); CPU: 17 %&lt;br /&gt; : Total CPU cycles used: 102531&lt;br /&gt; ISR0 : STACK: unused 1664 usage 384 / 2048 (18 %)&lt;br /&gt;&lt;span style="background-color:#ffff00;"&gt;[00:00:19.738,952] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 2921ms&lt;/span&gt;&lt;br /&gt;[00:00:20.423,278] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:23.632,629] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 3209ms&lt;br /&gt;[00:00:23.845,520] &amp;lt;inf&amp;gt; wr_ecm: Writen 5000 bytes to target file. took 14432 ms&lt;br /&gt;[00:00:23.858,367] &amp;lt;inf&amp;gt; wr_ecm: Writen 6000 bytes to target file. took 14445 ms&lt;br /&gt;[00:00:23.871,185] &amp;lt;inf&amp;gt; wr_ecm: Writen 7000 bytes to target file. took 14458 ms&lt;br /&gt;[00:00:23.884,002] &amp;lt;inf&amp;gt; wr_ecm: Writen 8000 bytes to target file. took 14471 ms&lt;br /&gt;[00:00:23.977,722] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;Thread analyze:&lt;br /&gt; thread_analyzer : STACK: unused 200 usage 824 / 1024 (80 %); CPU: 1 %&lt;br /&gt; : Total CPU cycles used: 10191&lt;br /&gt; usb_mass : STACK: unused 3976 usage 120 / 4096 (2 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbd_workq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; sysworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 1&lt;br /&gt; idle : STACK: unused 252 usage 68 / 320 (21 %); CPU: 84 %&lt;br /&gt; : Total CPU cycles used: 647177&lt;br /&gt; main : STACK: unused 3016 usage 1080 / 4096 (26 %); CPU: 14 %&lt;br /&gt; : Total CPU cycles used: 109372&lt;br /&gt; ISR0 : STACK: unused 1664 usage 384 / 2048 (18 %)&lt;br /&gt;[00:00:27.064,666] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 3087ms&lt;br /&gt;[00:00:27.749,908] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;Thread analyze:&lt;br /&gt; thread_analyzer : STACK: unused 200 usage 824 / 1024 (80 %); CPU: 1 %&lt;br /&gt; : Total CPU cycles used: 12733&lt;br /&gt; usb_mass : STACK: unused 3976 usage 120 / 4096 (2 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbd_workq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; sysworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 1&lt;br /&gt; idle : STACK: unused 252 usage 68 / 320 (21 %); CPU: 86 %&lt;br /&gt; : Total CPU cycles used: 807905&lt;br /&gt; main : STACK: unused 3016 usage 1080 / 4096 (26 %); CPU: 11 %&lt;br /&gt; : Total CPU cycles used: 111922&lt;br /&gt; ISR0 : STACK: unused 1664 usage 384 / 2048 (18 %)&lt;br /&gt;[00:00:30.203,765] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 2454ms&lt;br /&gt;[00:00:30.206,634] &amp;lt;inf&amp;gt; usb_cdc_acm: Device suspended&lt;br /&gt;[00:00:30.317,138] &amp;lt;inf&amp;gt; usb_cdc_acm: Device resumed&lt;br /&gt;[00:00:30.322,570] &amp;lt;inf&amp;gt; usb_cdc_acm: from suspend&lt;br /&gt;[00:00:30.332,275] &amp;lt;inf&amp;gt; wr_ecm: Writen 9000 bytes to target file. took 20919 ms&lt;br /&gt;[00:00:30.345,123] &amp;lt;inf&amp;gt; wr_ecm: Writen 10000 bytes to target file. took 20932 ms&lt;br /&gt;[00:00:30.358,032] &amp;lt;inf&amp;gt; wr_ecm: Writen 11000 bytes to target file. took 20945 ms&lt;br /&gt;[00:00:30.370,971] &amp;lt;inf&amp;gt; wr_ecm: Writen 12000 bytes to target file. took 20957 ms&lt;br /&gt;[00:00:30.466,644] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:30.488,769] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 22ms&lt;br /&gt;&lt;span style="background-color:#ffff00;"&gt;[00:00:30.538,635] &amp;lt;inf&amp;gt; usb_cdc_acm: Device configured&lt;/span&gt;&lt;br /&gt;[00:00:30.589,294] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;&lt;span style="background-color:#ffff00;"&gt;[00:00:30.612,823] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;/span&gt;&lt;br /&gt;[00:00:30.629,730] &amp;lt;inf&amp;gt; wr_ecm: Writen 13000 bytes to target file. took 21216 ms&lt;br /&gt;[00:00:30.648,132] &amp;lt;inf&amp;gt; wr_ecm: Writen 14000 bytes to target file. took 21235 ms&lt;br /&gt;[00:00:30.664,825] &amp;lt;inf&amp;gt; wr_ecm: Writen 15000 bytes to target file. took 21251 ms&lt;br /&gt;[00:00:30.684,326] &amp;lt;inf&amp;gt; wr_ecm: Writen 16000 bytes to target file. took 21271 ms&lt;br /&gt;[00:00:30.786,651] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:30.809,783] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:30.918,945] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:30.941,772] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:30.957,977] &amp;lt;inf&amp;gt; wr_ecm: Writen 17000 bytes to target file. took 21544 ms&lt;br /&gt;[00:00:30.974,456] &amp;lt;inf&amp;gt; wr_ecm: Writen 18000 bytes to target file. took 21561 ms&lt;br /&gt;[00:00:30.992,828] &amp;lt;inf&amp;gt; wr_ecm: Writen 19000 bytes to target file. took 21579 ms&lt;br /&gt;[00:00:31.007,965] &amp;lt;inf&amp;gt; wr_ecm: Writen 20000 bytes to target file. took 21594 ms&lt;br /&gt;[00:00:31.107,299] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.130,767] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.240,905] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.263,763] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.279,510] &amp;lt;inf&amp;gt; wr_ecm: Writen 21000 bytes to target file. took 21866 ms&lt;br /&gt;[00:00:31.293,609] &amp;lt;inf&amp;gt; wr_ecm: Writen 22000 bytes to target file. took 21880 ms&lt;br /&gt;[00:00:31.308,044] &amp;lt;inf&amp;gt; wr_ecm: Writen 23000 bytes to target file. took 21894 ms&lt;br /&gt;[00:00:31.322,479] &amp;lt;inf&amp;gt; wr_ecm: Writen 24000 bytes to target file. took 21909 ms&lt;br /&gt;[00:00:31.417,755] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.440,765] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.548,461] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.571,777] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.587,036] &amp;lt;inf&amp;gt; wr_ecm: Writen 25000 bytes to target file. took 22174 ms&lt;br /&gt;[00:00:31.601,928] &amp;lt;inf&amp;gt; wr_ecm: Writen 26000 bytes to target file. took 22188 ms&lt;br /&gt;[00:00:31.617,187] &amp;lt;inf&amp;gt; wr_ecm: Writen 27000 bytes to target file. took 22204 ms&lt;br /&gt;[00:00:31.631,317] &amp;lt;inf&amp;gt; wr_ecm: Writen 28000 bytes to target file. took 22218 ms&lt;br /&gt;[00:00:31.732,421] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.755,767] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.862,365] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:31.885,772] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:31.900,543] &amp;lt;inf&amp;gt; wr_ecm: Writen 29000 bytes to target file. took 22487 ms&lt;br /&gt;[00:00:31.915,374] &amp;lt;inf&amp;gt; wr_ecm: Writen 30000 bytes to target file. took 22502 ms&lt;br /&gt;[00:00:31.929,931] &amp;lt;inf&amp;gt; wr_ecm: Writen 31000 bytes to target file. took 22516 ms&lt;br /&gt;[00:00:31.943,695] &amp;lt;inf&amp;gt; wr_ecm: Writen 32000 bytes to target file. took 22530 ms&lt;br /&gt;[00:00:32.048,889] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.071,777] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.176,635] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.199,768] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.214,050] &amp;lt;inf&amp;gt; wr_ecm: Writen 33000 bytes to target file. took 22801 ms&lt;br /&gt;[00:00:32.226,989] &amp;lt;inf&amp;gt; wr_ecm: Writen 34000 bytes to target file. took 22813 ms&lt;br /&gt;[00:00:32.240,112] &amp;lt;inf&amp;gt; wr_ecm: Writen 35000 bytes to target file. took 22827 ms&lt;br /&gt;[00:00:32.253,967] &amp;lt;inf&amp;gt; wr_ecm: Writen 36000 bytes to target file. took 22840 ms&lt;br /&gt;[00:00:32.352,478] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.375,793] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.437,316] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.460,784] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.553,436] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.576,782] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.590,576] &amp;lt;inf&amp;gt; wr_ecm: Writen 37000 bytes to target file. took 23177 ms&lt;br /&gt;[00:00:32.603,546] &amp;lt;inf&amp;gt; wr_ecm: Writen 38000 bytes to target file. took 23190 ms&lt;br /&gt;[00:00:32.616,485] &amp;lt;inf&amp;gt; wr_ecm: Writen 39000 bytes to target file. took 23203 ms&lt;br /&gt;[00:00:32.629,455] &amp;lt;inf&amp;gt; wr_ecm: Writen 40000 bytes to target file. took 23216 ms&lt;br /&gt;[00:00:32.723,876] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.746,795] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.849,456] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:32.872,772] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:32.886,108] &amp;lt;inf&amp;gt; wr_ecm: Writen 41000 bytes to target file. took 23473 ms&lt;br /&gt;[00:00:32.899,047] &amp;lt;inf&amp;gt; wr_ecm: Writen 42000 bytes to target file. took 23486 ms&lt;br /&gt;[00:00:32.911,987] &amp;lt;inf&amp;gt; wr_ecm: Writen 43000 bytes to target file. took 23498 ms&lt;br /&gt;[00:00:32.924,957] &amp;lt;inf&amp;gt; wr_ecm: Writen 44000 bytes to target file. took 23511 ms&lt;br /&gt;[00:00:32.937,896] &amp;lt;inf&amp;gt; wr_ecm: Writen 45000 bytes to target file. took 23524 ms&lt;br /&gt;[00:00:33.035,552] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.058,776] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:33.159,393] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.182,769] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:33.200,561] &amp;lt;inf&amp;gt; wr_ecm: Writen 46000 bytes to target file. took 23787 ms&lt;br /&gt;[00:00:33.213,500] &amp;lt;inf&amp;gt; wr_ecm: Writen 47000 bytes to target file. took 23800 ms&lt;br /&gt;[00:00:33.226,470] &amp;lt;inf&amp;gt; wr_ecm: Writen 48000 bytes to target file. took 23813 ms&lt;br /&gt;[00:00:33.239,410] &amp;lt;inf&amp;gt; wr_ecm: Writen 49000 bytes to target file. took 23826 ms&lt;br /&gt;[00:00:33.337,493] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.360,778] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:33.458,099] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.480,773] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 22ms&lt;br /&gt;[00:00:33.498,077] &amp;lt;inf&amp;gt; wr_ecm: Writen 50000 bytes to target file. took 24085 ms&lt;br /&gt;[00:00:33.511,047] &amp;lt;inf&amp;gt; wr_ecm: Writen 51000 bytes to target file. took 24098 ms&lt;br /&gt;[00:00:33.523,986] &amp;lt;inf&amp;gt; wr_ecm: Writen 52000 bytes to target file. took 24110 ms&lt;br /&gt;[00:00:33.536,926] &amp;lt;inf&amp;gt; wr_ecm: Writen 53000 bytes to target file. took 24123 ms&lt;br /&gt;[00:00:33.628,021] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.650,787] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 22ms&lt;br /&gt;[00:00:33.717,987] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.740,783] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:33.828,063] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:33.850,799] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 22ms&lt;br /&gt;[00:00:33.867,614] &amp;lt;inf&amp;gt; wr_ecm: Writen 54000 bytes to target file. took 24454 ms&lt;br /&gt;[00:00:33.880,584] &amp;lt;inf&amp;gt; wr_ecm: Writen 55000 bytes to target file. took 24467 ms&lt;br /&gt;[00:00:33.893,524] &amp;lt;inf&amp;gt; wr_ecm: Writen 56000 bytes to target file. took 24480 ms&lt;br /&gt;[00:00:33.906,494] &amp;lt;inf&amp;gt; wr_ecm: Writen 57000 bytes to target file. took 24493 ms&lt;br /&gt;[00:00:34.005,584] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:34.028,778] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:34.100,494] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;[00:00:34.123,779] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:34.213,226] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt;Thread analyze:&lt;br /&gt; thread_analyzer : STACK: unused 200 usage 824 / 1024 (80 %); CPU: 1 %&lt;br /&gt; : Total CPU cycles used: 15274&lt;br /&gt; usb_mass : STACK: unused 3632 usage 464 / 4096 (11 %); CPU: 0 %&lt;br /&gt;[00:00:34.235,778] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 22ms&lt;br /&gt; : Total CPU cycles used: 106&lt;br /&gt;[00:00:34.252,136] &amp;lt;inf&amp;gt; wr_ecm: Writen 58000 bytes to target file. took 24839 ms&lt;br /&gt;[00:00:34.265,106] &amp;lt;inf&amp;gt; wr_ecm: Writen 59000 bytes to target file. took 24852 ms&lt;br /&gt;[00:00:34.278,076] &amp;lt;inf&amp;gt; wr_ecm: Writen 60000 bytes to target file. took 24865 ms&lt;br /&gt;[00:00:34.291,015] &amp;lt;inf&amp;gt; wr_ecm: Writen 61000 bytes to target file. took 24877 ms&lt;br /&gt;[00:00:34.388,366] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt; usbd_workq : STACK: unused 3192 usage 904 / 4096 (22 %); CPU: 0 %&lt;br /&gt; : Total CPU cycles used: 4246&lt;br /&gt; sysworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt;[00:00:34.411,804] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt; : Total CPU cycles used: 0&lt;br /&gt; usbworkq : STACK: unused 3960 usage 136 / 4096 (3 %); CPU: 0 %&lt;br /&gt;[00:00:34.476,989] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt; : Total CPU cycles used: 1&lt;br /&gt; idle : STACK: unused 252 usage 68 / 320 (21 %); CPU: 79 %&lt;br /&gt; : Total CPU cycles used: 866128&lt;br /&gt;[00:00:34.499,786] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt; main : STACK: unused 2984 usage 1112 / 4096 (27 %); CPU: 18 %&lt;br /&gt;[00:00:34.591,400] &amp;lt;inf&amp;gt; flashdisk: JXL about to flashdisk_cache_commit&lt;br /&gt; : Total CPU cycles used: 207254&lt;br /&gt; ISR0 : STACK: unused 1664 usage 384 / 2048 (18 %)&lt;br /&gt;[00:00:34.614,807] &amp;lt;inf&amp;gt; flashdisk: flashdisk_cache_commit: 4096 write time: 23ms&lt;br /&gt;[00:00:34.630,676] &amp;lt;inf&amp;gt; wr_ecm: Writen 62000 bytes to target file. took 25217 ms&lt;br /&gt;[00:00:34.643,615] &amp;lt;inf&amp;gt; wr_ecm: Writen 63000 bytes to target file. took 25230 ms&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432043?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 13:45:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa51c744-bf89-420f-9220-f0f36c058c68</guid><dc:creator>JustinL</dc:creator><description>&lt;p&gt;I will give that a try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr FATFS Flash disk cache commit slow down by 200x when mass storage USB disconnected</title><link>https://devzone.nordicsemi.com/thread/432037?ContentTypeID=1</link><pubDate>Tue, 20 Jun 2023 13:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6b27253-7586-40d9-813f-807772a8311c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There may be some thread that is checking the USB state or similar that is blocking the CPU from executing your flash write operations.&lt;/p&gt;
&lt;p&gt;Can you try out the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.0/zephyr/services/debugging/thread-analyzer.html"&gt;Thread analyzer&lt;/a&gt;&amp;nbsp;library, to see if some thread is using more CPU time than expected?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>