It's not a bad idea. USB is pretty quick, and available on my laptop. My laptop only has a wireless ethernet interface, but I could get a dongle to get wired Ethernet.What about sending some logging data over Ethernet? I’m responding to the fact that you don’t want your laptop nearby. The same restrictions apply about sending data over a transport during an ISR. (I.e. don’t — buffer it somehow and send it in a non-ISR function.)
// only works with tera term monitor
// teensy mointor shows nothing for me
elapsedMillis noActivityTimer;
void setup() {
delay(1000);
Serial.begin(115200);
//delay(1000);
unsigned long start = millis();
while (!Serial && millis() - start < 2000) {
// just wait
}
Serial.println("Booting...");
uint32_t cause = SRC_SRSR;
Serial.print("reason #-");
Serial.print(cause);
if (cause & (1 << 0)) {
Serial.println(" -->Power-on reset");
}
if (cause & (1 << 3)) {
Serial.println(" External reset pin");
}
if (cause & (1 << 4)) {
Serial.println(" Watchdog reset");
}
if (cause & (1 << 1)) {
Serial.println(" -->Software reset");
}
// Clear flags
SRC_SRSR = cause;
}
//--------------
void doReboot() {
SCB_AIRCR = 0x05FA0004;
}
void loop() {
if (noActivityTimer > 10000) { // 10 seconds do software reboot
doReboot();
}
}