File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,8 @@ int rp2040_connect_onOTARequest(char const * ota_url)
237237 /* Perform the reset to reboot to SFU. */
238238 DEBUG_INFO (" %s: %d bytes received" , __FUNCTION__, ftell (file));
239239 fclose (file);
240- NVIC_SystemReset ();
240+ // NVIC_SystemReset();
241+ mbed_watchdog_trigger_reset ();
241242
242243 return static_cast <int >(OTAError::None);
243244}
Original file line number Diff line number Diff line change @@ -110,4 +110,25 @@ void mbed_watchdog_reset()
110110 hal_watchdog_kick ();
111111 }
112112}
113+
114+ void mbed_watchdog_trigger_reset ()
115+ {
116+ watchdog_config_t cfg;
117+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
118+ cfg.timeout_ms = 1 ;
119+ #elif defined(ARDUINO_NANO_RP2040_CONNECT)
120+ cfg.timeout_ms = 1 ;
121+ #else
122+ # error "You need to define the maximum possible timeout for this architecture."
123+ #endif
124+
125+ if (hal_watchdog_init (&cfg) == WATCHDOG_STATUS_OK) {
126+ is_watchdog_enabled = true ;
127+ }
128+ else {
129+ DEBUG_WARNING (" %s: watchdog could not be reconfigured" , __FUNCTION__);
130+ }
131+
132+ while (1 ){}
133+ }
113134#endif /* ARDUINO_ARCH_MBED */
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ void samd_watchdog_reset();
3030#ifdef ARDUINO_ARCH_MBED
3131void mbed_watchdog_enable ();
3232void mbed_watchdog_reset ();
33+ void mbed_watchdog_trigger_reset ();
3334#endif /* ARDUINO_ARCH_MBED */
3435
3536#endif /* ARDUINO_AIOTC_UTILITY_WATCHDOG_H_ */
You can’t perform that action at this time.
0 commit comments