Skip to content

Commit 679118c

Browse files
pennamaentinger
authored andcommitted
Avoid infinite loop if we fail to enable/reconfigure watchdog
1 parent 94ff897 commit 679118c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/utility/ota/OTA-nano-rp2040.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ int rp2040_connect_onOTARequest(char const * ota_url)
243243

244244
/* Perform the reset to reboot to SFU. */
245245
mbed_watchdog_trigger_reset();
246+
/* If watchdog is enabled we should not reach this point */
247+
NVIC_SystemReset();
246248

247249
return static_cast<int>(OTAError::None);
248250
}

src/utility/watchdog/Watchdog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ void mbed_watchdog_trigger_reset()
124124

125125
if (hal_watchdog_init(&cfg) == WATCHDOG_STATUS_OK) {
126126
is_watchdog_enabled = true;
127+
while(1){}
127128
}
128129
else {
129130
DEBUG_WARNING("%s: watchdog could not be reconfigured", __FUNCTION__);
130131
}
131132

132-
while(1){}
133133
}
134134
#endif /* ARDUINO_ARCH_MBED */

0 commit comments

Comments
 (0)