This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Reboot to bootloader without ble_dfu service

So I see ble_app_hrs and others have some nice examples of buttonless reboot into DFU bootloader. But for security reasons, I'd rather the user hold down the reset button (only button on our board, tied to GPIO) for some seconds to go into bootloader mode.

So I have to code to detect that the button has been long pressed, is there a "reboot into bootloader" example that doesn't use the ble_dfu service?

  • I believe you can do this , once you have to go through Cortext M0 specs, so this activity is not concern with Nordic's sdk, but related to MCU arc. Make sure you reset the CPU. that would set the cpu to start from bootloader i think.

  • Check for the Modes of the MCU as this mcu is Cortex M0 so there you can have some setting regarding boot config. Set those relevant registers config which will help you to reset from firmware, and then your bootloader will gets executed then. Hope that will help you.

  • @Aaron: You can have a look at Question #C at this FAQ. About starting bootloader with a button, what we do by default is to let end user hold a button when starting the device to enter bootloader.

    In your case you may want to enter bootloader without having end user reseting the device. You can use one of the 2 approach I suggested in the FAQ. You just need to execute the function thatjump to bootloader: bootloader_start() in dfu_app_handler.c, in your button press handler.

  • I would like to call bootloader_start(), but it's static.. Can it be made public in a later revision? As it is, it seems I would need to call dfu_app_on_dfu_evt with BLE_DFU_START event, which requires including ble_dfu.h. It would be nice if dfu_app_handler could be used without ble_dfu service.

    As it is, for my app I think the simplified approach (GPREGRET and softreset) should work, sharing the connection would be nice but we shouldn't be updating the firmware that often..

  • @Aaron: You can follow what we do in the bootloader_start() function for you application.

    If you don't plan to share bond information, I would suggest you to simply set a flag in GPREGRET (to tell bootloader to enter bootloader mode, not application mode) and then call NVIC_SystemReset() to do a soft reset. Note that when you do a softreset, you need to reinitialize the softdevice.

Related