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

Based on sdk16.0.0, add buttonless dfu to the ble_uart project(need bonding)

    My goal is to implement dynamic pairing and connection to a Bluetooth device based on SDK16.0.0 and s132_7.0.1, and add a buttonless DFU function.
By sending instructions through the phone, the device can return to the bootloader state to update the app.I have added the buttonless dfu service
to the project.
Code path:
    github.com/.../BLE-Nordic
    Project path: \project
STEP:
    1. IDE: uVision V5.23.0.0, nRF_DeviceFamilyPack 8.29.0, CMSIS 5.0.1
    2. Based on the ble_app_uart project, some files of the ble_app_gls project and the ble_app_buttonless_dfu project are merged to implement dynamic pairing binding and Secure DFU                Service.
   3. Modify the project directory to the project folder under the root directory, and put the relevant application layer files into the app folder under the root directory.
   4. Modify the configuration under sdk_config.h.
   5.After compilation, merge the files in "\\project\_build\nrf52832_xxaa.hex" and "\examples\dfu\secure_bootloader\pca10040_s132_ble\arm5_no_packs\nrf52832_xxaa_s132.hex
     and the "s132_nrf52_7.0.1.hex" file by the following instructions:
        nrfutil.exe settings generate --family NRF52 --application nrf52832_xxaa.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 bootloader_settings.hex
        mergehex.exe --merge nrf52832_xxaa_s132.hex s132_nrf52_7.0.1.hex --output production_final1.hex
        mergehex.exe --merge production_final1.hex nrf52832_xxaa.hex --output production_final2.hex
        mergehex.exe --merge production_final2.hex bootloader_settings.hex --output production_final.hex
   6.Download to the chip through the following instructions:
        nrfjprog -f NRF52 --eraseall
        nrfjprog -f NRF52 --program "production_final.hex" --verify
        nrfjprog -f NRF52 --reset
PROBLEM:
       1. You can search for 'XXXXXXX ----------' Bluetooth devices through nRF Connect. Enter the pairing code and connect.
       2. Click Secure DFU Service, click 'Indications enabled', and finally click the Send button to write the 01 command and send it.
          After receiving '20 01 01 ', the device actively disconnects and LED1 and LED2 lights are always on.
       3. At this time, use J-LINK RTT Viewer to view the log, and the last one stays at '0> <info> app: Writing peer data to the bootloader ...'.
           But the project provided in the official Demo will be prompted after this:
              0> <info> app: Disconnected 1 links.
              0> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Service changed pending flag, action: Update
              0> <info> app: Device will enter bootloader mode.
              0> <info> app: Power management wants to reset to DFU mode.
              0> <info> app: Power management allowed to reset to DFU mode.
      4. Search for the DfuTart device through nRF Connect. After connecting, LED1 and LED3 are always on, but the service in nRF Connect at this time is the same as that in App.
      5. Click the 'DFU' upgrade button, select the upgrade file, and the device will disconnect after the upgrade starts.

Related