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

Reset into USB bootloader

This is for the SDK nRF5_SDK_15.2.0_9412b96 and custom hardware.

I have a bootloader based off the example secure_bootloader_usb_mbr_pca10056 project. I want the application to reset and stay in bootloader mode, from a user command.

From another post, I tried this sequence:

#define BOOTLOADER_DFU_START 0xB1
NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
NVIC_SystemReset();

It resets into the application, not the bootloader.

Parents
  • Hi,

    The NRF_BL_DFU_ENTER_METHOD_GREPRET must be set to '1' in the bootloader's sdk_config.h file for this to work. Also, note that you can't access the POWER registers directly if you have the Softdevice enabled in your application, it will lead to a softdevice assertion. Use the SD API sd_power_gpregret_set() if it is enabled.

    You may also consider using the DFU Trigger Library (USB). It's compatible with our existing DFU tools and is integrated into the connectivity example (\examples\connectivity\ble_connectivity\pca10059).

     

  • The watchdog logic still does not work.

    In the main application, the default watchdog timeout is 2000 ms.

    To reset into bootloader mode, I call:

    nrf_wdt_reload_value_set((60000U* 32768U));
    nrf_drv_wdt_channel_feed(wdtId);

    #define BOOTLOADER_DFU_START 0xB1
    sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
    NVIC_SystemReset();

    In the bootloader, I call:

    // set a long timeout
    nrf_wdt_reload_value_set((60000U * 32768U));
    nrf_wdt_reload_request_set(0);

    ret_val = nrf_bootloader_init(dfu_observer);
    APP_ERROR_CHECK(ret_val);

    The bootloader still resets into the application after 2 seconds.

    What could I be missing here?

Reply
  • The watchdog logic still does not work.

    In the main application, the default watchdog timeout is 2000 ms.

    To reset into bootloader mode, I call:

    nrf_wdt_reload_value_set((60000U* 32768U));
    nrf_drv_wdt_channel_feed(wdtId);

    #define BOOTLOADER_DFU_START 0xB1
    sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
    NVIC_SystemReset();

    In the bootloader, I call:

    // set a long timeout
    nrf_wdt_reload_value_set((60000U * 32768U));
    nrf_wdt_reload_request_set(0);

    ret_val = nrf_bootloader_init(dfu_observer);
    APP_ERROR_CHECK(ret_val);

    The bootloader still resets into the application after 2 seconds.

    What could I be missing here?

Children
No Data
Related