<?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>Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10019/clear-config-after-succesful-dfu</link><description>Hi, 
 We have a little issue that we at the moment need to cycle power on v3 nRF51822 after DFU. 
 We have determined the the reason has something to do with the whole complicated system configs - we use a customised bootloader that uses button, leds</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Jan 2017 09:42:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10019/clear-config-after-succesful-dfu" /><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37119?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2017 09:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37a223bd-5c28-4c81-a4a2-4b9c7a2afd36</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The softreset is done on the new Secure DFU from SDK v12, not the legacy DFU (SDKv6 til SDKv11).&lt;/p&gt;
&lt;p&gt;Note that we do clear all interrupts before we switch to application or bootloader with the interrupts_disable() function. What is leftover is the setting of the timer and the EVENTs.
Clearing the Events before use is a good use.&lt;/p&gt;
&lt;p&gt;Note that APP_TIMER doesn&amp;#39;t use NRF_TIMER, it uses RTC.&lt;/p&gt;
&lt;p&gt;You can implement your own soft reset with &amp;quot;NVIC_SystemReset()&amp;quot; when you switch from application to bootloader. You should call it after you set the GPREGRET, also if you forwarding bond information, you need to retain the RAM memory area for the peer_data.&lt;/p&gt;
&lt;p&gt;If you have further question, please create a new case describe your issue with more detail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37122?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2017 08:37:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3372bff-ce9e-4b4b-9ab1-c3c92f59ee4c</guid><dc:creator>NG</dc:creator><description>&lt;p&gt;Now, the timers_init function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void timers_init(void)
{
    //PWM disable timers, to avoid device bricking, after ATO DFU
    // See: &lt;a href="https://devzone.nordicsemi.com/question/55694/clear-config-after-succesful-dfu/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;
    NRF_TIMER1-&amp;gt;TASKS_STOP = 1;
    NRF_TIMER1-&amp;gt;TASKS_SHUTDOWN=1;
    NRF_TIMER1-&amp;gt;EVENTS_COMPARE[0]=0;
    NRF_TIMER1-&amp;gt;EVENTS_COMPARE[1]=0;
    NRF_TIMER1-&amp;gt;EVENTS_COMPARE[2]=0;
    NRF_TIMER1-&amp;gt;EVENTS_COMPARE[3]=0;
    NVIC_DisableIRQ(TIMER1_IRQn);

    // Initialize timer module.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); //scheduler not used

    button_timer_init();
    battery_timer_init();
  //etc etc...
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37121?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2017 08:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92b2f5fa-7927-41c9-923d-b29ec784d936</guid><dc:creator>NG</dc:creator><description>&lt;p&gt;So, in summary, before our timers_init function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void timers_init(void)
{
    // Initialize timer module.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); //scheduler not used
   
    button_timer_init();
    battery_timer_init(); 
//etc etc...
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37120?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2017 08:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64ee2573-342d-4546-9989-8003569f8a36</guid><dc:creator>NG</dc:creator><description>&lt;p&gt;Hi Hung Bui,
Thanks for your response. Can you please clarify the soft reset done between application and bootloader? At the end our bootloader main function, we have &amp;quot;NVIC_SystemReset()&amp;quot; however this problem still occurs.&lt;/p&gt;
&lt;p&gt;The way I have worked around it is to include the timer1/2 stop code (as you wrote above) in the timer_init() function, just before APP_TIMER_INIT(). The reason I do it here is because adding the timer stop code only into reset_prepare() won&amp;#39;t guarantee that the timers are stopped if you&amp;#39;re doing a OTA DFU between SDK8 and SDK10 code, you&amp;#39;ll brick your device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37117?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 11:24:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10fde6f6-b439-4ca7-9ef3-2c435840a7bf</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi NG,&lt;/p&gt;
&lt;p&gt;I agree that user should be made aware of this requirement. In our newer SDK, the switching between application and bootloader is done by a soft reset, so it&amp;#39;s not needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37118?ContentTypeID=1</link><pubDate>Sat, 31 Dec 2016 23:22:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45bf326a-00df-4ab5-836d-f4d3f48d0e14</guid><dc:creator>NG</dc:creator><description>&lt;p&gt;Hi - we have found if this is not done then the device bricks after OTA DFU! Observed with SDK10 PWM library code, not in SDK8. This should be documented somewhere.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37116?ContentTypeID=1</link><pubDate>Fri, 04 Mar 2016 09:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95109dc9-0296-49a6-8572-6fc15bdabbe4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Just an update to my comment, if you are using the app_pwm, there is a chance that the timer is not stopped when you jump from application to bootloader.&lt;/p&gt;
&lt;p&gt;Therefore if there are event pending, the event handler will be called again when we jump back ti application and we will be in trouble because it will be triggered even before we finish initialize the timer again.&lt;/p&gt;
&lt;p&gt;So you should stop any timer, clear any pending event before jumping to the bootloader.
For example if you are using PWM0 and TIMER1 you should add:
NRF_TIMER1-&amp;gt;TASKS_STOP = 1;
NRF_TIMER1-&amp;gt;TASKS_SHUTDOWN=1;
NRF_TIMER1-&amp;gt;EVENTS_COMPARE[0]=0;
NRF_TIMER1-&amp;gt;EVENTS_COMPARE[1]=0;
NRF_TIMER1-&amp;gt;EVENTS_COMPARE[2]=0;
NRF_TIMER1-&amp;gt;EVENTS_COMPARE[3]=0;
NVIC_DisableIRQ(TIMER1_IRQn);&lt;/p&gt;
&lt;p&gt;to bootloader_util_app_start() in bootloader_util.c , and call these before bootloader_util_reset(start_addr);&lt;/p&gt;
&lt;p&gt;Another solution, maybe easier one is to do a soft reset after finish DFU and before jumpping back to application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clear config after succesful DFU?</title><link>https://devzone.nordicsemi.com/thread/37115?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2015 09:06:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c148d706-593c-4b79-8da2-3571f4e6317c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Henris,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s true that we don&amp;#39;t reset the register configuration before we jump from bootloader to application. The application should not give assumption that all register is in reset state when it starts. It should configure all registers when start using the peripheral.
Do you have the issue when you test with your bootloader + our example application ?&lt;/p&gt;
&lt;p&gt;If possible please provide us a simple example(bootloader + application) that show the issue that we can reproduce the issue here (prefer if it can be tested on nRF51 DK board).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>