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.

  • 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?

Related