DelfiSpace / DelfiPQcore

0 stars 1 forks source link

The WatchdogTimer does not set the Watchdog Expiration flag in ResetCtl registers #15

Closed CasperBroekhuizen closed 4 years ago

CasperBroekhuizen commented 4 years ago

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:

CasperBroekhuizen commented 4 years ago

related to https://github.com/DelfiSpace/FlightSoftwareWorkspace/issues/2

StefanoSperetta commented 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.

CasperBroekhuizen commented 4 years ago

https://github.com/DelfiSpace/DelfiPQcore/commit/2ef8cf8aff3536bb4fcc896fcbe4f7f3fc5ab974 to raise WDT timeout reset cause flag.