Raptor watchdog

I’m a little unclear on the status of the Raptor Watchdog based on other threads on this forum. Is the watchdog functional and safe to use on a Raptor with the

Oct 23, 2013 4.2 Release NETMF and Gadgeteer Package 2013 R3 SDK?

How much effort is required to get a program working on 2013 R3 working again if I upgrade to the latest SDK release?

Thanks

I had it working on 4.2.

That largely depends on which parts of SDK you are using. RLP and CAN were subsystems that got a [em]complete overhaul[/em]. You’ll pretty much have to rewrite everything.

Other subsystems are a lot easier to migrate. A few changes here and there, but nothing drastic.

@ Gene - it didn’t take me long at all. Nothing difficult, just a case if renaming stuff. Not taxing at all.

Can you tell me what assembly I need for the Watchdog class?

The GHI documentation says to use the GHI.Hardware assembly which I can’t find. Their example program has a " using GHI.Processor" which I can’t find either.

I have included

using GHI.Hardware.G400;
using GHI.Premium.Hardware;

but I still can’t find Watchdog.Enable.

Thanks for the help.

Welcome to the mess.

You are looking at an example that is for SDK 4.3, while you’re still at 4.2.

@ Simon Well that was the clue. I still find it absurdly difficult to figure out what assemblies go with what methods.

Thanks very much.

Maybe this wasn’t such a good idea. The first time I ran a really simple test program my Raptor became unresponsive just like @ Simon did in this thread.

https://www.ghielectronics.com/community/forum/topic?id=13718&page=1

I get a USB Device not recognized when I reset the Raptor and FEZConfig can’t ping it.

What did you do to bring your Raptor back?

I tried the GHI example on a Raptor board running NETMF 4.3, modified only to display the cause of reset and to force a reset. Here is the code:

using System;
using Microsoft.SPOT;

namespace Watchdog_Test
{
using System;
using System.Threading;
using GHI.Processor;

public class Program
{
    public static void Main()
    {

        // Timeout 5 seconds
        int timeout = 1000 * 5;

        // Normally, you can read this flag ***ONLY ONCE*** on power up
        if (Watchdog.LastResetCause == Watchdog.ResetCause.Watchdog)
        {
            Debug.Print("Watchdog did Reset");
        }
        else
        {
            Debug.Print("Reset switch or system power");
        }

        // Enable Watchdog
        Watchdog.Enable(timeout);

        // Start a time counter reset thread
        WDTCounterReset = new Thread(WDTCounterResetLoop);
        WDTCounterReset.Start();

        // ....
        // your program starts here

        // If we exit the program,
        // the thread will stop working and the system will reset!
        Thread.Sleep(Timeout.Infinite);
    }

    static Thread WDTCounterReset;
    static void WDTCounterResetLoop()
    {
        while (true)
        {
            // reset time counter every 3 seconds
            Thread.Sleep(3000);
             // Since the counter is not reset, a reset should happen....
             // Watchdog.ResetCounter(); 
        }
    }
}

}

Thinking that interactions between the debugger and RESET might be an issue, I replaced the Debug.Print() statements after the test for the cause of reset by blinking an LED quickly for a watchdog induced reset or slowly for normal reset. I deployed the code to the Raptor board.

Result was the same… no watchdog reset ever seemed to occur. LED always blinked slowly and the only the “Reset switch or system power” message was ever produced.

Getting a Watchdog timer functioning is crucial for the success of our project. I will apologize in advance, if my code or understanding is incorrect. If not, please make fixing this problem a priority.

Thanks,
Wayne