G’day,
Has anyone had issues with the Watchdog as per the Wiki Tutorial and the Spider?
My board just keeps rebooting when using the watchdog so as a good developer, I must be the problem! Is the following code actually incorrect?
Even if I move the Watchdog into the main() function in the partial class, I still end up with a rebooting device.
Create new gadgeteer project
Add LCD and MultiColor led to Socket 4
Add this code to the partial class:
// This method is run when the mainboard is powered up or reset.
void ProgramStarted()
{
GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.Enable(5000);
display.SimpleGraphics.DisplayText("Running", Resources.GetFont(Resources.FontResources.NinaB), Color.White,
0, 0);
Debug.Print("Program Started");
}
private static bool beRed = false;
static Thread WDTCounterReset;
static void WDTCounterResetLoop()
{
while (true)
{
Thread.Sleep(3000);
if (beRed)
{
led.TurnRed();
beRed = false;
}
else
{
led.TurnBlue();
beRed = true;
}
GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.ResetCounter();
}
}
Compile
Deploy
Run
Watch device boot, say running and then reboot