<?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>nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126721/nrf52833---partial-flash-erase-best-practices</link><description>I am using nrfx_nvmc_page_partial_erase_init() and nrfx_nvmc_page_partial_erase_continue() to erase flash in-between wireless connection events. The datasheet states: &amp;quot; The bits in the page are undefined if the flash page erase is incomplete, i.e. if</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Jan 2026 23:31:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126721/nrf52833---partial-flash-erase-best-practices" /><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559730?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 23:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bd816fc-0d03-444e-803a-0d58f1527c8c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Have in mind that when you write to flash, you are turning ones to zeros. You are not doing the ones any better until a&amp;nbsp;complete erase.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559728?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 23:28:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e555fc8-1b4a-4c85-9cea-bcf7467f716d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Sorry. It should be &amp;quot;can&amp;#39;t&amp;quot; yes.&lt;/p&gt;
&lt;p&gt;Fixed it now.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559725?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 21:50:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03f00516-5a86-46cf-998c-40a8f058700c</guid><dc:creator>KWolfe81</dc:creator><description>&lt;p&gt;Kenneth,&lt;/p&gt;
&lt;p&gt;Sorry to be annoying - I want to be&amp;nbsp;REALLY clear.&amp;nbsp; You meant to write &amp;quot;CAN&amp;quot; and not &amp;quot;CAN&amp;#39;T&amp;quot; in the sentence:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;You can really rely on anything in that case.&lt;br /&gt;&lt;br /&gt;Right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559715?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 16:28:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4d33823-1c47-4bce-ad87-8d7b1ce82198</guid><dc:creator>KWolfe81</dc:creator><description>&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559710?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 15:33:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05118136-4057-49b4-9291-a469385e12a6</guid><dc:creator>Kenneth</dc:creator><description>[quote user="KWolfe81"]1)&amp;nbsp;If we can&amp;#39;t trust a read of 0xFF,&amp;nbsp;what should we do if the&amp;nbsp;device resets mid partial&amp;nbsp;erase (for instance, the user&amp;nbsp;removes the battery)?[/quote]
&lt;p&gt;My suggestion would be to write a magic word somewhere in the page after a full erase is done.&amp;nbsp;&lt;/p&gt;
[quote user="KWolfe81"]2)&amp;nbsp;If we write data to a page that&amp;nbsp;didn&amp;#39;t get fully erased (such as in my&amp;nbsp;question above), what is the expected&amp;nbsp;result?&amp;nbsp; Can we trust that&amp;nbsp;newly programmed data if it reads back correctly?[/quote]
&lt;p&gt;You can&amp;#39;t really rely on anything in that case.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559706?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 15:26:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03c94900-a65a-4457-9a38-9200a7159b46</guid><dc:creator>KWolfe81</dc:creator><description>&lt;p&gt;Kenneth,&lt;/p&gt;
&lt;p&gt;Thank you for the reply. Without going into detail, my product is very timing constrained on our chip and cannot use the standard zephyr APIs.&lt;br /&gt;&lt;br /&gt;I will need to drill down into&amp;nbsp;this a bit more and be explicit about the situation.&lt;br /&gt;&lt;br /&gt;1)&amp;nbsp;If we can&amp;#39;t trust a read of 0xFF,&amp;nbsp;what should we do if the&amp;nbsp;device resets mid partial&amp;nbsp;erase (for instance, the user&amp;nbsp;removes the battery)?&lt;br /&gt;&lt;br /&gt;2)&amp;nbsp;If we write data to a page that&amp;nbsp;didn&amp;#39;t get fully erased (such as in my&amp;nbsp;question above), what is the expected&amp;nbsp;result?&amp;nbsp; Can we trust that&amp;nbsp;newly programmed data if it reads back correctly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52833 - Partial flash erase best practices</title><link>https://devzone.nordicsemi.com/thread/559636?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2026 08:44:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4c075b1-b9d4-405a-927d-a3d105480f51</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So in general: In the nRF Connect SDK, flash erase/write operations are synchronized with the BLE radio using Multi-Protocol Service Layer (MPSL)-managed timeslots (when MPSL is enabled). In practice, this means that if you use the standard Zephyr flash API on an nRF52833 (e.g. flash_erase()/flash_write() or higher-level storage like NVS/Settings) while BLE is running, the system will not perform the flash operation immediately in the middle of a radio event. Instead, the operation is deferred and executed in a radio idle window obtained via the Multi-Protocol Service Layer’s timeslot mechanism. MPSL essentially coordinates flash access with the BLE stack to avoid timing conflicts. So the absolute simplest is just to use the flash api as-is, even if that means it may skip a few connection intervals while executing an erase operation which is timing consuming, but to answer your questions:&lt;/p&gt;
[quote user=""]When the device resets, can we trust flash was successfully erased if&amp;nbsp;it reads 0xFF?[/quote]
&lt;p&gt;Not until this has occurred: &amp;quot;&lt;em&gt;&amp;quot;&lt;span&gt;The bits in the page are undefined if the flash page erase is incomplete, i.e. if a partial erase has started but the total erase time is less than&amp;nbsp;&lt;/span&gt;&lt;span&gt;t&lt;/span&gt;&lt;span&gt;ERASEPAGE&lt;/span&gt;&lt;/em&gt;&lt;span&gt;&lt;em&gt;.&amp;quot;&lt;/em&gt;&lt;/span&gt;&amp;quot;&lt;/p&gt;
[quote user=""]If we write&amp;nbsp;data to the page and read it back successfully, can we trust that it is fully written (e.g. the flash is not in some meta-stable state)?[/quote]
&lt;p&gt;Yes, the CPU will be blocked during the necessary time to write, so once CPU resumes you can trust the content. Presuming of course that the page have been erased the necessary time in the first place.&lt;/p&gt;
[quote user=""]If I&amp;nbsp;want to proactively stop the erase after beginning, can I write 0x00 to one of the bytes in the page to mark it as invalid?[/quote]
&lt;p&gt;Bits that are written to 0 cannot go back to 1 without an erase no.&amp;nbsp;The only way for a bit to go from 0 to 1 is through an erase, and it should do that for a total of&amp;nbsp;&lt;em&gt;&lt;span&gt;t&lt;/span&gt;&lt;span&gt;ERASEPAGE&lt;/span&gt;&lt;/em&gt;&amp;nbsp;to ensure it&amp;#39;s a 1.&lt;/p&gt;
&lt;p&gt;Edit: I was tipped off that partial erase is also supported by the zephyr driver, so it is not needed to use nrfx directly, see:&lt;br /&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/commit/143f9bfd4e1aed2320d46df6de4dbf1d09f4d69d"&gt;https://github.com/nrfconnect/sdk-zephyr/commit/143f9bfd4e1aed2320d46df6de4dbf1d09f4d69d&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>