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

Can I use a gpio pin to change boot mode?

Hello, I'm beginner for nRF52.

I saw examples about entering DFU by button and buttonless.

Is it also possible that changing the boot mode by a gpio pin which controlled by external source?

Just for example, if the gpio pin is high then boot as DFU and is low then boot as normal application.

Thanks,

Calvin

Parents
  • Hello Calvin,

    That is very much possible. In fact, there is a built in GPIO detect functionality in the bootloader. Check out the example:

    SDK\examples\dfu\secure_bootloader\pca10040e_...

    and check out NRF_BL_DFU_ENTER_METHOD_BUTTON and NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN in sdk_config.h, and how it is used in dfu_enter_check() in nrf_bootloader.c.

    So let us say that the external device sets this pin high or low (it is set to active low by default, but you can change that if you like). If the device reboots at this point in time, then it would go to DFU mode, as long as NRF_BL_DFU_ENTER_METHOD_BUTTON is set to true, and the pin NRF_BL_DFU_ENTERN_METHOD_BUTTON_PIN is held low. What you may want to do is to add the part in your application where an interrupt handler on the same pin will reset the device, so that the bootloader will run, detect that the pin is still held low, and enter DFU mode. 

    Best regards,

    Edvin

Reply
  • Hello Calvin,

    That is very much possible. In fact, there is a built in GPIO detect functionality in the bootloader. Check out the example:

    SDK\examples\dfu\secure_bootloader\pca10040e_...

    and check out NRF_BL_DFU_ENTER_METHOD_BUTTON and NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN in sdk_config.h, and how it is used in dfu_enter_check() in nrf_bootloader.c.

    So let us say that the external device sets this pin high or low (it is set to active low by default, but you can change that if you like). If the device reboots at this point in time, then it would go to DFU mode, as long as NRF_BL_DFU_ENTER_METHOD_BUTTON is set to true, and the pin NRF_BL_DFU_ENTERN_METHOD_BUTTON_PIN is held low. What you may want to do is to add the part in your application where an interrupt handler on the same pin will reset the device, so that the bootloader will run, detect that the pin is still held low, and enter DFU mode. 

    Best regards,

    Edvin

Children
No Data
Related