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

Sending Response: [0x4, 0xB] in serial DFU ?

 Hi,

I m using nrf52840 and m doing DFU over serial.

one side is master controller and other end is NRF DFU serial(secure bootloader uart debug code).

After sending init packet. i m getting correct CRC value from NRF by sending value 03.

And then i m sending 04 command.I m getting 0b response in master mcu. 

Here following error on nrf side

<warning> nrf_dfu_ver_validation: SD req not met.
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0xB
<warning> nrf_dfu_serial: DFU request completed with result: 0xB
<debug> nrf_dfu_serial: Sending Response: [0x4, 0xB]
<debug> app: Shutting down transports (found: 1)

i have no idea why its coming response like 0b.

i would appreciate any help

thnaks in advance.

Parents
  • warning> nrf_dfu_ver_validation: SD req not met.

    The softdevice in the chip is different from the softdevice required in the init packet.

    You probably need to update the softdevice before you can DFU the new application.

  • Now i get 01 response from nrf.As i follow this link.

    After i started to sending image file from master mcu.

    i m getting an error from NRF

    nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x00026000, len=1 pages), queue usage: 1

    <error> app: Received an error: 0x00000001!

    Here is my NRF log

    <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
    <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: Enter main loop
    <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)
    <debug> nrf_dfu_serial: Set receipt notif target: 0
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x2, 0x1]
    <debug> app: Shutting down transports (found: 1)
    <debug> nrf_dfu_serial: Received serial mtu
    <info> nrf_dfu_serial_uart: Allocated buffer 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_MTU_GET
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x7, 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_SELECT (command)
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x6, 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]
    <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 (command)
    <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 2000378C
    <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
    <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_WRITE (command)
    <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_CRC_GET (command)
    <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 (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: 0xACF4.
    <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> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
    <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 0
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x20003D14, len=348 bytes), queue usage: 1
    <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 1
    <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x20003E70, len=348 bytes), queue usage: 1
    <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
    <debug> nrf_dfu_req_handler: Writing valid init command to flash.
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x4, 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_SELECT (data)
    <debug> nrf_dfu_req_handler: crc = 0x0, offset = 0x0, max_size = 0x1000
    <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    <debug> nrf_dfu_serial: Sending Response: [0x6, 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_CREATE (data)
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x00026000, len=1 pages), queue usage: 1
    <error> app: Received an error: 0x00000001!
    

  • I m using buttonless over UART.

    still i m not enter into boot mode after giving below command.

    #define BOOTLOADER_DFU_START 0xB1
    
    void boot_mode()
    {
     nrf_delay_ms(100);
                   NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
    
                  nrf_delay_ms(100);
    
                  NVIC_SystemReset(); 
    			  
    			  }

    what i did before merging part

    1) bootloader hex + Bl settings merged output1.hex.

    nrfutil settings generate --family NRF52840 --application ble_app_rscs_c_pca10056_s140.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 --key-file private.key bl_settings.hex

    2) application hex + softdevice  hex merged output2.hex

    3. output1.hex and output2.hex merged together with final output file

    mergehex --merge output1.hex output2.hex  --output final_out.hex

    after flashing the final out hex to my board running in application at first then 

    when changing to bootloader using buttonlesss with above inserted code .its entering but not properly timeout and also when sending  a new firmware through serial not updating with the new firmware.

    application memory 

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x26000

    FLASH_SIZE=0xda000

    RAM_START=0x20001cd0

    RAM_SIZE=0x3e330

    uart bootloader memory 

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0xe4000

    FLASH_SIZE=0x1a000

    RAM_START=0x20000008

    RAM_SIZE=0x3fff8

    here is my memory location

    kindly help me out. i have been hold on here for past 3 days.

  • Looks like you are using the same code as here: https://devzone.nordicsemi.com/f/nordic-q-a/64170/ota-over-serial-merging-with-application. Is the Softdevice enabled when you call boot_mode() in your app?

  • Very first time i flashed secure uart dfu through jlink.

    D:\NRF_SDk_latest\nRF5_SDK_15.2\nRF5_SDK_15.2\examples\dfu\secure_bootloader\pca10056_uart_debug\ses

    In loader i changed to ../../../../../components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex

    After i send only application file from my master to NRF. It worked.

    what did i wrong in that sending application file?

  • Does the bootloader start out in DFU mode the first time you program it with the Jlink? It sounds like maybe the buttonless mechanism is not working as intended. I.e., not putting the device into Bootloader DFU mode.

  • yes, first time it entered into bootloader.

    how do i check whether its enter into bootloader or not?

    i put some log on bootloader code. But that also not printed in the second time while giving command .

Reply Children
Related