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

Document regarding DFUMaster_UART to do a serial firmware upgrade.

To do a serial DFU I have followed the steps provided in the DFUMaster_UART link.

1) Generated the key using the NrfUtil.

2) Added the private.key and generated a DFU package using the NrfUtil tool.

3) Added the public.key to the secure_bootloader_uart example and build it.

4) Flashed the Softdevice and the above-builded bootloader to one nrf52840 DK.

5) Extracted the DFU package generated in step 2, got three files:

    - app_xyz .bat

    - app_xyz .bin

    - manifest.json

6) Tried building in the DFUMaster_UART with the SDK v15.2 as it was giving some errors, tried building it with the SDKv14.2 it was successful.

7) Flashed DFUMaster_UART in one nrf52832 DK as the example available was for the PCA10040.

8) Flashed the extracted app_xyz.bat to 0x9000 location as in the DFUMaster code it was reading this location for the init packet.

9) Flashed the extracted app_xyz.bin to 0x30000 location as in the DFUMaster code it was reading this location for the image to be sent to DFU_Target(nrf52840).

10) Now Bootloader code was successfully able to parse the init package and validated it. But, as the DFUMaster Starts sending the FW Image the bootloader code resets after receiving the two packets and writing in to flash.

Debugged that by putting the breakpoint, got to know that as the bootloader tries to write the third packet in the flash it stuck in the wait_for_flash_ready().

Please correct me if any of the above steps are incorrect, so that I can successfully complete the DFU.

Parents
  • I have attached the LOG files as below:

    1) DFUMaster LOG.

    2) DFU Target LOGS :

         a) pca10056_uart_LOG: This project is from (nRF5_SDK_15.2.0_9412b96\examples\dfu\secure_bootloader\pca10056_uart\ses) location.

         b) pca10056_uart_debug_LOG: This project is from (nRF5_SDK_15.2.0_9412b96\examples\dfu\secure_bootloader

                                                                     \pca10056_uart_debug) location.

    SENDING PING PACKATE of LENGTH = 3
    <info> app: Init data size: 141
    <info> app: Data : 12 8A 62
    <info> app: Data : 79 536936376 62
    <info> app: Data : 17 536936376 62
    <info> app: Data : 0 536936376 62
    <info> app: Image size: 25012
    <info> app: Data : 4034 536936376 62
    <info> app: Data : 3972 536936376 62

    Inside main
    ACTIVATION NONE = 1
    Initializing transports (found: 1)
    Enter main loop
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Size of Binary = 25012
    Address where to flash binary = 200014fc
    m_firmware_start_addr = 00026000
    Writing settings...
    Flash erase success
    Dr
     nrf_fstorage_write called with dst = 1040384 psrc = 536877144 len = 348------
    Flash write success
    nrf_fstorage_write() failed with error 0
    Writing valid init command to flash.
    Flash erase success
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155648 
     nrf_fstorage_write called with dst = 155648 psrc = 536876444 len = 62------
    Flash write success
    nrf_fstorage_write() failed with error 0
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155710 
     nrf_fstorage_write called with dst = 155710 psrc = 536876312 len = 62------

    Inside main
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    -----nrf_fstorage_write called------
    Flash write success
    ACTIVATION NONE = 1
    Initializing transports (found: 1)
    Enter main loop
    <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.
    <warning> nrf_dfu_settings: Resetting bootloader settings since neither the settings page nor the backup are valid (CRC error).
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: No valid app to boot.
    <debug> app: DFU mode because app is not valid.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <info> app: Entering DFU mode.
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init()
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Shutting down transports (found: 1)
    <debug> nrf_dfu_serial: Received ping 1
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_PING
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x9, 0x1]
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (command)
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x1, 0x1]
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (command)
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x3, 0x1]
    Size of Binary = 25012
    Address where to flash binary = 20003774
    m_firmware_start_addr = 00026000
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    -----nrf_fstorage_write called------
    Flash write success
    Writing settings...
    Flash erase success
    In settings_write dst = 000fe000
    -----nrf_fstorage_write called------
    Flash write success
    Writing valid init command to flash.
    Flash erase success
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
    <debug> nrf_dfu_validation: PB: Init packet data len: 64
    <info> nrf_dfu_validation: Signature required. Checking signature.
    <info> nrf_dfu_validation: Calculating init packet hash (init packet len: 64)
    <info> nrf_dfu_validation: Verify signature
    <info> nrf_dfu_validation: Image verified
    <debug> app: Enter nrf_dfu_cache_prepare()
    <debug> app: required_size: 0x61B4.
    <debug> app: single_bank: false.
    <debug> app: keep_app: false.
    <debug> app: keep_softdevice: true.
    <debug> app: SD_PRESENT: true.
    <debug> app: Bank contents:
    <debug> app: Bank 0 code: 0x00: Size: 0x0
    <debug> app: Bank 1 code: 0x00: Size: 0x0
    <debug> app: pass: 0.
    <debug> app: cache_address: 0x26000.
    <debug> app: cache_too_small: false.
    <debug> app: keep_firmware: false.
    <debug> app: delete_more: false.
    <debug> nrf_dfu_validation: Write address set to 0x00026000
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (data)
    <debug> nrf_dfu_req_handler: Creating object with size: 4096. Offset: 0x00000000, CRC: 0x00000000
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x1, 0x1]
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155648 s_dfu_settings.write_offset = 0
    
    -----nrf_fstorage_write called------
    ----> 142 - E:\projects\ADI_MUSKA\nRF5_SDK_15.2.0_9412b96\components\libraries\fstorage\nrf_fstorage.c
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    <error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2003FF50

