I call Swt_Ip_Service in 100msTask, which is OK in timeout mode. In order to use windows wdg mode, I modify the swt configuration as follows:
The software did not work as I expected and the watchdog was reset.
Is there a problem with the configuration? How can I modify it?
I tried to debug, but I found that the CO register is always 0 in Windows WDG mode.
Is there a better way to know how long the time is from the current time point to the timeout?
Hi@Janeting123
If window mode enabled then service SWT should in [Timeout period - window period, Timeout period]
For example:
Your have set Timeout period to 150ms and set window period to 75ms
Then you have to service SWT in "0.15-0.075" ~ "0.15" S, which is range of 75 to 150 ms.
As described in my first sentence, the function is called in 100msTask.
This configuration is specially prepared for this 100ms cycle.
So, I don't know what the problem is.
What confuses me even more is that the chip doesn't seem to have a register that can indicate the watchdog count.
Hi@Janeting123
You need to check whether your 100ms task time is completely accurate or whether it may be occupied by interrupts.
For CO register, you have to disable SW first then you can see the value,
"When SWT is disabled (CR[WEN] is 0), CNT shows the value of the internal timer. When SWT is enabled (CR[WEN] is 1), it writes 0 to CNT. Values in this field can lag behind the internal timer value up to six system clock cycles plus eight counter clock cycles. Therefore, the CNT value that is read immediately after disabling SWT may be higher than the actual value of the internal timer."
The accuracy of 100msTask has been verified in normal dog mode. If there is a special situation in a certain cycle, it needs to be debugged.
Only when CR[WEN]=1, SWT is in window dog mode. At this time, the CO register is always 0. I can't find a suitable debugging method.