DFU Process

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

We are using nrf52840 17.1.0 s140 DK secure bootloader with BLE debug. We initialized the UART function. However, while performing DFU FOTA from a mobile device, I tried to print the received BLE packet using UART, but encountered the following error in the log:

If the nrf_drv_uart_tx send function is removed, the DFU process completes successfully without any issues. We are calling this function in the nrf_dfu_ble.c file within the static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt); function.


<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)
<info> nrf_dfu_serial_uart: Sending data
<error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2003FCE0

Parents
  • Hi,

    I tried to print the received BLE packet using UART, but encountered the following error in the log:

    It sounds like you want to use UART for logging, but you could use RTT for the same purpose. 

    The log shows that you have included both the BLE and UART transport in your bootloader, so another soluction is not to add the uart serial dfu transport. 

    Regards,
    Amanda H.

  • Hi Amanda,

    We need to use UART to transfer the received data to another controller. We do not want to store the data in flash; instead, we want to transfer the data directly to the controller through UART.

  • Hi Amanda,


    We are not using UART for logging; instead, we are sending binary data over UART, which is received during the DFU process.

    we are facing some error during transmitting the data :

    static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt)

    {

    nrf_drv_uart_tx(&m_uart, data, length);



    error:

    <error> nrf_dfu_serial_uart: UART buffer is busy after 3 retries
    <error> nrf_dfu_ble: Failed to send data via UART: 0x11

  • We are currently understaffed due to the summer vacation period, so delayed replies must be expected. I am sorry about any inconvenience this might cause.

    nrf52840 17.1.0 s140 SDK :- examples/dfu/secure_bootloader/pca10056_s140_ble_debug
    RAJVARDHAN said:
    We are not using UART for logging; instead, we are sending binary data over UART, which is received during the DFU process.

    I think you could use nRF5_SDK_17.1.0_ddde560\examples\dfu\secure_bootloader\pca10056_uart. See Secure DFU Bootloader over Serial Link (UART/USB) 

  • 1. Hi thanks for your reply let me explain in simple way in booloader_ble_debug sdk after while performing dfu the new firmware is going to write in the flash instead of writing the data in flash the same should be sent in the uart 

    2. flash -> replace with UART transfer 

    3. So whenever it is required we will write in flash or we will send same data in UART only one at a time 

    4. we need to achieve this in booloader_ble_debug app

    New_firmware_write_func

    if(cond)

    {

    uart_tx(data)

    }

    else

    {

     rc = nrf_fstorage_write(&m_fs, dest, p_src, len, (void *)callback);

    }

    5. We enabled UART transport in nrf_dfu_serial_uart.c for the nRF52840 using SDK version 17.1.0, S140. The relevant code is in examples/dfu/secure_bootloader/pca10056_s140_ble_debug:

    DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const uart_dfu_transport) =
    {
       .init_func  = uart_dfu_transport_init,
       .close_func = uart_dfu_transport_close,
    };

Reply
  • 1. Hi thanks for your reply let me explain in simple way in booloader_ble_debug sdk after while performing dfu the new firmware is going to write in the flash instead of writing the data in flash the same should be sent in the uart 

    2. flash -> replace with UART transfer 

    3. So whenever it is required we will write in flash or we will send same data in UART only one at a time 

    4. we need to achieve this in booloader_ble_debug app

    New_firmware_write_func

    if(cond)

    {

    uart_tx(data)

    }

    else

    {

     rc = nrf_fstorage_write(&m_fs, dest, p_src, len, (void *)callback);

    }

    5. We enabled UART transport in nrf_dfu_serial_uart.c for the nRF52840 using SDK version 17.1.0, S140. The relevant code is in examples/dfu/secure_bootloader/pca10056_s140_ble_debug:

    DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const uart_dfu_transport) =
    {
       .init_func  = uart_dfu_transport_init,
       .close_func = uart_dfu_transport_close,
    };

Children
No Data
Related