<?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>nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered</link><description>Hello, 
 We have a problem that affects a few devices (&amp;lt; 0.1 %) in mass production. The devices are flashed, boot up and pass tests and get shipped to customers. Some customers will later report that the bootloader does not work. The customers are generally</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Jan 2022 14:45:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered" /><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/349312?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 14:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3e39bbb-e947-462b-bb08-5e7cf2105a5d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I verified that ERASEALL operation is blocked when one or more sections are protected with BPROT.&lt;/p&gt;
&lt;p&gt;BPROT protection enabled for Bootloader and MBR regions&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-from-2022_2D00_01_2D00_24-15_2D00_07_2D00_12.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Bootloader main() where BPROT is enabled:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1643034492392v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Can you please verify that these BPROT bits are set by your bootloader as well?&lt;/p&gt;
[quote user="ojousima"]&lt;p&gt;So if my understanding is correct, addresses 0x0001A460 .... 0x0001AFFF are erased and 0x0001B000 and onwards&amp;nbsp;&amp;nbsp;is ok.&lt;/p&gt;
&lt;p&gt;The application uses S132 v6.1.1, so this is in middle of the softdevice as far as I can tell.&amp;nbsp;&lt;/p&gt;[/quote]
&lt;p&gt;I still don&amp;#39;t understand how the entire flash could have gotten erased. But this particular case would likely have been avoided if the bootloader had correctly enabled write protection for the Softdevice and app in nrf_bootloader_app_start_final().&lt;/p&gt;
&lt;p&gt;This line is currently failing because the size argument is not aligned to a flash page boundary:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    ret_val = nrf_bootloader_flash_protect(0,
                                           nrf_dfu_bank0_start_addr() + s_dfu_settings.bank_0.image_size,
                                           false);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Fix:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    ret_val = nrf_bootloader_flash_protect(0,
                                           nrf_dfu_bank0_start_addr() + ALIGN_TO_PAGE(s_dfu_settings.bank_0.image_size),
                                           false);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/348993?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 15:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8726cb4-6a63-4cb8-863d-af3b726cdfbe</guid><dc:creator>Otso Jousimaa</dc:creator><description>&lt;p&gt;Here is a screenshot of hex file comparison of one unit which has been randomly erased and bricked - it boots up enough to turn a led on but nothing else. Maybe it is in a reboot loop and led blinks too fast for me to see, I can&amp;nbsp;check with oscilloscope if necessary.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1642776888200v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1642777525305v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To the left&amp;nbsp;we have the faulty unit, it suddenly switches to 0xFFFF for some lines.&amp;nbsp;Right has same hex file flashed to another unit.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Relevant Intel hex lines are:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;:020000040001F9
:10A4500092F86530112B03D182F8691082F88E00D2
:10A46000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC
:10AFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF61
:10B000004FF00000F071B071F070B070307170717D&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So if my understanding is correct, addresses 0x0001A460 .... 0x0001AFFF are erased and 0x0001B000 and onwards&amp;nbsp;&amp;nbsp;is ok.&lt;/p&gt;
&lt;p&gt;The application uses S132 v6.1.1, so this is in middle of the softdevice as far as I can tell.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Symptom is different than originally described, but root cause is the same. A portion of flash has&amp;nbsp;gone missing.&amp;nbsp;I can share the full hex files if necessary.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/348762?ContentTypeID=1</link><pubDate>Thu, 20 Jan 2022 14:55:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d77f05c-c14e-402e-9329-b17ec395dcda</guid><dc:creator>Otso Jousimaa</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered/348753#348753"]Just to confirm, you read this from a device that had a non-working bootloader and not a fully functional one?[/quote]
&lt;p&gt;Good to confirm. This is a fully functional one. Regrettably I don&amp;#39;t have earlier units with damaged bootloader available to check, and all the recent units I have received have been completely erased. I will update here once I get unit with a broken bootloader on my desk.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered/348753#348753"]I assume the product must be shipped without readback enabled as you are able to read out the memory.[/quote]
&lt;p&gt;Correct, we are not worried about clones / hackers for our use cases.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/348753?ContentTypeID=1</link><pubDate>Thu, 20 Jan 2022 14:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8857931d-fcc7-4fab-ac14-e7f79594b2a4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote userid="68002" url="~/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered/348738#348738"]Bootloader start address is at 0xFF8. I confirmed with a working device that 0xFF8 contains 0x&lt;span&gt;00075000 which matches the bootloader staring address.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;Just to confirm, you read this from a device that had a non-working bootloader and not a fully functional one? &lt;/p&gt;
[quote userid="68002" url="~/f/nordic-q-a/83503/nrf52832-sdk15-3-flash-erased-at-the-end-addresses-application-runs-but-bootloader-cannot-be-entered/348738#348738"]Possibly related, we have devices that are completely erased in the field:&amp;nbsp;[/quote]
&lt;p&gt;This is strange, the BPROT flash protection enabled by the bootloader on startup should prevent you from erasing the flash. You also won&amp;#39;t get direct access to the NVMC while as long as the Softdevice is enabled. I assume the product must be shipped without readback enabled as you are able to read out the memory. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/348738?ContentTypeID=1</link><pubDate>Thu, 20 Jan 2022 14:02:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1c2c2df-046d-4476-b70e-94a906873d17</guid><dc:creator>Otso Jousimaa</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Bootloader start address is at 0xFF8. I confirmed with a working device that 0xFF8 contains 0x&lt;span&gt;00075000 which matches the bootloader staring address.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Possibly related, we have devices that are completely erased in the field:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/83872/nrf52832-sdk15-3-flash-erased-in-field"&gt;devzone.nordicsemi.com/.../nrf52832-sdk15-3-flash-erased-in-field&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/346975?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 14:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65f5e1d2-0fa4-444f-8ce3-5f75705ed934</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Please check if your bootloader start address is stored at 0x10001014 or 0xff8 (maybe these are written last?). The bootloader will not be included in the boot sequence if neither of these are set (see &lt;span&gt;&lt;a title="Master boot record and SoftDevice reset procedure" href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/mbr_bootloader/mbr_sd_reset_behavior.html?cp=4_7_3_0_11_2"&gt;Master boot record and SoftDevice reset procedure&lt;/a&gt;&lt;/span&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/346918?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 11:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da48b6dd-bb65-4f17-a880-5bdb9b5babab</guid><dc:creator>Otso Jousimaa</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;We&amp;#39;re already using merge hex and flashing one hex file that contains soft device, application, bootloader and bootloader settings page.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We will check if there is FDS data in the end, although I would be very curious on why it would affect just a small portion of devices.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SDK15.3: Flash erased at the end addresses, application runs but bootloader cannot be entered</title><link>https://devzone.nordicsemi.com/thread/346915?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 11:50:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cb0b02b-6328-42c4-9567-6acbe46c7aa1</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Simple fix: Use mergehex tool to merge the production hex files into a single file, then flash in a single step. Will even be a little faster in production.&lt;/p&gt;
&lt;p&gt;I strongly suspect that the operators noticed parts passing test when the last flash steps where not completed yet, and thus skipped them to save time (and thus money).&lt;/p&gt;
&lt;p&gt;Random erase may be possible (e.g. brownout or software bug), but I would expect that to brick the devices instead of erasing the bootloader completely &lt;em&gt;and&lt;/em&gt; with the main app still running just fine.&lt;/p&gt;
&lt;p&gt;Another indication would be FDS/Peer manager data. If FDS does not find where the bootloader is (or at least should be), it will put its data at end-of-flash. Thus one would expect to find some stuff at the very last flash pages that contain FDS/peer manager data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>