Closed CasperBroekhuizen closed 4 years ago
Reason for the choice of triggering an interrupt instead of a reset is that the internal watchdog is tied to the command handler (basically a command needs to be sent every 178s otherwise the board should trigger a power-cycle). If we cannot receive commands, it might be because the RS485 driver is in latch-up and the only way to fix this is power-cycling the board.
Unfortunately power-cycling the board is not implemented in all places while the soft-reset is. I think there should be a TODO comment but I a not 100% sure.
To make sure the interrupt is not disabled by mistake, the periodic task re-initializes the interrupt every second (without restarting the counter).
My preference would be setting the flag manually.
https://github.com/DelfiSpace/DelfiPQcore/commit/2ef8cf8aff3536bb4fcc896fcbe4f7f3fc5ab974 to raise WDT timeout reset cause flag.
The watchdog is initialized in interval-mode. This does not call for a reboot but fires an interrupt routine. This interrupt routine calls the SysCtl reboot sequence, which means the system gets rebooted, but the WDT expiration flag is not set in the reboot causation registers. Some options to make the WDT expiration flag appear in the current setup:
Use the Watchdog in timer-mode instead of interval mode, this means the Watchdog does not fire an interrupt routine, but expects the user to set the reset type (Soft/Hard -> e.g. SysCtl_setWDTTimeoutResetType(WDT_A_HARD_RESET); ).
instead of calling the SysCtl routine, Initiate a Hard/Soft reset using the ResetCtl, and manually set the WDT Expiration flag (e.g. ResetCtl_initiateHardResetWithSource(RESET_HARD_WDTTIME); )