Watchdog and Spider


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()
            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)
                if (beRed)
                    beRed = false;
                    beRed = true;

Watch device boot, say running and then reboot :slight_smile:

1 Like

Damn what an idiot!

WDTCounterReset = new Thread(WDTCounterResetLoop);

1 Like

You may have insufficient power,
could you please unplug your display and try again?

Or you could use a powered hub or a dc jack.

For testing purpose you can show your messages in the debug console.

Yeah, my big program reboots so was trying to go simple and got the same problem.

But my simple program had a huge flaw in that it was not resetting the watchdog :frowning:

So hardware works and verifies placement of code correct but my other program must have some other issue (essentially reading analog input but resets when trying to read from SDCard module - runs fine if watchdog code defined out)

Incase anyone suffers the same problem as myself when having a large multi-threaded application with WPF on a GHI spider.

I needed to perform two tasks after identifying that the Wiki code works for the Fez & the Spider (and my test program performed as expected)

  1. Increase the watchdog timer from 5s to 10s
  2. Change the watchdog reset thread priority to AboveNormal so it gets a higher chance of getting a slice of the CPU within the allocated time frame

These two changes have made my real application run with Watchdog support now enabled.

Hopefully, I don’t look like to much of an idiot and anyone reading this can have a laugh and say what an idiot :).

Thanks to Weiti for actually responding so quickly too!


@ Wayne Mather - You think that’s being an idiot? You should see some of my daily gems :wink:

@ Wayne, welcome to the forums - in a big way :wink: But in all seriousness, welcome, and it’s great you tracked down your tricky one (and the lightbulb one :wink: )