Dear Devzone,
I'm using 52832,SDK 17.0,keil.
What apis should I call if I want to enter the bootloader mode from my app? For example, I receive a message from a serial port and then enter the DFU process
Dear Devzone,
I'm using 52832,SDK 17.0,keil.
What apis should I call if I want to enter the bootloader mode from my app? For example, I receive a message from a serial port and then enter the DFU process
Hi,
There are several ways to enter DFU mode in nRF5 SDK, one of which is writing a special value to the GPREGRET register. That is what is used by the Buttonless Secure DFU Service, which triggers DFU mode from a BLE Service. I suggest using the implementation for that as reference, you find it in <sdk folder>\components\ble\ble_services\ble_dfu\ble_dfu.c. There, the reset into DFU mode is handled by the function ble_dfu_buttonless_bootloader_start_finalize(). The functionality is used in the Buttonless DFU Template Application, where it is triggered by commands sent over a BLE service, but the main steps are independent of the trigger:
err_code = sd_power_gpregret_clr(0, 0xffffffff); VERIFY_SUCCESS(err_code); err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START); VERIFY_SUCCESS(err_code); nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
Please note that for new projects, we recommend the newer nRF Connect SDK. For details on when to use which SDK, see our nRF Connect SDK and nRF5 SDK statement.
Regards,
Terje