Hello,
I'd like to enter bootloader DFU mode from my application code.
I don't want to rely on hardware, which rules out the reset pin (NRF_BL_DFU_ENTER_METHOD_PINRESET) and checking for a low GPIO level (NRF_BL_DFU_ENTER_METHOD_BUTTON) when the bootloader runs (presumably after a power reset).
So this leaves me with (as far as I can tell) two options: NRF_BL_DFU_ENTER_METHOD_GPREGRET and NRF_BL_DFU_ENTER_METHOD_BUTTONLESS.
The former seems straightforward: My app writes a magic value the non-volatile GPREGRET register and then issues a reset:
void enter_dfu(){
uint32_t old;
sd_power_gpregret_get(0, &old);
sd_power_gpregret_set(0, old | BOOTLOADER_DFU_START);
NVIC_SystemReset();
}
For NRF_BL_DFU_ENTER_METHOD_BUTTONLESS, the docs (infocenter.nordicsemi.com/.../lib_bootloader.html) suggest that my app needs to write to the "settings page".
However, I can't quite figure out where this happens in the ble_app_buttonless_dfu example.
Furthermore, I can't understand the high-level reason why one would choose one of these two methods over the other.
What are the tradeoffs between these two approaches?