Are there any restrictions that impact when the Watchdog Timer (WDT) can be configured?
Answer:
Yes. The WDT is a low energy peripheral and has multiple timing requirements. Additionally the WDT logic requires certain sequences to safely change interval or modify the configuration.
First, The WDT should be DISABLED before changing the WDT configuration. Hence, before locking out the WDT disable feature or updating the WDT timeout interval, you must ensure the WDT has first been disabled.
Third, If you intend to change the WDT interval, care must be taken to feed the WDT before disabling, as the WDT can trigger a reset when the interval is changed. This can happen even if the WDT is disabled. In order to avoid synchronization issues, the advised sequence is as follows.
void change_interval()
{
WDTCN = 0xA5; // Refresh WDT
// Insert code to wait for 2 divided LFOSC0 clock periods
WDTCN = 0xDE; // Disable WDT (first key)
WDTCN = 0xAD; // Disable WDT (second key)
// Insert code to wait for 3 divided LFOSC0 clock periods
WDTCN = WDT_interval // Change the current WDT interval to a lower interval with the MSB cleared to 0
// Insert code to wait for 1 SYSCLK clock period }
Updating the Watchdog configuration on EFM8
Question:
Are there any restrictions that impact when the Watchdog Timer (WDT) can be configured?
Answer:
Yes. The WDT is a low energy peripheral and has multiple timing requirements. Additionally the WDT logic requires certain sequences to safely change interval or modify the configuration.
First, The WDT should be DISABLED before changing the WDT configuration. Hence, before locking out the WDT disable feature or updating the WDT timeout interval, you must ensure the WDT has first been disabled.
Second, synchronization delays apply when writing to the WDT register. See KB article Synchronization when writing to Watchdog Timer Control (WDTCN) on EFM8.
Third, If you intend to change the WDT interval, care must be taken to feed the WDT before disabling, as the WDT can trigger a reset when the interval is changed. This can happen even if the WDT is disabled. In order to avoid synchronization issues, the advised sequence is as follows.