janelia-arduino / Watchdog

The watchdog monitors the operation of the system by expecting periodic communication from the software, generally known as servicing or refreshing the watchdog. If this periodic refreshing does not occur, the watchdog resets the system.
Other
25 stars 4 forks source link

compiler error for SparkFun Pro Micro #5

Open Jim-2249 opened 3 years ago

Jim-2249 commented 3 years ago

When I compile the example code: Watchdog/examples/WatchdogTester/WatchdogTester.ino as-is for the SparkFun Pro Micro 5V 16MHz, I get the following error: C:..\libraries\Watchdog\src\Watchdog\WatchdogBaseTeensy2.cpp:17:3: error: '_restartTeensyduino' was not declared in this scope I have not found any _restartTeensyduino() anywhere.

Thanks for making this code available! -Jim

mastersta commented 2 years ago

Same issue with the same board. I simply deleted line 17 in WatchdogBaseTeensy2.cpp and it compiled.

Jim-2249 commented 2 years ago

I simply deleted line 17 in WatchdogBaseTeensy2.cpp

Wouldn't that prevent a watchdog timeout from restarting the processor?

mastersta commented 2 years ago

Honestly I didn't look that hard at the code, I just figured based on the name of the function that it didn't do anything for the Pro Micro, and the fact that the neither you, nor I, nor the compiler found the function anywhere means that it wasn't going to do anything anyways.

That being said, I did a short test run using the library and it didn't seem to work after deleting the line (I ended up just using the avr/wdt) so obviously something's broken.

Jim-2249 commented 2 years ago

I simply hacked what I wanted out of some other code. Might have been Janelia's code too. I think it's now processor specific, but I won't be using it on other processors. This is the code I used, and probably should work. It was executed to take the processor out of setup mode. When the switch was turned off, the processor executed while(1); until timeout.

void (* rebootProcessor) (void) = 0; //declare reset function at address 0

//WDT Interrupt which will soft reset the board
ISR(WDT_vect)
{
  wdt_disable();
  rebootProcessor();
}
peterpolidoro commented 2 years ago

I will take a look at this when I have a chance. I am assuming this issue arises because the SparkFun Pro Micro and one of the Teensy boards use the same processor. You could try installing the Teensyduino modifications to the Arduino IDE or maybe there is a way to differentiate between the boards when compiling to only use the Teensyduino code for official Teensy boards.