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

Bootloader with WDT and App_time

Hello:

I am working on a USB bootloader where I have enabled the WDT on entry. After I enable the WDT, the app_timer is set to feed the WDT and to also signal the end of waiting for USB input for a DFU.  When I enable the WDT, neither of the app_timers will not fire and the WDT eventually resets the device.  Our bootloader is set up to go to DFU if the previous processor start was caused by a WDT - the bootloader cycles forever issuing a WDT, going to DFU, issuing a WDT, ...   Is there a solution for this?  I want to leave the WDT enabled but cannot if the app_timer is disabled.

Thanks,

Joer55

  • Hi Vidar:

    Thank you for your reply.  Yes, the code I have does have a call in timer_init() to nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART). But when I enable the WDT code, it does not get called.

    static void timer_init(void)
    {
        if (!m_app_timer_initialized)
        {

             if (!nrf_clock_lf_is_running())
             {

                  nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART);

    It seems the function nrf_clock_is_running() returns TRUE if the WDT is enabled.  If I skip the nrf_clock_lf_is_running() function, the app_timer works as desired.  Can I assume calling nrf_clock_task_trigger() multiple times will not cause problems?


    Thanks Again,

    Joer55

  • Correction:  It seems the function nrf_clock_lf_is_running() returns TRUE if the WDT is enabled.

  • Hi,

    I am glad to hear that it fixed the problem. I did manage reproduce it with the bootloader here as well now. I just had to insert a small delay between the wdt_start() and nrf_bootloader_wdt_init() function. I assume the run status bit did not get enough time to become set earlier.

            wdt_start();
            nrf_delay_ms(10);
            nrf_bootloader_wdt_init();

    Anyway, it should not be a problem to always trigger the clock start task. The Softdevice seems to do the same when coming out of a Soft reset with the WDT active. I actually think that must be part of the reason I have not encountered this problem before.

    I will report this internally so we can include the fix in future releases. We should probably clarify this behavior in the documentation too.

    Best regards,

    Vidar

Related