<?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>always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91915/always-have-to-restart-system-after-eraseall-and-firmware-download</link><description>so this is something weird I encountered. 
 Every time I use an eraseall statement and download my firmware, the chip doesnt start up immediately unless I reset it 4 times. Any idea on this?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Sep 2022 13:23:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91915/always-have-to-restart-system-after-eraseall-and-firmware-download" /><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387946?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 13:23:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9e4edc6-4e6b-49e7-8016-e556e923911b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Can you try again to get the hardfault handler working? Without it, perhaps ti would make sense to try to log or inspect the parameters you provide to fstorage. Could there be corrupt pointers, for instance? Coming from some data that is stored in flash (as you see changes after a certain number of resets, these changes must be stored in something persistent, like flash)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387710?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 14:02:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a4b7ee1-2471-4ed2-b7ed-ff623bac5009</guid><dc:creator>Juliusc</dc:creator><description>&lt;p&gt;So I found out it doesnt actually happen at that SVCALL but rather somewhere before (I just put in a delay before starting my advertising) &amp;nbsp;and got the hardfault at that place. How do I find out whats written in the triggered event?:&lt;/p&gt;
&lt;p&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/pastedimage1663941714491v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;thanks for your help already, I appreciate your quick responses!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387507?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 13:02:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd5038f4-8515-4593-87fa-82d5a3928959</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;How have you determined that it happens on an SVCall? And is that the&amp;nbsp;sd_ble_gap_adv_start(), or&amp;nbsp;something else?&lt;/p&gt;
[quote user="Juliusc"]I am using the peer manager btw so this is something that could fail as well maybe? [/quote]
&lt;p&gt;The peer manager like any other SW library could fail, but I do think it is premature to blame that at this point (and not very likely). You need to debug to understand what happens (for instance working a bit more with the approaches I have suggested). If this happens consistently after 4 resets it must be that something changes over time, either because of writing to flash, or some external circuitry or something else, so that should give a hint.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387333?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 14:28:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c1a418d-71a1-47e5-bc3f-ead1c1ae82eb</guid><dc:creator>Juliusc</dc:creator><description>&lt;p&gt;okay I will try some of these things but I have already gone through these things and the problem is that the hardfault happens on an SVCall. Therefore I can only go to &amp;#39;&lt;/p&gt;
&lt;pre&gt;sd_ble_gap_adv_start&lt;/pre&gt;
&lt;p&gt;&amp;#39; and not any further. I am using the peer manager btw so this is something that could fail as well maybe? I am not writing to storage before starting the advertising so this is strange to me as well. &amp;nbsp;will go through some data that goes into the advertising_init structure but I don&amp;#39;t think its a problem in there.&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387310?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 13:22:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1e46551-4d8e-43a7-b67e-f95cc973ac85</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;That is odd. Alternatively then you can look at what happens before, where you are writing to flash via fstorage. Could it be that some pointer values are wrong for some reason? Are you basing something upon data that will be but have not yet been written to flash, or something else? If it is difficult to find it by inspection, and you cannot get the hardfault handler working, then a&amp;nbsp;third alternative could be to comment out parts of your code and gradually include more to narrow down the problematic part.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387294?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 12:32:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60e5ec4e-1515-4632-a35a-c2d7bdb79156</guid><dc:creator>Juliusc</dc:creator><description>&lt;p&gt;&amp;nbsp;I tried this once but the hardfault handler doesn&amp;#39;t trigger although I followed those steps meticulously&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;after enabling the hardfault breakpoint the call stack just doesn&amp;#39;t show anything any more&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387284?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 12:01:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24896abf-bc27-464b-8c53-9250e5a06f2e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;From the call stack I see that you ended up in the hardfault handler. That could be caused by several things, like for instance dereferencing&amp;nbsp;an invalid pointer (or something else). I suggest you start by adding a hardfault handler and take it from there. See for instance &lt;a href="https://jimmywongiot.com/2019/02/11/how-to-add-the-hardfault-handler-on-nrf-sdk/"&gt;How to add the hardfault handler on nRF SDK&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387237?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 09:14:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ea765f8-014d-49f7-acc6-361f6498c078</guid><dc:creator>Juliusc</dc:creator><description>&lt;p&gt;some more info:&lt;/p&gt;
&lt;p&gt;the first thing I do is to init ble. after that I will init my flash (but it doesn&amp;#39;t reach that point when the nRF&amp;nbsp;hardfaults)&lt;/p&gt;
&lt;p&gt;I am using&amp;nbsp;SDK 17.1. without Zephyr. I am using a custom PCB but I don&amp;#39;t really understand how a circuit could be the problem, can you maybe elaborate on this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/387230?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 08:56:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a08878a-c3b0-4be2-9fe5-784995645186</guid><dc:creator>Juliusc</dc:creator><description>&lt;p&gt;Hi I have done that, my firmware halts at this point:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;thought your suggestion on the flash writes might be right since it doesn&amp;#39;t happen if I don&amp;#39;t erase all data&lt;/p&gt;
&lt;p&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/pastedimage1663750524966v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: always have to restart system after eraseall and firmware download</title><link>https://devzone.nordicsemi.com/thread/386158?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 12:03:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3c06eef-f459-48fa-959d-0a6dde80d9f6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Seen from the nRF there is nothing that explains why you would need 4 resets. It could be that something happens on external circuitry (that is affected by your firmware running and behaving differently on each iteration based on that), or that you read and write persistent&amp;nbsp;data to flash and act differently on that, for instance. There could also be something else.&lt;/p&gt;
&lt;p&gt;To fix the issue, you first need to understand what is going on. To figure that out, I suggest you erase, download firmware, and reset once, then attach your debugger to see what state the device/your firmware is in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>