<?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>Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100644/mesh-assert-on-flash_area_build</link><description>Hi, We are having trouble with the analysis and need your help. We are building and operating a mesh system with a built-in bootloader to enable FW updates on the mesh DFU in the future. In the process, we encountered a phenomenon where one node stopped</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jul 2023 12:54:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100644/mesh-assert-on-flash_area_build" /><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/437023?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 12:54:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32368115-8e79-4607-bb8e-15d839a985a3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. I have been out for vacation, and just checking by.&lt;/p&gt;
&lt;p&gt;It may be that this is the case. In general, it &lt;em&gt;shouldn&amp;#39;t&amp;nbsp;&lt;/em&gt;happen, and there are recovery mechanisms that should take care of this, but we have seen that it fails before. What I recommend you to do is to add a piece of recovery for this scenario as well. If the page is not blank, and metadata_is_valid() returns false, then erase the page, and reboot (NVIC_SystemReset()), and then I believe everything should go back to normal. By the looks of things, it looks like the page should be empty, so either it was attempted erased, or it was erased, and attempted written to, possibly right before a power out (brownout) so I assume that the best option here is to erase the page, and try again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, I am not sure whether you are doing this or not, but try avoiding writing to flash directly after booting up the application. If possible, add a delay of some seconds before doing so. The reason is that even if the flash manager should recover from a brownout, it may fail if it is in the middle of a recovery, and then looses power again (and again, and again...). This may be the case if your battery is running low. The chip draws current, causing the battery voltage to drop below the threshold, and the nRF shuts off. When it does, the battery voltage increases a tiny bit, because it has no current being drawn, enough for the nRF to power back on. Then you can get stuck in this cycle for a while before the battery voltage actually goes low enough for the nRF to stop power cycling.&lt;/p&gt;
&lt;p&gt;If you are writing to flash on every boot, then the chance for it to be disrupted in a flash write operation increases significantly during this power cycle stage. Adding e.g. 1 second delay will reduce this&amp;nbsp;&lt;em&gt;alot&lt;/em&gt;!&lt;/p&gt;
&lt;p&gt;NB: I will be out for a couple of weeks, so if you are in need of quick replies, I suggest you create a new ticket, and you can refer to this one.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/433664?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 11:44:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e924e652-04d9-497d-8849-f1a3278f64a0</guid><dc:creator>wataru_m</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Thank you for your reply.&lt;br /&gt;&lt;br /&gt;My apologies as well.&lt;br /&gt;I was confused because I did not understand the format of the hex file.&lt;br /&gt;I understood what you meant.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/100644/mesh-assert-on-flash_area_build/432868"]On the device to your left. can you try to run nrfjprog --recover, and read out the flash again? Does it look the same, or will it be all 0xFF&amp;#39;s then?[/quote]
&lt;p&gt;I tried it and everything turned out to be FF.&lt;br /&gt;From this, it seems that there is no physical damage.&lt;br /&gt;&lt;br /&gt;Then, after chip-erasing, we wrote softdevice, bootloader, application, and devicepage to confirm that the device works as expected. (Confirmed by logs on the RTT viewer)&lt;br /&gt;&lt;br /&gt;From that state, I tried writing code.hex, ram.hex, and uicr.hex, which I had previously dumped, using nrfjprog --program, and the assertion occurred in the same place as initially.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;From the device on which we were able to reproduce the assertion, we tried to dump the code with nrfjprog --readcode as well, but it did not exactly match the hex file that we had originally dumped.&lt;/p&gt;
&lt;p&gt;I was getting more and more confused as to what I was checking.&lt;br /&gt;Is it safe to assume that the flash state was rewritten to something unintended because the battery voltage dropped and the power was turned off while some unfortunate process was taking place, as we initially suspected?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Wataru&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/432868?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2023 08:07:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:feda9444-abfb-4e07-9aba-f850278b8ba1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Sorry for being unclear.&lt;/p&gt;
[quote user="wataru_m"]I did not understand the meaning of &amp;quot;the exact same flash on another device&amp;quot;[/quote]
&lt;p&gt;I meant that if you read out the flash on one device, and store it in a hex file, then you can program another nRF with that .hex file and you should be able to reproduce the issue there.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="wataru_m"]&lt;p&gt;What can be confirmed by doing this?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;If you upload the hex file here, in addition to your application, I would be able to reproduce and even debug the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That being said. It looks like you have some non-erased flash. Possibly even broken.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the device to your left. can you try to run nrfjprog --recover, and read out the flash again? Does it look the same, or will it be all 0xFF&amp;#39;s then?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/432506?ContentTypeID=1</link><pubDate>Thu, 22 Jun 2023 11:35:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c57a50b-dbeb-4b7c-9bb8-5b2b6f6e8ab7</guid><dc:creator>wataru_m</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Edvin,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thank you for your reply, and I&amp;#39;m sorry for late reply.&lt;br /&gt;Sorry, our application is difficult to provide.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I dumped the code on the device that failed after running in the customer&amp;#39;s environment and another device with the same FW written to it for comparison.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Attached below is the result of the comparison near 0x000f5000.&lt;br /&gt;I may be looking at the hex file wrong, but I am checking the value of the address following &amp;quot;:10&amp;quot;, which is &amp;quot;5000&amp;quot;.&lt;br /&gt;(There were 16 addresses with the address &amp;quot;5000&amp;quot;, and we have confirmed the 16th one.&lt;br /&gt;We expect that this is the information for the address 0x000f5000.)&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1687433183664v2.png" alt=" " /&gt;&lt;br /&gt;On the left is the failed device and on the right is another device prepared for comparison.&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t know what information is being written, but most of the failed devices are marked &amp;quot;FF&amp;quot;. Some of them are marked &amp;quot;EF&amp;quot;. (Broken?)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I did not understand the meaning of &amp;quot;the exact same flash on another device&amp;quot;&lt;br /&gt;Do you mean that the dumped hex file (using --readcode) is written to the device again using nrfjprog?&lt;br /&gt;What can be confirmed by doing this?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;We have not enabled the power fail comparator.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Wataru&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/431497?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2023 12:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:474f0926-323b-4ca2-a56b-474567ec5fab</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;By the way, did you enable the power fail comparator in your application? See link:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&amp;amp;anchor=unique_726894245"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&amp;amp;anchor=unique_726894245&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There is an issue there where if this is enabled, and you try to write to flash, it will report that the flash write was successful but the flash is not actually written. This in itself is not an issue that should lead to corrupted flash, but we have seen incidents where this event occurring while you are in the process of writing to flash, that you can get some bitfaults, which could lead to corrupted flash.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/431490?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2023 12:32:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bfbdadd-de24-461b-ab82-be93f95752f2</guid><dc:creator>Edvin</dc:creator><description>[quote user="wataru_m"]I am thinking that the trigger for this condition could be a dead battery, but can you give me your opinion as Nordic?[/quote]
&lt;p&gt;That could be, but the flash manager should be able to handle power outages. However, there may be a combination of events, timing, in combination with a brownout that could trigger a bug that we are not aware of.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="wataru_m"]How can I verify the flash address I am trying to use in this debugging environment?&lt;br /&gt;[/quote]
&lt;p&gt;It looks like it is on address 0x000f5000, p_area.&lt;/p&gt;
&lt;p&gt;If you read out the flash using &amp;quot;nrfjprog --readcode my_flash_dump.hex&amp;quot; it will store the flash on the nRF chip to my_flash_dump.hex. You can use this to re-program another DK (or I can, if I can get a copy of your application, so that I can build it here in my office desk), and do some digging. If the issue is that one of the flash pages are corrupt after some period of time, the exact same flash on another device should reproduce the issue, because it would contain the same corrupted flash page.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That would require you to still have the failing piece, and that you didn&amp;#39;t re-program it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/431201?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2023 09:46:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f180e68-a68f-4084-8c28-ca5062a628fa</guid><dc:creator>wataru_m</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;br /&gt;&lt;br /&gt;Thank you for your reply.&lt;br /&gt;&lt;br /&gt;I am sorry, but I do not have an overview of the processes taking place during initialization.&lt;br /&gt;(Is the call stack flow that you are pasting into the ticket reading provisioning information, etc...?)&lt;br /&gt;&lt;br /&gt;Aside from that, I tried writing the same bootloader and firmware to another board, provisioning it to the same network, and seeing if the program would run in the same way as the board where the problem occurred.&lt;br /&gt;(I specifically checked the flow during initialization.)&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1686820645334v2.png" alt=" " /&gt;&lt;br /&gt;The process proceeded in the same way until about halfway through.&lt;br /&gt;However, the flash_area_is_valid() function at line 834 of flash_manager.c returned true, confirming that the process proceeded to a different branch from the board where the problem occurred.&lt;br /&gt;This means that the flash_area_build function that generated the assertion will not be executed.&lt;br /&gt;&lt;br /&gt;The inside of p_manager (a structure of flash_manager_t type) after the flash_manager_add() function is completed is shown in the figure below.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1686821075766v3.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;From these confirmed results, for some reason, the flash condition? I am guessing that the &amp;quot;Mere Old Man&amp;quot; has gone wrong.&lt;br /&gt;&lt;br /&gt;I am thinking that the trigger for this condition could be a dead battery, but can you give me your opinion as Nordic?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please let me know about the matter you advised.&lt;br /&gt;How can I verify the flash address I am trying to use in this debugging environment?&lt;br /&gt;Also, if I were to dump the flash into a hex file, I am not sure how I would be able to reproduce the behavior in question.&lt;br /&gt;&lt;br /&gt;Best Regards,&lt;br /&gt;Wataru&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/430995?ContentTypeID=1</link><pubDate>Wed, 14 Jun 2023 11:41:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55a0fa98-75a5-4e0c-b742-555acccbc440</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;And if possible, please also try to dump the flash in the chip to a hex file using:&lt;/p&gt;
&lt;p&gt;nrfjprog --readcode flash_dump.hex&lt;/p&gt;
&lt;p&gt;This way, it would be easier to reproduce the issue if we have all the flash in a .hex file.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh assert on flash_area_build()</title><link>https://devzone.nordicsemi.com/thread/430994?ContentTypeID=1</link><pubDate>Wed, 14 Jun 2023 11:40:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec77a299-9593-4c44-8644-d095f4475bdf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Wataru,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. I was unexpecedly out of office after being assigned this ticket.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Does this means that the flash page that it is trying to use is not empty (not all 0xFFs), but it contains some&amp;nbsp;garbage data? If you can still reproduce the issue, can you please check:&lt;/p&gt;
&lt;p&gt;1. the flash address it is trying to use, and:&lt;/p&gt;
&lt;p&gt;2. read out the entire flash? You can do so using the command:&lt;/p&gt;
&lt;p&gt;nrfjprog --readcode 0x00000000 --n 0x00100000 &amp;gt;&amp;gt; flash_dump.txt&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>