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
  • Hello,

    I just want to confirm something. The bootloader is the same in both cases, when it works and not? Is the bootloader always from SDK15.2.0\examples\dfu\secure_bootloader\pca10056_uart[_debug]?

    It looks like it is the (_WEAK) assert_nrf_callback() from nrf_assert.c that has triggered, as that is the only function in the bootloader that calls app_error_fault_handler()¨.

    Can you please try to set a breakpoint in this function, and see what line_num and file_name the assertion was triggered from? That would be a breakpoint on line 51 in nrf_assert.c, and add assert_info to watch to monitor the two variables. 

    Best regards,

    Edvin

  • Hi Edvin,

    Thanks for the reply.

    In both the case it is not working in both the cases:

    Currently, let us look into the pca10056_uart_debug secure bootloader example.

    It is failing with the below param checking in nrf_fstorage_write:

    /* Length must be a multiple of the program unit. */
    NRF_FSTORAGE_PARAM_CHECK(!(len % p_fs->p_flash_info->program_unit), NRF_ERROR_INVALID_LENGTH);

    So I changed the Length Param in DFUMaster Code as the DFUMaster was not sending the length in multiple of programming unit. Now that issue is resolved.

    But the new issue is that the DFUMaster is not waiting for the response after sending each packet and the bootloader fails to receive all the packets leading to the DFU Failure.
    So I put the DFUMaster in debug mode and sent the packet one by one with the breakpoint. Now the DFU is Completed successfully. I have attached the logs of successful completion.

    But can you provide me a proper DFUMaster_UART Code, so that I can use it without modifications and complete the DFU successfully?

     WRITE_ADDR = 178228 s_dfu_settings.write_offset = 22580
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B834, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178288 s_dfu_settings.write_offset = 22640
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B870, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178348 s_dfu_settings.write_offset = 22700
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B8AC, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178408 s_dfu_settings.write_offset = 22760
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B8E8, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178468 s_dfu_settings.write_offset = 22820
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B924, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178528 s_dfu_settings.write_offset = 22880
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B960, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178588 s_dfu_settings.write_offset = 22940
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B99C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178648 s_dfu_settings.write_offset = 23000
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2B9D8, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178708 s_dfu_settings.write_offset = 23060
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BA14, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178768 s_dfu_settings.write_offset = 23120
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BA50, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178828 s_dfu_settings.write_offset = 23180
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BA8C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178888 s_dfu_settings.write_offset = 23240
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BAC8, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 178948 s_dfu_settings.write_offset = 23300
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BB04, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179008 s_dfu_settings.write_offset = 23360
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BB40, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179068 s_dfu_settings.write_offset = 23420
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BB7C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179128 s_dfu_settings.write_offset = 23480
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BBB8, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179188 s_dfu_settings.write_offset = 23540
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BBF4, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179248 s_dfu_settings.write_offset = 23600
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BC30, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179308 s_dfu_settings.write_offset = 23660
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BC6C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179368 s_dfu_settings.write_offset = 23720
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BCA8, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179428 s_dfu_settings.write_offset = 23780
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BCE4, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179488 s_dfu_settings.write_offset = 23840
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BD20, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179548 s_dfu_settings.write_offset = 23900
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BD5C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179608 s_dfu_settings.write_offset = 23960
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BD98, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179668 s_dfu_settings.write_offset = 24020
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BDD4, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179728 s_dfu_settings.write_offset = 24080
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BE10, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179788 s_dfu_settings.write_offset = 24140
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BE4C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179848 s_dfu_settings.write_offset = 24200
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BE88, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179908 s_dfu_settings.write_offset = 24260
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BEC4, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 179968 s_dfu_settings.write_offset = 24320
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BF00, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180028 s_dfu_settings.write_offset = 24380
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BF3C, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180088 s_dfu_settings.write_offset = 24440
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BF78, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180148 s_dfu_settings.write_offset = 24500
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BFB4, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180208 s_dfu_settings.write_offset = 24560
    
    Flash write 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_WRITE (data)
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2BFF0, src=0x20003790, len=16 bytes), queue usage: 1
    <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:24576, CRC:0x0254690F
    <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 20003810
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data)
    <debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    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_CREATE (data)
    <debug> nrf_dfu_req_handler: Creating object with size: 436. Offset: 0x00006000, CRC: 0x0254690F
    <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 = 180224 s_dfu_settings.write_offset = 24576
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C000, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180284 s_dfu_settings.write_offset = 24636
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C03C, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180344 s_dfu_settings.write_offset = 24696
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C078, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180404 s_dfu_settings.write_offset = 24756
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C0B4, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180464 s_dfu_settings.write_offset = 24816
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C0F0, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180524 s_dfu_settings.write_offset = 24876
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C12C, src=0x20003790, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180584 s_dfu_settings.write_offset = 24936
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C168, src=0x20003814, len=60 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 180644 s_dfu_settings.write_offset = 24996
    
    Flash write 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_WRITE (data)
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x2C1A4, src=0x20003790, len=16 bytes), queue usage: 1
    <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:25012, CRC:0xE15F6689
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x3, 0x1]
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    Flash write success
    Writing settings...
    Flash erase success
    In settings_write dst = 000fe000
    Flash write 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 (data)
    <debug> nrf_dfu_req_handler: Whole firmware image received. Postvalidating.
    <debug> nrf_dfu_validation: Hash verification. Firmware start address: 0x26000, size: 0x61B4
    <debug> nrf_dfu_validation: Invalidating old application in bank 0.
    <debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0xFF000, src=0x20003974, len=348 bytes), queue usage: 1
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0xFE000, src=0x20003AD0, len=348 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
    <debug> app: Shutting down transports (found: 1)
    <debug> app: Resetting bootloader.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    Inside main
    Valid App
    In image copy
    No copy needed src_addr: 0x26000, dst_addr: 0x26000
    Writing settings...
    Flash erase success
    In settings_write dst = 000ff000
    Flash write success
    Writing settings...
    Flash erase success
    In settings_write dst = 000fe000
    Flash write success
    ACTIVATION_SUCCESS
    <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: Settings OK
    <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_flash: nrf_fstorage_write(addr=0xFF000, src=0x20003974, len=348 bytes), queue usage: 1
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0xFE000, src=0x20003AD0, len=348 bytes), queue usage: 1
    <debug> app: Resetting bootloader.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    Inside main
    ACTIVATION NONE = 0
    

  • I am sorry, I wasn't clear. 

     

    Edvin said:
    I just want to confirm something. The bootloader is the same in both cases, when it works and not? Is the bootloader always from SDK15.2.0\examples\dfu\secure_bootloader\pca10056_uart[_debug]?

     Is the bootloader always from SDK15.2.0? Because you mention SDK14.2.0 as well. 

    Well, if you are not using HWFC (Flow Control) on the UART connection, and you are sending the packets too fast, then you need to send the packets slow enough for the flash writes to have time to finish.

    Best regards,

    Edvin

  • Ya bootloader is from SDK15.2.0 and I have compiled the DFUMaster using SDK14.2.0.

    And I will try with the HWFC enabled.

    Thanks

  • Hi Edvin,

    Thanks!

    It worked with HWFC enabled.

    But I need the DFUMaster which works with the HWFC disabled.

    Also, I have verified that the NrfUtil is working with the HWFC disabled.

    I tried decreasing the baud-rate(9600) and put the delay(1sec) in between the sending of packets, but it didn't worked.

    So can you guide me on the changes needed to be done in the current DFUMaster so that it works with the HWFC disabled or if you have a DFUMaster which works without the HWFC that will be great?

    Also, I can see "Todo: instead of using delay response code checking should be done here." in the uart_event_handler. So is this the point where we have to handle the response from the DFUTarget to make it work with the HWFC disabled?

  • Attaching the logs of Bootloader when it fails after 4096bytes of the chunk.

     WRITE_ADDR = 159512 s_dfu_settings.write_offset = 3864
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x26F18, src=0x20003790, len=92 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 159604 s_dfu_settings.write_offset = 3956
    
    Flash write success
    <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)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x26F74, src=0x20003814, len=92 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    Handle NRF_DFU_OP_OBJECT_WRITE (data)
    
     WRITE_ADDR = 159696 s_dfu_settings.write_offset = 4048
    
    Flash write 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_WRITE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x26FD0, src=0x20003790, len=48 bytes), queue usage: 1
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> app: Shutting down transports (found: 1)
    <info> nrf_dfu_serial_uart: Allocated buffer 20003810
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
    <debug> nrf_dfu_req_handler: Offset:4096, CRC:0x5E4A6474
    <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 20003810
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data)
    <debug> nrf_dfu_serial: Sending Response: [0x4, 0x1]
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <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_CREATE (data)
    <error> app: Received an error: 0x00000001!

    So increased the delay to 5secs after every 4096chunk. so now it is working.

    Can you guide me what are the changes need to make it work properly?

  • Ok. So Please see the section on "Set receipt notification". If you set this it will calculate the CRC after every PWN is reached. Have you tried to wait until you receive this CRC calculation before you send the next chunk?

Reply Children
No Data
Related