Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bootloader doesn't load application with watchdog

Hi,

I've recently enabled the watchdog in our project which included buttonless DFU. Project is based on FreeRTOS, SDK14.0, S132 v5.0.0 on custom board nRF52.

Since the bootloader is currently in a locked state and can't be modified, I set the watchdog timeout in the application to 5 minutes.

What I'm seeing right now is that upon DFU failure, the bootloader hangs just before launching the application on:

 

nrf_drv_clock_uninit();

Specifically on:

    while (nrf_clock_lf_is_running())

Which tells me that it can't turn off the LF clock since the watchdog is using that. Am I correct?
The device recovers after a watchdog reset.

Without the watchdog code, the bootloader works well.

My application settings are the following:

#define CLOCK_ENABLED 1
#define CLOCK_CONFIG_LF_SRC 1
#define CLOCK_CONFIG_IRQ_PRIORITY 7

main function flow:

    ret_code_t err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);
    ...
	
	//Configure WDT.
	nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
	
	err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
	APP_ERROR_CHECK(err_code);
	err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
	APP_ERROR_CHECK(err_code);
	nrf_drv_wdt_enable();
	...
	//init GPIO
	...
	//init SD & Freertos

Like in the WDT example.
Bootloader's settings are 

#define CLOCK_ENABLED 1
#define CLOCK_CONFIG_LF_SRC 1
#define CLOCK_CONFIG_IRQ_PRIORITY 7

and nothing else has changed regarding the clocks and watchdog.

What could be the reason for the failure? Can I integrate the watchdog at this stage?

Thanks.

Related