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

RTC hangs after a while, Watchdog does not reset

I'm using RTC to wakeup every 500ms,
I have Watchdog enabled but after a while (about half.. or an hour...) it will not wakeup anymore and watchdog will not reset.

I measured the current on that hang state and it consumes about 2.90uA (this matches the expected 1.5uA RTC + 1.5uA Watchdog consumes )

I was expecting, whatever happen, that Watchdog will reset the MCU.

Some more details:

- I'm not using any SoftApp
- I'm using internal LFRC
- It is feeding the Watchdog before going to sleep
- I tested with an hardware fault, the Watchdog works

Is there something that could make the Watchdog not work ? and RTC stop to work?


I found some similar topics:

https://devzone.nordicsemi.com/f/nordic-q-a/43961/nrf52832-in-sleep-after-a-period-of-operation-the-watchdog-of-the-equipment-did-not-work/172299

https://devzone.nordicsemi.com/f/nordic-q-a/14321/wdt-halts-rtc-after-nvic_systemreset/54658

https://devzone.nordicsemi.com/f/nordic-q-a/64765/rtc-fails-to-wake-chip-from-systemon-sleep-nrf52840

https://devzone.nordicsemi.com/f/nordic-q-a/68666/app-timer-stops-working---need-a-power-cycle-to-fix-issue/281629

https://devzone.nordicsemi.com/f/nordic-q-a/51559/nrf52-wdt-lfclk-sourcing

Some more details:

Every time I go to sleep I set the LFCLK: nrf_clock_task_trigger( NRF_CLOCK_TASK_LFCLKSTART );
I init the RTC before go to sleep and uninit it after return.
I'm using nrf_pwr_mgmt_run(); to enter in sleep.

Parents
  • Hi,


    Once set up and started, the watchdog will run until it is reset. There are two things I can think about that might cause this:

    1. is if you configure the Watchdog to halt while in sleep. See Temporarily pausing the watchdog

    2. is if you are using system off: WDT: WDT configuration is cleared when entering system OFF, but is seems to me you are not using system off?

  • Hi,
    I believe I tested 1. and it works ok and 2. is not the case, as it is waking from RTC.

    I found that on my configuration sdk defines, it was wrongly setting the LFCLKSRC to use external XTAL and I'm using internal RC.

    But why does it work with the wrong settings on the first place?

    I tested the following (pseudo) code, with the wrong setting (LFCLKSRC configured to use XTAL but not populated) it will crash in about 5 minutes:

    int main( void )
    {
    	HAL_OutInit( 1 );
    
    	nrfx_wdt_config_t config = NRFX_WDT_DEAFULT_CONFIG;
    
    	nrfx_wdt_init( &config, NULL );
    	nrfx_wdt_channel_alloc( &s_wtd_channel_id );
    	nrfx_wdt_enable();
    
    	NRF_CLOCK->LFCLKSRC = 1; // XTAL, is not populated, will crash in about 5m
    	//NRF_CLOCK->LFCLKSRC = 0; // RC, works
    
    	HAL_OutSet( 1, true );
    
    	HAL_mcu_sleep(500);
    
    	while( 1 )
    	{
    		HAL_OutSet( 1, false );
    		HAL_mcu_sleep(25);
    		HAL_OutSet( 1, true );
    		nrfx_wdt_channel_feed( s_wtd_channel_id );
    		HAL_mcu_sleep(15);
    	}
    }

    Does this different settings explains the behaviour or could be something else?

    I was expecting that with the wrong setting it shouldn't work anytime.

Reply
  • Hi,
    I believe I tested 1. and it works ok and 2. is not the case, as it is waking from RTC.

    I found that on my configuration sdk defines, it was wrongly setting the LFCLKSRC to use external XTAL and I'm using internal RC.

    But why does it work with the wrong settings on the first place?

    I tested the following (pseudo) code, with the wrong setting (LFCLKSRC configured to use XTAL but not populated) it will crash in about 5 minutes:

    int main( void )
    {
    	HAL_OutInit( 1 );
    
    	nrfx_wdt_config_t config = NRFX_WDT_DEAFULT_CONFIG;
    
    	nrfx_wdt_init( &config, NULL );
    	nrfx_wdt_channel_alloc( &s_wtd_channel_id );
    	nrfx_wdt_enable();
    
    	NRF_CLOCK->LFCLKSRC = 1; // XTAL, is not populated, will crash in about 5m
    	//NRF_CLOCK->LFCLKSRC = 0; // RC, works
    
    	HAL_OutSet( 1, true );
    
    	HAL_mcu_sleep(500);
    
    	while( 1 )
    	{
    		HAL_OutSet( 1, false );
    		HAL_mcu_sleep(25);
    		HAL_OutSet( 1, true );
    		nrfx_wdt_channel_feed( s_wtd_channel_id );
    		HAL_mcu_sleep(15);
    	}
    }

    Does this different settings explains the behaviour or could be something else?

    I was expecting that with the wrong setting it shouldn't work anytime.

Children
Related