<?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>Unable to erase entire external flash on nrf5340dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120439/unable-to-erase-entire-external-flash-on-nrf5340dk</link><description>Hello, I am trying to save my sensor data and system uptime to the external flash on my nrf5340dk. So far I have been able to erase some sectors of the external flash, write several bytes of data in it and read it out and send it over USB CDC ACM without</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Apr 2025 19:27:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120439/unable-to-erase-entire-external-flash-on-nrf5340dk" /><item><title>RE: Unable to erase entire external flash on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/531084?ContentTypeID=1</link><pubDate>Tue, 08 Apr 2025 19:27:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f4dc048-324a-4860-a348-9e903004de7e</guid><dc:creator>Shuhao Dong</dc:creator><description>&lt;p&gt;Hi, yes I understand the erase should be performed on a sector size alignment. As a mentioned in my original question, I simply call flah_erase () function in a while loop, erase a single sector (4KB) in each iteration, till the end address of the flash. But this procedure stops with error code -5 at address around&amp;nbsp;&lt;span&gt;0x502000, which is only 995 sectors.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to erase entire external flash on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/530884?ContentTypeID=1</link><pubDate>Mon, 07 Apr 2025 19:02:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddcbb021-cea5-415d-90f4-ab9d25dd1d3b</guid><dc:creator>Amanda Hsieh</dc:creator><description>[quote user="Shuhao Dong"]But again, some error code reported misalignment of sector size if I do so.&amp;nbsp;[/quote]
&lt;p&gt;What did you modify in the sample?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Remember that flash erase operations happen on a page-by-page basis (typically 4KB pages for external flash), so you need to respect these boundaries when performing erase operations.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to erase entire external flash on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/530761?ContentTypeID=1</link><pubDate>Mon, 07 Apr 2025 08:31:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68b9923e-8ee4-4a30-9b36-e0d900ac0525</guid><dc:creator>Shuhao Dong</dc:creator><description>&lt;p&gt;Hello, I am using this sample at the moment. I can see somen comments in the code says, specify the area to be erased to be the same as the flash size then should erase the entir flash. But again, some error code reported misalignment of sector size if I do so.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to erase entire external flash on nrf5340dk</title><link>https://devzone.nordicsemi.com/thread/530618?ContentTypeID=1</link><pubDate>Fri, 04 Apr 2025 12:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf55b6b2-1262-4c82-8133-3f2df31722c0</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can refer to this sample:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/drivers/spi_flash"&gt;https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/drivers/spi_flash&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>