Hoernchen has uploaded this change for review.
firmware: enable watchdog timer
2s is plenty, and while not perfect it should at
least ensure that hangs that require manual
intervention happen rarely if at all.
At least from a custimer POV having resets in case
something breaks is better than ending up with non
working devices that are stuck.
Change-Id: I1ef1fc70d33492efe0171a7879c1a23f16957195
---
M sysmoOCTSIM/main.c
1 file changed, 14 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/07/42307/1
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 74de4bf..75fb4ad 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -685,6 +685,17 @@
printf("Chip ID: %s\r\n", sernr_buf);
printf("Reset cause: %s\r\n", rstcause_buf);
+ /* Configure and enable WDT with ~2s timeout (2048 cycles @ 1.024 kHz) */
+ while (WDT->SYNCBUSY.reg)
+ ;
+ WDT->CONFIG.reg = WDT_CONFIG_PER_CYC2048;
+ while (WDT->SYNCBUSY.reg)
+ ;
+ WDT->CTRLA.reg = WDT_CTRLA_ENABLE;
+ while (WDT->SYNCBUSY.reg)
+ ;
+ printf("Watchdog enabled (2s timeout)\r\n");
+
talloc_enable_null_tracking();
g_tall_ctx = talloc_named_const(NULL, 0, "global");
printf("g_tall_ctx=%p\r\n", g_tall_ctx);
@@ -737,6 +748,9 @@
}
feed_ccid();
osmo_timers_update();
+
+ /* Pet the watchdog */
+ WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
int qs = llist_count_at(&g_ccid_s.free_q);
if (qs > NUM_OUT_BUF)
for (int i = 0; i < qs - NUM_OUT_BUF; i++) {
To view, visit change 42307. To unsubscribe, or for help writing mail filters, visit settings.