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

nrf_dfu_transports_init() error in background dfu

Hi,

I am using 

  • PCA10056
  • SDK 15.3.0
  • Keil IDE
  • The soft device is S140 
  • JLinkRTTViewer for debug

I am testing background serial-dfu.(refer to https://devzone.nordicsemi.com/f/nordic-q-a/46336/bootloader-no-transport-dual-bank-dfu-and-dependencies)

I erase 52840 whole and write SoftDevice & bootloader.

I used keil debug to download the app and run.

An error occurred with the attachment.

Please advise

Alex

Parents Reply Children
  • Hi Vidar,

    yes, i still getting the Softdevice assertion.

  • Hi Alex,

    Here is the screenshot I've been referring to:

  • Hi Vidar,

    The device has both central and peripheral functions.

    1. I added "BLE_STACK_SUPPORT_REQD" to the preprocessor in keil.

       Is it correct ?

    2.  Below is the prepocessor in Keil that is currently configured.

        Please check for any missing parts.

       "DEBUG BOOTLOADER_START_ADDR=0xE4000 BLE_STACK_SUPPORT_REQD

       BOARD_PCA10056 CONFIG_GPIO_AS_PINRESET FLOAT_ABI_HARD NRF52840_XXAA

       NRF_SD_BLE_API_VERSION=6 S140 SOFTDEVICE_PRESENT SWI_DISABLE0

       NRF_DFU_SETTINGS_VERSION=1  __HEAP_SIZE=0 __STACK_SIZE=8192"

    3. The following error occurred

        nrf_dfu_flash: nrf_fstorage_write() failed with error 0x4.

       I attached a log file.

    00> <info> app: Initializing fds...
    00> 
    00> <info> app: Reading flash usage statistics...
    00> 
    00> <info> app: Found 1 valid records.
    00> 
    00> <info> app: Found 0 dirty records (ready to be garbage collected).
    00> 
    00> <info> app: Setup Config file found, updating boot count to 91.
    00> 
    00> <info> app: Load Config file found, updating boot count to 92.
    00> 
    00> <info> app: Reset Config file found, updating boot count to 92.
    00> 
    00> <info> app: bootloader_addr_actual = E4000 bootloader_addr_expected = E4000
    00> 
    00> ge.
    00> 
    00> source, write not needed. Skipping.
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Received ping 1
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_PING
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x9, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Set receipt notif target: 0
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> 
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Received serial mtu
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_MTU_GET
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x7, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> mmand)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x6, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to .
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_SELECT (data)
    00> 
    00> <debug> nrf_dfu_req_handler: crc = 0x0, offset = 0x0, max_size = 0x1000
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x6, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CBF8
    00> 
    00> ta)
    00> 
    00> 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CC7C
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00050000, src=0x2000CBFC, len=64 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CD00
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00050040, src=0x2000CC80, len=64 bytes), queue usage: 2
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CD84
    00> 
    00> a)
    00> 
    00> x2000CD04, len=64 bytes), queue usage: 3
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CE08
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000500C0, src=0x2000CD88, len=64 bytes), queue usage: 4
    00> 
    00> <warning> nrf_dfu_flash: nrf_fstorage_write() failed with error 0x4.
    00> 
    00> 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CD84
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000500C0, src=0x2000CE0C, len=64 bytes), queue usage: 4
    00> 
    00> <warning> nrf_dfu_flash: nrf_fstorage_write() failed with error 0x4.
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CE08
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000500C0, src=0x2000CD88, len=64 bytes), queue usage: 4
    00> 
    00> <warning> nrf_dfu_flash: nrf_fstorage_write() failed with error 0x4.
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> a)
    00> 
    00> x2000CE0C, len=64 bytes), queue usage: 4
    00> 
    00> <warning> nrf_dfu_flash: nrf_fstorage_write() failed with error 0x4.
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000CE08
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000500C0, src=0x2000CD88, len=64 bytes), queue usage: 4
    00> 
    00> 0x4.
    00> 
    00> 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash erase success: addr=0x00050000, pending 3
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x00050000, pending 2
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x00050040, pending 1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x00050080, pending 0
    00> 
    00> <info> app: Fast advertising.
    00> 

    4276.sdk_config.h

    4. I added to nrf_dfu_serial_on_packet_received () as below and the background download succeeded.

       What changes should I make to make background download qualitatively without flash pending?

    void nrf_dfu_serial_on_packet_received(nrf_dfu_serial_t * p_transport,
       uint8_t const * p_data,
       uint32_t length)
    {

     ...

    switch (request.request)
    {

    ...

       case NRF_DFU_OP_OBJECT_SELECT:
       {
          nrf_sdh_disable_request();  <===  0302 add
          request.select.object_type = p_payload[0];
       } break;

     }

    }

    Best regards,

    Alex

  • Hi Alex,

    1. It's required. The flag is used by various modules to check if Softdevice support is needed. 

    2. NRF_DFU_SETTINGS_VERSION should be set to '2' if you use SDK 15.3.0 format

    3. 0x4 corresponds to NRF_ERROR_NO_MEM. Try to increase the fstorage queue size as the API documentation suggests.

    4. What happens when you don't disable the Softdevice here? Also, in your case, does it make sense to have background DFU if BLE is going to be disabled anyway? It would be easier to keep all the DFU handling inside the bootloader. 

Related