URAT Data Transmission in DFU mode

nrf52840 17.1.0 s140 SDK :- examples/dfu/secure_bootloader/pca10056_s140_ble_debug

We are using the secure bootloader with BLE debug and have combined BLE and UART for the DFU bootloader. However, while performing DFU over-the-air (FOTA) from a mobile device, I am trying to send data to print BLE packets using UART. I am able to send only one packet; after that, the transmission stops, and I cannot send additional data. For reference, see the log below.

We call the function from nrf_dfu_ble.c:
static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt)
{
// Existing code

nrf_drv_uart_tx(&m_uart, data, length);

// Existing code
}

Note: We need to achieve this using only in this SDK version pca10056_s140_ble_debug.

<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: Using settings page.
<debug> nrf_dfu_settings: Copying forbidden parts from backup page.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<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.
<debug> app: Enter nrf_bootloader_fw_activate
<info> app: No firmware to activate.
<info> app: Boot validation failed. 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 (0x20005998)
<debug> app: timer_activate (0x20005998)
<info> app: Entering DFU mode.
<debug> app: Initializing transports (found: 2)
<debug> nrf_dfu_ble: Initializing BLE DFU transport
<debug> nrf_dfu_ble: Setting up vector table: 0x000E8000
<debug> nrf_dfu_ble: Enabling SoftDevice.
<debug> nrf_dfu_ble: Configuring BLE stack.
<debug> nrf_dfu_ble: Enabling the BLE stack.
<debug> nrf_dfu_ble: No advertising name found
<debug> nrf_dfu_ble: Using default advertising name
<debug> nrf_dfu_ble: Advertising...
<debug> nrf_dfu_ble: BLE DFU transport initialized.
<debug> nrf_dfu_serial_uart: serial_dfu_transport_init()
<debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed
<info> nrf_dfu_serial_uart: Sending initial byte 0x24
<debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
<debug> app: Enter main loop
<debug> nrf_dfu_ble: Connected
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST.
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE (27, max_rx_time 328).
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
<debug> nrf_dfu_ble: max_conn_interval: 12
<debug> nrf_dfu_ble: min_conn_interval: 12
<debug> nrf_dfu_ble: slave_latency: 0
<debug> nrf_dfu_ble: conn_sup_timeout: 600
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
<debug> nrf_dfu_ble: max_conn_interval: 6
<debug> nrf_dfu_ble: min_conn_interval: 6
<debug> nrf_dfu_ble: slave_latency: 0
<debug> nrf_dfu_ble: conn_sup_timeout: 500
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
<debug> nrf_dfu_ble: max_conn_interval: 12
<debug> nrf_dfu_ble: min_conn_interval: 12
<debug> nrf_dfu_ble: slave_latency: 0
<debug> nrf_dfu_ble: conn_sup_timeout: 600
<debug> nrf_dfu_ble: Received BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST (request: 517, reply: 247).
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST.
<debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE (251, max_rx_time 2120).
<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_ble: Set receipt notif
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> app: Shutting down transports (found: 2)
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (command)
<debug> app: timer_stop (0x20005998)
<debug> app: timer_activate (0x20005998)
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> nrf_dfu_ble: Buffer 0x20006ED8 acquired, len 141 (244)
<debug> nrf_dfu_ble: Copying 141 bytes from p_write_evt->data to p_balloc_buf:
12 8A 01 0A 44 08 01 12|....D...
40 08 01 10 34 1A 02 80|@...4...
02 20 00 28 00 30 00 38|. .(.0.8
E0 F0 03 42 24 08 03 12|...B$...
20 60 23 74 3A 38 1B 65| `#t:8.e
2E 68 F0 F3 05 97 26 76|.h....&v
D3 61 C0 4C 00 F4 D7 E6|.a.L....
B2 44 DE EC 6C 90 75 1E|.D..l.u.
D7 48 00 52 04 08 01 12|.H.R....
00 10 00 1A 40 CA 06 15|....@...
<debug> nrf_dfu_ble: Sending 141 bytes via UART:
12 8A 01 0A 44 08 01 12|....D...
40 08 01 10 34 1A 02 80|@...4...
02 20 00 28 00 30 00 38|. .(.0.8
E0 F0 03 42 24 08 03 12|...B$...
20 60 23 74 3A 38 1B 65| `#t:8.e
2E 68 F0 F3 05 97 26 76|.h....&v
D3 61 C0 4C 00 F4 D7 E6|.a.L....
B2 44 DE EC 6C 90 75 1E|.D..l.u.
D7 48 00 52 04 08 01 12|.H.R....
00 10 00 1A 40 CA 06 15|....@...
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
<debug> nrf_dfu_ble: Freeing buffer 0x20006ED8
<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_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 hash (len: 64)
<info> nrf_dfu_validation: Verify signature
<info> nrf_dfu_validation: Image verified
<info> nrf_dfu_validation: Total size= 0

<debug> app: Enter nrf_dfu_cache_prepare()
<debug> app: required_size: 0xF860.
<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> nrf_dfu_validation: Write address set to 0x00027000
<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: nrf_fstorage_write(addr=0x000FF000, src=0x200084EC, len=896 bytes), queue usage: 1
<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: 2
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000816C, len=896 bytes), queue usage: 3
<debug> nrf_dfu_req_handler: Writing valid init command to flash.
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<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> app: timer_stop (0x20005998)
<debug> app: timer_fire (0x20005998)
<info> app: Inactivity timeout.
<debug> app: Resetting bootloader.
<info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
<error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2003FF20

Parents
  • Not sure what is the reason in your case for the inactivity in the DFU operation but the bootloader implements an inactivity timeout that applies in various cases. This is controlled by adjusting the NRF_BL_DFU_INACTIVITY_TIMEOUT_MS parameter in the bootloader's sdk_config.h. The default value in Nordic's examples is 120000 ms, which is equivalent to 2 minutes. This means that if there is no activity for the specified duration, the bootloader will reset.
    In the DFU (Device Firmware Update) mode, the bootloader activates the DFU transports and the device is ready to receive new firmware. When the DFU mode is entered, the inactivity timer is started. On timer expiration, the bootloader resets. The inactivity timer is restarted on any DFU activity.
    You can restart the inactivity timer by calling the function nrf_bootloader_dfu_inactivity_timer_restart. This function takes two parameters: timeout_ticks which is the number of ticks until reset, and callback which is the function to be called on timeout.
    If you want to change the inactivity timeout, you can adjust the NRF_BL_DFU_INACTIVITY_TIMEOUT_MS parameter in the sdk_config.h file.
Reply
  • Not sure what is the reason in your case for the inactivity in the DFU operation but the bootloader implements an inactivity timeout that applies in various cases. This is controlled by adjusting the NRF_BL_DFU_INACTIVITY_TIMEOUT_MS parameter in the bootloader's sdk_config.h. The default value in Nordic's examples is 120000 ms, which is equivalent to 2 minutes. This means that if there is no activity for the specified duration, the bootloader will reset.
    In the DFU (Device Firmware Update) mode, the bootloader activates the DFU transports and the device is ready to receive new firmware. When the DFU mode is entered, the inactivity timer is started. On timer expiration, the bootloader resets. The inactivity timer is restarted on any DFU activity.
    You can restart the inactivity timer by calling the function nrf_bootloader_dfu_inactivity_timer_restart. This function takes two parameters: timeout_ticks which is the number of ticks until reset, and callback which is the function to be called on timeout.
    If you want to change the inactivity timeout, you can adjust the NRF_BL_DFU_INACTIVITY_TIMEOUT_MS parameter in the sdk_config.h file.
Children
No Data
Related