Enabling/Using nus characteristics in the DFU Service.

Hi,
I'm using nRF52840 in my project.
I successfully integrated the BLE DFU service and its characteristics in my firmware, Now I can update the firmware through the nrf-connect app.
Now the issue is I want to enable/use the nus characteristics(Rx and Tx) in the DFU service.
firstly I want to know is it possible? if yes, can you please suggest any tutorial for this implementation?


I want to perform this implementation because I am developing a customized DFU Android app with the available source code and I don't want to use both the UART and DFU libraries on the Android app side.

Any advice would be appreciated.
Thanks.

Parents
  • Hi Inam,

    You most likely can. I am assuming you are using the nRF5 SDK? I will give some hints below assuming nRF5 SDK v17.1.0.

    I would start by creating a custom replacement of the DFU BLE service files. Modifying the SDK file also works, but I personally recommend against that since it modifies the environment for all projects using the SDK.

    Assuming you only use the TX/RX characteristics in the application you are probably fine with only replacing ble_dfu.c. You probably will need to make sure your Android app is still happy when it doesn't find the characteristics once the device goes into bootloader though.

    If you also need it during bootloader operation, assuming you are based on the secure_bootloader example, you will also need to replace nrf_dfu_ble.c. It feels like there might be some risk regarding processing, since flashing will take most of the CPU time.

    Regarding what to do in the replacement, you can start by looking at where characteristic_add() is called in ble_nus.c. From there you should trace back how the characteristics are built up.

    Hope those serves as a decent starting point for you. Let me know if you need any further help.

    Best regards,

    Hieu

Reply
  • Hi Inam,

    You most likely can. I am assuming you are using the nRF5 SDK? I will give some hints below assuming nRF5 SDK v17.1.0.

    I would start by creating a custom replacement of the DFU BLE service files. Modifying the SDK file also works, but I personally recommend against that since it modifies the environment for all projects using the SDK.

    Assuming you only use the TX/RX characteristics in the application you are probably fine with only replacing ble_dfu.c. You probably will need to make sure your Android app is still happy when it doesn't find the characteristics once the device goes into bootloader though.

    If you also need it during bootloader operation, assuming you are based on the secure_bootloader example, you will also need to replace nrf_dfu_ble.c. It feels like there might be some risk regarding processing, since flashing will take most of the CPU time.

    Regarding what to do in the replacement, you can start by looking at where characteristic_add() is called in ble_nus.c. From there you should trace back how the characteristics are built up.

    Hope those serves as a decent starting point for you. Let me know if you need any further help.

    Best regards,

    Hieu

Children
No Data
Related