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

Do not enter Boootloader again after timeout if NRF_BL_DFU_ENTER_METHOD_BUTTON still pressed

Hi

Is there a way to avoid entering a second time into bootloader mode, if the NRF_BL_DFU_ENTER_METHOD_BUTTON is still pressed after timeout?

I want to enter into the bootloader mode, if the device gets charged. if no dfu is started, it should return to executing the app.

so when the charger gets connected the NRF_BL_DFU_ENTER_METHOD_BUTTON is set to low and a reset is performed with sd_nvic_SystemReset();

then the bootloader starts up

if no DFU is startet, after NRF_BL_DFU_INACTIVITY_TIMEOUT_MS  a reset is started, but as the charger is still connected and the NRF_BL_DFU_ENTER_METHOD_BUTTON is still low, the bootloader does not jump to the application.

Has anyone an idea, how to solve this problem?

Thanks

nrf52840

S140 7.0.0

nRF5_SDK_17.0.0\examples\dfu\secure_bootloader\pca10056_s140_ble_debug

Parents
  • Hello,

    By default, the device will enter DFU mode when this button is pressed. You can disable this in sdk_config.h, but if I understand you correctly, this is not what you want to do. You want to ignore the button press only if this has already timed out once, correct?

    If so, you need to do something to remember that this timeout happened the next time you check the button press. Perhaps you can use the GPREGRET register, and set some bit (figure out one but that isn't used for anything else. Just try it out). I suggest you check how this register is used to check whether or not to enter DFU mode. The ble_app_buttonless_dfu example uses this register to put the device in DFU mode before it resets.

    The ble_app_buttonless_dfu example writes to the register using:

    err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);

    but if you don't use the softdevice, you can also use the function nrf_power_gpregret2_set();

    Best regards,

    Edvin

Reply
  • Hello,

    By default, the device will enter DFU mode when this button is pressed. You can disable this in sdk_config.h, but if I understand you correctly, this is not what you want to do. You want to ignore the button press only if this has already timed out once, correct?

    If so, you need to do something to remember that this timeout happened the next time you check the button press. Perhaps you can use the GPREGRET register, and set some bit (figure out one but that isn't used for anything else. Just try it out). I suggest you check how this register is used to check whether or not to enter DFU mode. The ble_app_buttonless_dfu example uses this register to put the device in DFU mode before it resets.

    The ble_app_buttonless_dfu example writes to the register using:

    err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);

    but if you don't use the softdevice, you can also use the function nrf_power_gpregret2_set();

    Best regards,

    Edvin

Children
No Data
Related