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

DFU issue with UART

SDK version: nRF5_SDK_15.0.0_a53641a

Softdevice version: s132_nrf52_6.0.0_softdevice

Hardware: nrf52DK PCA10040

nrfutil version 5.2.0

Hi,

  I am trying to get the DFU via UART to work.  I am using the secure bootloader secure_bootloader\pca10040_uart_debug example in the SDK to create the bootloader.

  I created my own dfu_public_key.c following the instructions using nrfutil and replaced it in the bootloader folder. I also built the application .zip package using the matching private key.

   I see in the RTT log that the DFU process is succesful and that the key is verified and that the application is written to flash succesfully in the RTT log. But after that the DK is stuck in continous reset mode with the bootloader and does load the application. Following is the RTT log capture (relevant section). Any help in this is much appreciated.

As you can see the FLASH was successful (passing the key check CRC etc..),the issue comes after that with the hardware stuck in this bootloader/reset loop.

<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002E640, src=0x20000E98, len=64 bytes), queue usage: 1
<debug> nrf_dfu_flash: Flash write success: addr=0x0002E640, pending 0
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> app: Shutting down transports (found: 1)
<info> nrf_dfu_serial_uart: Allocated buffer 20000E94
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002E680, src=0x20000F1C, len=64 bytes), queue usage: 1
<debug> nrf_dfu_flash: Flash write success: addr=0x0002E680, pending 0
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> app: Shutting down transports (found: 1)
<info> nrf_dfu_serial_uart: Allocated buffer 20000F18
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002E6C0, src=0x20000E98, len=56 bytes), queue usage: 1
<debug> app: Shutting down transports (found: 1)
<info> nrf_dfu_serial_uart: Allocated buffer 20000F18
<debug> nrf_dfu_flash: Flash write success: addr=0x0002E6C0, pending 0
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
<debug> nrf_dfu_req_handler: Offset:34552, CRC:0xC0978E80
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> nrf_dfu_serial: Sending Response: [0x3, 0x1]
<debug> app: Shutting down transports (found: 1)
<info> nrf_dfu_serial_uart: Allocated buffer 20000F18
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data)
<debug> nrf_dfu_req_handler: Postvalidation of firmware image.
<debug> nrf_dfu_validation: Hash verification. Firmware start address: 0x26000, size: 0x86F8
<debug> nrf_dfu_validation: Invalidating old application in bank 0.
<debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
<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: 1
<debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pending 0
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x2000070C, len=348 bytes), queue usage: 1
<debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
<debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
<debug> app: Shutting down transports (found: 1)
<debug> app: Resetting bootloader.
<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> app: Enter nrf_bootloader_fw_activate
<debug> app: Valid App
<debug> app: Enter nrf_dfu_app_continue
<debug> app: No copy needed src_addr: 0x26000, dst_addr: 0x26000
<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, pending 0
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x2000070C, len=348 bytes), queue usage: 1
<debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
<debug> app: Resetting bootloader.
<info> app: Inside main
<debug> app: In nrf_bootloader_init
<debug> nr<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf_bootloa<info> app: Inside main
<debug> app: In nrf<info> app: Inside main
<debug> app: In nrf<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf<info> app: Inside main
<debug> app: In nrf_boo<info> app: Inside main
<debug> app: In nrf_bootloa<info> app: Inside main

  

  • Hi Avi, 

    Did you modify the secure_bootloader\pca10040_uart_debug example? If so, what is that?

    It looks like it reset before the nrf_dfu_settings_init() in the nrf_bootloader_init(). Could you check it execute dfu_enter_button_init() or not? You add a debug info as 

    NRF_LOG_DEBUG("dfu_enter_button_init");

    -Amanda H.

  • Hi Amanda,

      Thank you for responding. I have not made any changes to pca10040_uart_debug example except for disabling HWFC in sdk_config.h. 

       I tried additional debugging as you suggested. I found that everything works after DFU until the app_start. In the app_start the issue occurs at the jump_addr step

    if (current_isr_num == 0)
    {

     jump_to_addr(new_msp, new_lr, reset_handler); // Jump directly to the App's Reset Handler.
    }

      Following is the my last debug log before reset, that I am seeing which I added before the above step.

      <debug> app: jump_to_addr current_isr_num:  0  new_msp: 200012E0 reset_handler: 243D1

      I am not sure why the jump to addr does not work. I have no issues with the app when I run it with just the softdevice.

  • Hi Avi, 

    Why would you disable HWFC?

    Please enable HWFC which might solve the problem. Please see this post

    -Amanda H.

Related