<?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>nRF5340, LittleFS writes appear to block all threads</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109051/nrf5340-littlefs-writes-appear-to-block-all-threads</link><description>I have been playing around with using LittleFS to access the internal flash for reading/writing to non-volatile/persistent storage. However, especially with writing data, I notice that the rest of my main thread&amp;#39;s asynchronous operations (LED toggles</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Mar 2024 14:08:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109051/nrf5340-littlefs-writes-appear-to-block-all-threads" /><item><title>RE: nRF5340, LittleFS writes appear to block all threads</title><link>https://devzone.nordicsemi.com/thread/473461?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2024 14:08:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0591647a-3b10-41ab-b1c2-8413f28386d9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for confirming. I&amp;#39;m wondering if your use of LittleFS could result in frequent page erases, which&amp;nbsp;is a time consuming operation. A page erase can take up to 87.5 ms, during which the CPU will be blocked (&lt;a title="Flash programming" href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/nvmc.html?cp=4_0_0_6_20_8_0#unique_2113155170"&gt;Flash programming&lt;/a&gt;). Please add &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE"&gt;CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE&lt;/a&gt;=y to your prj.conf&amp;nbsp;and see if it helps mitigate the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, LittleFS writes appear to block all threads</title><link>https://devzone.nordicsemi.com/thread/473022?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2024 17:37:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f817f0b5-ba72-4aed-8c1e-bdaf5323164a</guid><dc:creator>afok-esmart</dc:creator><description>&lt;p&gt;Thanks for your suggestion, but I tried adding the k_msleep(5) and it did not help; still seeing the same stop in activity from my main thread. Also tried k_msleep(50) out of curiosity and the amount of time it stopped has not changed (still roughly 80ms).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, LittleFS writes appear to block all threads</title><link>https://devzone.nordicsemi.com/thread/473019?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2024 17:00:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a576b5a8-1a5d-4d24-9929-d9b070abe6c9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t immediately see any problems with the code you&amp;#39;ve posted. However, as a test, could you please try adding k_msleep(5); after LED_Yellow(LED_OFF); in your storage_thread? The filesystem API is synchronous, but I wouldn&amp;#39;t expect it to block your other threads.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>