Send DFU files from one nrf52833 controller to another nrf52833 controller via BLE

I would to like to update a nrf52833 controller via DFU from another nrf52833 controller via BLE. nrf52833 eval kit is able to connect with another nrf52833 custom controller via BLE and found the buttonless service for sending the reset command. Once reset command is sent and the custom board got advertising with bootloader. The eval kit is connected with custom bootloader and found the secure dfu service handles by discovering DB. Then sent the notification cccd value to the control point characteristics. Now i need to sent the init packet and bin file to custom board. Please suggest the next steps and procedure with APIs from eval kit to custom board.

Parents
  • Hi Rakkumuthu, 

    My understanding is that you want to implement DFU master code on nRF52833 to update another nRF52833 via BLE. 
    I would suggest to have a look at the DFU protocol documentation here and the BLE specific transport here. You can find how you can send the init packet and the actual image there.

    We have an example of doing DFU Master for SPI and UART you can have a look here. It's not for BLE but I think it can be useful when you develop your own DFU master. 

  • Your understanding right. I am referring above documentation and code for my reference. But, with BLE services i got stuck with the command sent and responses reception. I am using below to enable the notification of custom board DFU service control point notification.

                 uint32_t retcode = 0;
                 uint8_t au8CcdVal[2] = {0};
                 uint16_t payload_len = 2;
                 ble_gattc_write_params_t gattc_params;
                              au8CcdVal[0] = 1;
                    au8CcdVal[1] = 0;
                    gattc_params.handle   = g_sCntrlPntChars.cccd_handle;
            gattc_params.len      = 2;
            gattc_params.p_value  = au8CcdVal;
            gattc_params.offset   = 0;
            gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;

                }
            retcode = sd_ble_gattc_write(p_ctx->conn_handle, &gattc_params);
                    NRF_LOG_INFO("DFU Notif = %d",retcode);
             APP_ERROR_CHECK(retcode);

    I am getting the retcode to 0. For this code, i am getting BLE_GATTC_EVT_WRITE_RSP response in BLE event handler.  After that using the above code to send the select command [06 01] which is returning not error with BLE_GATTC_EVT_WRITE_RSP  event. How do i extract the response from peer device to validate the offset, maxsize and crc as per the documentation. I am getting the p_ble_evt->evt.gattc_evt.params.write_rsp.len value as 0 which means no data. Please tell me the how to extract the response from peer device for dfu commands.

  • Hi Rakkumuthu, 


    For developing such application I strongly suggest to use a nRF Sniffer to debug. With the sniffer you can see what transmitted over the air and can greatly help to debug. You only need an extra nRF52 DK/dongle to use a sniffer. 
    With the sniffer you can also record a standard OTA DFU process from for example Android phone to the device to use a reference to develop your app. 

    Please try record the process with the nRF Sniffer and send to us for further investigation. 

Reply
  • Hi Rakkumuthu, 


    For developing such application I strongly suggest to use a nRF Sniffer to debug. With the sniffer you can see what transmitted over the air and can greatly help to debug. You only need an extra nRF52 DK/dongle to use a sniffer. 
    With the sniffer you can also record a standard OTA DFU process from for example Android phone to the device to use a reference to develop your app. 

    Please try record the process with the nRF Sniffer and send to us for further investigation. 

Children
No Data
Related