File tree 3 files changed +24
-1
lines changed
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)
237
237
/* Perform the reset to reboot to SFU. */
238
238
DEBUG_INFO (" %s: %d bytes received" , __FUNCTION__, ftell (file));
239
239
fclose (file);
240
- NVIC_SystemReset ();
240
+ // NVIC_SystemReset();
241
+ mbed_watchdog_trigger_reset ();
241
242
242
243
return static_cast <int >(OTAError::None);
243
244
}
Original file line number Diff line number Diff line change @@ -110,4 +110,25 @@ void mbed_watchdog_reset()
110
110
hal_watchdog_kick ();
111
111
}
112
112
}
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
+ }
113
134
#endif /* ARDUINO_ARCH_MBED */
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ void samd_watchdog_reset();
30
30
#ifdef ARDUINO_ARCH_MBED
31
31
void mbed_watchdog_enable ();
32
32
void mbed_watchdog_reset ();
33
+ void mbed_watchdog_trigger_reset ();
33
34
#endif /* ARDUINO_ARCH_MBED */
34
35
35
36
#endif /* ARDUINO_AIOTC_UTILITY_WATCHDOG_H_ */
You can’t perform that action at this time.
0 commit comments