I am adding dfu capabilities to my app on SDK12.3.
For that, I took the example on sdk12.3/examples/ble_peripheral/experimental_ble_app_buttonless_dfu and copied the relevant parts to my app,
When running ble_dfu_init() on my app, it crashes with the error:
SDH:WARNING:sd_ble_enable: RAM start should be adjusted to 0x20001ff8 SDH:WARNING:RAM size should be adjusted to 0x6008 :INFO:running nrf_dfu_settings_init :INFO:!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!! :INFO:Erasing old settings at: 0x0003fc00 :INFO:Erasing: 0x0003fc00, num: 1 :INFO:Erase failed: 1 :ERROR:Erasing from flash memory failed. APP_ERROR:ERROR:Fatal
Although most likely unrelated, I also included the warning messages, as the values suggested for RAM_START and RAM_SIZE are actually the ones I already have. Is there something I can do to fix this warning?
This is the call stack for ble_dfu_init(): ble_dfu_init() -> nrf_dfu_settings_init() -> nrf_dfu_settings_write() -> rf_dfu_flash_erase() -> fs_erase(), which then returns "FS_ERR_NOT_INITIALIZED"
nrf_dfu_flash_erase() is from the nrf_dfu_buttonless.c, that is part of the "experimental_ble_app_buttonless_dfu" example from sdk12.3.
Looks like the CRC is wrong and the app goes into reset mode, which makes sense because I haven't yet flashed the bootloader config, so there isn't any valid CRC information yet.
Questions:
1. How can I run the app with the buttonless dfu in debug mode, when I still don't know what the crc of the app will be?
2. How can I make it work in release mode when the bootloader settings are actually loaded with the correct information on the device?
3. How can I make sure fs_init() is called, so that in the event of a legitimate CRC check failure, the app is actually deleted?
Best regards,
Ricardo