This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Firmware app doesn't start after OTA DFU

Hi Team,

I am prototyping a product that includes OTA DFU using nRF52832.
As a first experiment, I am simply downloading the bootloader to my device and sending my firmware app as a .zip package to it with DFU from nRF Connect.
It seems that DFU itself is working successfully, nRF Connect shows "Application has been sent successfully" in the end. However, my firmware app that was sent over is not starting: no LED blinking, no service advertising. Not even after removing power supply and putting it back. (Normally, if I simply download the app to the device with a J-Link cable, it is working correctly.) 
I thought the problem might be that the device automatically enters bootloader mode but I don't see DfuTarget advertising in nRF Connect. The device just does nothing after DFU.

The same process is working well if I am sending the BLE app template example to the device with DFU. I can see Nordic_Template advertising in nRF Connect afterwards. My own firmware app is based on this template, and I have no clue what change may have caused this problem.

Do you have any idea, have you seen anything similar?

Thanks in advance,
Tibor

Parents
  • Hi Tibor, 

    I would suggest to get familiar to how to debug an application after DFU update. 

    You would need to check if the application actually get executed (the PC run into main() in the application ) or it stuck some where in the bootloader. 

    Please try to do a DFU update of a very simple program that blink an LED for example. Make sure that program works fine when you flash just the softdevice and the program. 

    Then you can create DFU package .zip and do DFU update it. Please test if you can debug the application after the DFU update. 

    After that you can test with your custom firmware and check if you can debug it as well and check why it doesn't advertise. 

    It's also possible to debug the bootloader, you just need to compile and flash the debug version of the bootloader (remove any code optimization in the bootloader). 

  • Hi Hung,

    Thank you very much for your reply.

    I have tried the first part of your advice: I have sent over SDK example apps as zip files, and they start up and work correctly after DFU is done. My custom app also works correctly if I simply download it to the device with a programming cable. The strange thing is that it doesn't start up only if it's sent to the device with OTA DFU, while other apps do. I know it's hard to tell anything without knowing the code, but is there any logical reason for this behaviour?

    I have run DFU also with the debug version of the bootloader. I have pasted below the output it prints after DFU is finished. Can you please help me find a starting point in it?

    Thanks a lot,
    Tibor

    <debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
    <debug> app: Shutting down transports (found: 1)
    <debug> nrf_dfu_ble: Shutting down BLE transport.
    <debug> nrf_dfu_ble: Disconnecting.
    <debug> nrf_dfu_ble: BLE transport shut down.
    <debug> app: Resetting bootloader.
    <info> nrf_dfu_settings: Backi<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <debug> app: Valid App
    <debug> app: Enter nrf_dfu_app_continue
    <debug> app: No copy needed
    <debug> app: Setting app as valid
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
    <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pen<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <debug> nrf_dfu_settings_svci: Erasing setting<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0

Reply
  • Hi Hung,

    Thank you very much for your reply.

    I have tried the first part of your advice: I have sent over SDK example apps as zip files, and they start up and work correctly after DFU is done. My custom app also works correctly if I simply download it to the device with a programming cable. The strange thing is that it doesn't start up only if it's sent to the device with OTA DFU, while other apps do. I know it's hard to tell anything without knowing the code, but is there any logical reason for this behaviour?

    I have run DFU also with the debug version of the bootloader. I have pasted below the output it prints after DFU is finished. Can you please help me find a starting point in it?

    Thanks a lot,
    Tibor

    <debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
    <debug> app: Shutting down transports (found: 1)
    <debug> nrf_dfu_ble: Shutting down BLE transport.
    <debug> nrf_dfu_ble: Disconnecting.
    <debug> nrf_dfu_ble: BLE transport shut down.
    <debug> app: Resetting bootloader.
    <info> nrf_dfu_settings: Backi<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <debug> app: Valid App
    <debug> app: Enter nrf_dfu_app_continue
    <debug> app: No copy needed
    <debug> app: Setting app as valid
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
    <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pen<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <debug> nrf_dfu_settings_svci: Erasing setting<info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0

Children
  • Hi Tibor, 
    The log showed a normal DFU update, the last line showed that it jumped to the softdevice (then the softdevice will jump to the application). 
    I would suggest to try debugging in the application. 
    Have you verified that you can DFU update a very simple application that toggle the GPIO ? 
    After that you can edit your BLE application to do the same task (GPIO toggling) at the beginning of your application. You can put a while(1); to block any further feature, only keep blinking LED. Just so that you can verify your application setting is OK and you can run to your application and debug it after DFU. After that you can continue to remove the while(1); , do DFU update and debug your actual BLE application. 

Related