Hi,
I followed the DFU to SDK example post on https://www.u-blox.com/en/docs/UBX-19050198 to add Buttonless DFU to an application (I modified \ble_peripheral\ble_app_hrs). The details of firmware updates and HEX file generation are in section 5. Then All the testing in section 6 is successful when I used nRF52832DK to test uploading new version hrs application though buttonless DFU (using nRFconnect and another DK). The SDK I used is 17.0.2.
Then I repeated everything on my custom nRF52832 board, with the same changes applied to my custom application.
I also updated the secure bootloader under “\examples\dfu\secure_bootloader” for my custom board to generate “secure_bootloader_ble_s132_custom.hex”. The main changes are (1) Replace board.c, board.h (remove all the buttons and unused LEDs related code, since my board has no button and only two LEDs), add custom_board.h. (2) Changed softdevice clock setting macros in sdk_config.h, since I do not use external 32MHz crystal. The bootloader was tested successfully with my customer board. I can see “DfuTarg” as the advertising name. OTA firmware upload is successful with my custom application .zip file (generated with command “nrfutil pkg generate --application custom.hex --application-version-string "2.0.0" --hw-version 52 --sd-req 0x101 --key-file private.key app_v2.zip”)
However, after I generated the combined .hex following steps in section 5, (merge bl_setting.hex, such successfully tested bootloader, softdevice image, and my updated application), downloaded such combined .hex file to my custom board. Recycle power and connect my custom board and application through nRF connect, click DFU button and start OTA uploading, the DFU always gives a message says “dfu failed with error: connect time out” after about 10 seconds waiting.
The downloaded .hex file (bl_set_s132_app.hex) is generated as below
- nrfutil settings generate --family NRF52 --application custom.hex --application-version-string "1.2.3" --bootloader-version 0 --bl-settings-version 2 bl_setting.hex
- mergehex --merge bl_setting.hex secure_bootloader_ble_s132_custom.hex s132_nrf52_7.2.0_softdevice.hex --output bl_set_s132.hex
- mergehex --merge bl_set_s132.hex custom.hex --output bl_set_s132_app.hex
Then I download to custom board though
- nrfjprog -f nrf52 –recover
- nrfjprog --program bl_set_s132_app.hex
The .zip file for uploading though buttonless DFU is generated as below.
nrfutil pkg generate --application custom.hex --application-version-string "2.0.0" --hw-version 52 --sd-req 0x101 --key-file private.key app_v2.zip
Since I did exactly the same changes and everything is working on nRF52832DK, may I know what is the possible cause of such “connect time out” issue on my customer board? For example, does bootloader use a timer and accidently occupied by my customer application? It could explain why modified secure_bootloader can do OTA upload successfully, but DFU button on my application has time out error. If so, how to check that?
I already tried method (add “do while” to sd_ble_gatts_hvx) following the link https://devzone.nordicsemi.com/f/nordic-q-a/38655/buttonless-dfu-sdk-14-2-dfu-failed-with-error
But it still does not working for me.
Appreciate all the helps and suggestions.