Hi guys. I am struggling to get buttonless DFU to work in my owm application. I am using SDK12.2 with gcc on a pca10040 board with S132.
I have successfully followed this tutorial to get the buttonless DFU example working.
However, when I try to implement the same DFU service into my own existing project, the DFU service setup fails at the CRC in nrf_dfu_settings_init(). The code then tries to erase from flash in nrf_dfu_settings_write(...), but fails and returns NRF_ERROR_INTERNAL on line 210.
The following is what I have tried.
- Compile the /examples/dfu/bootloader_secure project using my own private/public key pair (hex file is called dfu_bootloader.hex)
- Comment out lines 44 through 94 in nrf_dfu_settings.c as suggested here
- Erase the chip:
nrfjprog --eraseall -f nrf52
- Flash the bootloader:
nrfjprog --program ../dfu/dfu_bootloader.hex -f nrf52
- Flash the softdevice:
nrfjprog --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex -f nrf52 --sectorerase
nrfjprog --reset -f nrf52
- Add the DFU service setup code to services_init() (as in the experimental_ble_app_buttonless_dfu example). Also add all dependencies and update sdk_config.
- Compile project and create the firmware package:
nrfutil pkg generate --debug-mode --application _build\nrf52832_xxaa.hex --key-file ..\dfu\priv.pem ../dfu/pkg.zip
- Connect to the nRF52 using nRF Connect and transfer the firmware package
- Watch the application boot and crash at the CRC check in nrf_dfu_settings_init().
If I follow the exact same procedure, only flashing the experimental_ble_app_buttonless_dfu example instead, everything seems to work fine. Is there a problem with the bootloader settings in my application, since the CRC fails?
Any help is greatly appreciated.