Hi,
We have an freertos based app (SDK14.2).
Recently we have added a WDT support in the following manner:
- The init code initializes the WDT reload value to T+3 seconds (currently 13 sec), run in Sleep, pause in Halt. This is done in main() BEFORE the freertos kernel is started
- Each task's handler requests WD channel just prior to entering the task's while(true) loop
- The last task that gets WDT channel (channel num == # of tasks (==6)) also enables the WDT
- Each task loop is tuned to run every (up to) T seconds (currently 10 sec due to power constraints)
- It is planned that if any of the tasks hangs/asserts, it will not feed its respective channel and the system will WD reset within 13 sec at most.
Occasionally we encounter an odd behavior that the WDT fires with no apparent reason in the first few seconds from system boot.
I tried to single step the WDT initialization code and noticed that some registers are NOT zero upon startup as if they remain set from last debug session:
e.g. - these are the values after device startup just BEFORE calling nrf_drv_wdt_init() (see screen cap attached)
- REQSTATUS = 0x0000000F <<< What this register is used for ???
- RUNSTATUS = 0x00000001
- RREN = 0x0000003F (6 channels enabled)
- INENSET/INTENCLR = 0x00000001
- CRV = 0x00068000 (13 sec)
It seems that the WDT module retains values from prev debug session.
Can it explain the premature firing? Is it reasonable that the WD counter keeps running from the last value it was at before the reset and hence firing prematurely ???
Thanks