Reply
  • I have attached the LOG files as below:

    1) DFUMaster LOG.

    2) DFU Target LOGS :

         a) pca10056_uart_LOG: This project is from (nRF5_SDK_15.2.0_9412b96\examples\dfu\secure_bootloader\pca10056_uart\ses) location.

         b) pca10056_uart_debug_LOG: This project is from (nRF5_SDK_15.2.0_9412b96\examples\dfu\secure_bootloader

                                                                     \pca10056_uart_debug) location.

    SENDING PING PACKATE of LENGTH = 3
    <info> app: Init data size: 141
    <info> app: Data : 12 8A 62
    <info> app: Data : 79 536936376 62
    <info> app: Data : 17 536936376 62
    <info> app: Data : 0 536936376 62
    <info> app: Image size: 25012
    <info> app: Data : 4034 536936376 62
    <info> app: Data : 3972 536936376 62

    Inside main
    ACTIVATION NONE = 1
    Initializing transports (found: 1)
    Enter main loop
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    Size of Binary = 25012
    Address where to flash binary = 200014fc
    m_firmware_start_addr = 00026000
    Writing settings...
    Flash erase success
    Dr
     nrf_fstorage_write called with dst = 1040384 psrc = 536877144 len = 348------
    Flash write success
    nrf_fstorage_write() failed with error 0
    Writing valid init command to flash.
    Flash erase success
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155648 
     nrf_fstorage_write called with dst = 155648 psrc = 536876444 len = 62------
    Flash write success
    nrf_fstorage_write() failed with error 0
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155710 
     nrf_fstorage_write called with dst = 155710 psrc = 536876312 len = 62------

    Inside main
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    -----nrf_fstorage_write called------
    Flash write success
    ACTIVATION NONE = 1
    Initializing transports (found: 1)
    Enter main loop
    <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.
    <warning> nrf_dfu_settings: Resetting bootloader settings since neither the settings page nor the backup are valid (CRC error).
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: No valid app to boot.
    <debug> app: DFU mode because app is not valid.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <info> app: Entering DFU mode.
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init()
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Shutting down transports (found: 1)
    <debug> nrf_dfu_serial: Received ping 1
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_PING
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x9, 0x1]
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (command)
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x1, 0x1]
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (command)
    nrf_dfu_validation_init_cmd_append ---->ret_val = 1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (command)
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x3, 0x1]
    Size of Binary = 25012
    Address where to flash binary = 20003774
    m_firmware_start_addr = 00026000
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    -----nrf_fstorage_write called------
    Flash write success
    Writing settings...
    Flash erase success
    In settings_write dst = 000fe000
    -----nrf_fstorage_write called------
    Flash write success
    Writing valid init command to flash.
    Flash erase success
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
    <debug> nrf_dfu_validation: PB: Init packet data len: 64
    <info> nrf_dfu_validation: Signature required. Checking signature.
    <info> nrf_dfu_validation: Calculating init packet hash (init packet len: 64)
    <info> nrf_dfu_validation: Verify signature
    <info> nrf_dfu_validation: Image verified
    <debug> app: Enter nrf_dfu_cache_prepare()
    <debug> app: required_size: 0x61B4.
    <debug> app: single_bank: false.
    <debug> app: keep_app: false.
    <debug> app: keep_softdevice: true.
    <debug> app: SD_PRESENT: true.
    <debug> app: Bank contents:
    <debug> app: Bank 0 code: 0x00: Size: 0x0
    <debug> app: Bank 1 code: 0x00: Size: 0x0
    <debug> app: pass: 0.
    <debug> app: cache_address: 0x26000.
    <debug> app: cache_too_small: false.
    <debug> app: keep_firmware: false.
    <debug> app: delete_more: false.
    <debug> nrf_dfu_validation: Write address set to 0x00026000
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (data)
    <debug> nrf_dfu_req_handler: Creating object with size: 4096. Offset: 0x00000000, CRC: 0x00000000
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x1, 0x1]
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 155648 s_dfu_settings.write_offset = 0
    
    -----nrf_fstorage_write called------
    ----> 142 - E:\projects\ADI_MUSKA\nRF5_SDK_15.2.0_9412b96\components\libraries\fstorage\nrf_fstorage.c
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    <error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2003FF50

Children
No Data
Related