<?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>Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18987/secure-dfu-bootloader-problem-nrf52832</link><description>I have a strange problem with the secure bootloader. 
 After a succsessful DFU update of firmware, the firmware starts, but resets after a short while (about a second). 
 Using RTT log, I can&amp;#39;t see any reason for the reset (with no calls to APP_ERROR_HANDLER</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 31 Jan 2017 09:30:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18987/secure-dfu-bootloader-problem-nrf52832" /><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73395?ContentTypeID=1</link><pubDate>Tue, 31 Jan 2017 09:30:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16514142-3525-4e73-add8-ab74b747c3e4</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Jan, glad to hear that you found the cause of the issue!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73394?ContentTypeID=1</link><pubDate>Tue, 31 Jan 2017 09:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbe76e7f-9563-4ce8-8c0e-f492d2fdc634</guid><dc:creator>janR</dc:creator><description>&lt;p&gt;I finally got this to work.
It turned out that it wasn&amp;#39;t related to bootloader at all.&lt;/p&gt;
&lt;p&gt;I use the FreeRTOS in my application. I have used &amp;quot;ble_app_hrs_freertos&amp;quot; example project as a starting point.
It turned out that if I built the &amp;quot;ble_app_hrs_freertos&amp;quot; project and used the bootloader to flash, this application ran just fine.&lt;/p&gt;
&lt;p&gt;When I looked after differences between &amp;quot;ble_app_hrs_freertos&amp;quot; and my application, it turned out that I had added some HW init between the softdevice BLE stack init and the while() loop in ble_stack_thread that handles events from softdevice. I guess it took too long time from BLE
stack was initialised until events were handled, so the softdevice throwed an exeption. This exeption reset the processor.
I guess I have to implement some code to handle this in a better way, as I didn&amp;#39;t catch this.&lt;/p&gt;
&lt;p&gt;After I moved the HW init to another thread, the application ran fine.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure why the application didn&amp;#39;t chrash when running without bootloader, but I suspect there is timing differences involved with and without
bootloader.&lt;/p&gt;
&lt;p&gt;Anyway, thanks for helping.&lt;/p&gt;
&lt;p&gt;Regards, Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73391?ContentTypeID=1</link><pubDate>Mon, 30 Jan 2017 13:48:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c5c1b1e-8fd8-4b4b-a50d-9f9a0cc92cea</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Jan,
the bootloader does not perform a reset when it passes execution from itself to the application so any configuration of peripherals done in the bootloader will be retained through the branching operation. I see that you have modified the bootloader by removingthe button and LED handling in the bootloader. Do you see the same behavior with the standard bootloader? Which pins are you using for the SPI(2) interface?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73388?ContentTypeID=1</link><pubDate>Thu, 19 Jan 2017 14:48:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:658dee09-b3c6-4caa-9b34-f60718a12c21</guid><dc:creator>janR</dc:creator><description>&lt;p&gt;Thanks, Darren and Bjørn,&lt;/p&gt;
&lt;p&gt;I finally got the debugger to work with &amp;quot;Debug without downloading&amp;quot;. This function was disabled in the IDE previously. I&amp;#39;m not sure why it suddenly got enabled, but I suspect I have checked a &amp;quot;debug info enabled&amp;quot; somewhere.&lt;/p&gt;
&lt;p&gt;However, now I&amp;#39;m able to debug with the error present.
I have also added the Hardfault_process and a lot of RTT log messages.&lt;/p&gt;
&lt;p&gt;It seems like the application is crashing in the Nordic SPI driver (nrf_drv_spi.c), when inside &amp;quot;spi_xfer()&amp;quot; function. It seems like it is chrashing after enabling interrupt for the callback function for the SPI.
When I look at the registers for SPI(2), I can&amp;#39;t see any problems. And after reflash, it works perfect. The application is only chrashing if started from bootloader.&lt;/p&gt;
&lt;p&gt;The hardfault handler is not hit, nor the app error handler, or reset vector.&lt;/p&gt;
&lt;p&gt;Is this something you have seen before?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73390?ContentTypeID=1</link><pubDate>Thu, 19 Jan 2017 03:52:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:263a84ac-9361-4791-9206-dc0e538d1a6f</guid><dc:creator>WestCoastDaz</dc:creator><description>&lt;p&gt;Jan,&lt;/p&gt;
&lt;p&gt;I also experienced the ELF/DWARF Error and at the time I couldn&amp;#39;t determine the cause.  I now think it maybe due to the uECC library not having debug symbols but that is a theory.&lt;/p&gt;
&lt;p&gt;Try this for the Hardfault handler:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    /** Redefine the hard fault processing handler */
void HardFault_process(HardFault_stack_t *p_stack)
{
    /* These are volatile to try and prevent the compiler/linker optimizing them
    away as the variables never actually get used.  If the debugger won&amp;#39;t show the
    values of the variables, make them global my moving their declaration outside
    of this function. */
    volatile uint32_t r0;
    volatile uint32_t r1;
    volatile uint32_t r2;
    volatile uint32_t r3;
    volatile uint32_t r12;
    volatile uint32_t lr; /* Link register. */
    volatile uint32_t pc; /* Program counter. */
    volatile uint32_t psr;/* Program status register. */

    char str[20];

    r0 = p_stack-&amp;gt;r0;
    r1 = p_stack-&amp;gt;r1;
    r2 = p_stack-&amp;gt;r2;
    r3 = p_stack-&amp;gt;r3;

    r12 = p_stack-&amp;gt;r12;
    lr  = p_stack-&amp;gt;lr;
    pc  = p_stack-&amp;gt;pc;
    psr = p_stack-&amp;gt;psr;

    sprintf(str, &amp;quot;r0:%x\n&amp;quot;, r0);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;r1:%x\n&amp;quot;, r1);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;r2:%x\n&amp;quot;, r2);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;r3:%x\n&amp;quot;, r3);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;r12:%x\n&amp;quot;, r12);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;lr:%x\n&amp;quot;, lr);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;pc:%x\n&amp;quot;, pc);
    SEGGER_RTT_WriteString(0, str);

    sprintf(str, &amp;quot;psr:%x\n&amp;quot;, psr);
    SEGGER_RTT_WriteString(0, str);

    //wait to allow the RTT transfer to complete
    nrf_delay_ms(2000);

    // Restart the system by default
    NVIC_SystemReset();
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73386?ContentTypeID=1</link><pubDate>Wed, 18 Jan 2017 09:56:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:171cb506-715d-4006-93d3-919f473df8ca</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;It sounds like the device is Hardfaulting. Are you able to identify the last function that is called by the application before the reset occurs through the RTT log?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73393?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2017 15:20:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28c5bef8-43f7-4caf-bec2-3a259ec72ec7</guid><dc:creator>janR</dc:creator><description>&lt;p&gt;Buttonless_dfu service is initialized after peer_manager&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73389?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2017 15:18:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db6e440e-faf8-46f6-9db8-e3dd25bdc2b9</guid><dc:creator>janR</dc:creator><description>&lt;p&gt;Hi Darren,&lt;/p&gt;
&lt;p&gt;Watchdog is off, as far as I can see, both in bootloader and application.&lt;/p&gt;
&lt;p&gt;I have problems checking if hardfault interrupt is triggering.
When I try to debug from bootloader, I get error ELF/DWARF Error: Unsupported .debug_info format version: 4.
If I debug from application code, application does not reset after flashing, as I described above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73384?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2017 15:13:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d2bc80c-eaf9-458a-a71b-9a34e48c526c</guid><dc:creator>janR</dc:creator><description>&lt;p&gt;Hi Bjørn,
I am using IAR Embedded Workbench IDE (7.80.3), and IAR ARM C/C++ compiler. I compile and link from the IDE using the .eww/.ewp files that comes with SDK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73385?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2017 13:02:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c68ee730-8f1a-41a1-9984-5b90bcf55005</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Jan,  are you using armgcc and the makefile that comes with the SDK?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73392?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 18:02:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bac94480-1ff7-4cbf-b076-0bdc1c689220</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Did you initialize buttonless_dfu service before or after peer_manager.  if buttonless_dfu is initialized before peer_manager, it is likely be the cause of the crash.  In fact anything that uses fds will have the same problem.  It is due to the fact that fds initialization is async. In order to wait for the completion event, one has to do the event wait loop an this is done after everything is initialized.  So it causes a problem when another fds initializes while the previous one has not finished. Both peer_manager &amp;amp; dfu use fds, hence cause of problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure DFU bootloader problem nRF52832</title><link>https://devzone.nordicsemi.com/thread/73387?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 16:13:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1c4d3c4-83ce-449b-88ca-b6a192d1b12b</guid><dc:creator>WestCoastDaz</dc:creator><description>&lt;p&gt;Jan,&lt;/p&gt;
&lt;p&gt;Have you turned on the watchdog timer in the bootloader or have you checked if you application is hitting the hard fault interrupt?&lt;/p&gt;
&lt;p&gt;Cheers,
Darren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>