Watchdog .NETMF

I as using the .NETMF 4.3 SDK to write firmware for STM32F405. I am trying to implement the hardware watchdog. I understand that the Microsoft.SPOT.Hardware watchdog is not working as expected and according to the guide I need to use the using GHIElectronics.NETMF.Hardware.LowLevel watchdog, however, I am failing to locate it and when I try to use it, it is saying that the namespace could not be found. Please assist with locating and integrating it to my project. Thanks.

This is from many, many years go so I do not remember exactly but I think the implementation was only on G120 and G400 and not on open source projects.

I did exactly this about 8 years ago. I believe I just looked up the Watchdog registers in the manual for the CPU and set a few of the bits using that LowLevel API. Then in my program’s main loop or in a separate thread with a loop, I would set the keep alive bit. If my program ever froze, the keep alive bit would not get set and the whole thing would reboot. I can’t find that code anymore, but here is an old post:

Looks like the intervalSeconds never got implemented, but I think this worked. I think you initialize, then call reset every few seconds. If you don’t call reset, it reboots. Try this:

public static class WatchdogTimer
{
    const UInt32 PERIPH_BASE = 0x40000000;
    const UInt32 IWDG_BASE = PERIPH_BASE + 0x3000;  // Independent watchdog (IWDG)
    static Register IWDG_KR = new Register(IWDG_BASE + 0x00);
    static Register IWDG_PR = new Register(IWDG_BASE + 0x04);
    static Register IWDG_RLR = new Register(IWDG_BASE + 0x08);
    static Register IWDG_SR = new Register(IWDG_BASE + 0x0C);

    static void Initialize(int intervalSeconds)
    {
        IWDG_KR.Write(0x5555);  // Enable Access to Watchdog Registers
        IWDG_PR.SetBits(0x07);  // Set Divider to /256
        IWDG_RLR.SetBits(0xFFF); // Set starting number for countdown in watchdog 0xFFF is about 32 seconds
        IWDG_KR.Write(0xCCCC);  // Start the watchdog timer!!!
    }

    static void Reset()
    {
        Debug.WriteLine("Resetting watchdog");
        IWDG_KR.Write(0xAAAA);
    }
}