Watchdog and 'System.InvalidOperationException

@ francois910 - Can you look in the call stack window? If you can’t find it, see if you can enable it under Debug > Windows > Call Stack when debugging.

Is the watchdog timer being enabled more than one in the program?

Screen with my call stack

@ mike : i just enable in the start of my main.
I test using disabled before but i have the same error.

@ francois910 - Does the below program give the exception every time it’s ran?


public static void Main()
{
    Watchdog.Enable(1000 * 15);

    while (true)
    {
        Watchdog.ResetCounter();

        Thread.Sleep(1000);
    }
}

Yes, i have exception every time with this code

(i use GHI.Processor.Watchdog… because watchdog is in Microsoft.SPOT.Hardware and GHI.Processor)

@ francois910 - I was not able to reproduce the issue using the latest beta 3 firmware. Which version are you running? Have you tried a different Cerberus board if you have any? Can you reflash the firmware and try again?

i use 4.3

I haven’t Cerberus board.

But now I have a problem recognition hardware so I can not do reflash. (This is another problem that one.)

@ francois910 - Any Cerb family board will do, another Cerb 40 II, Cerberus, or Cerbuino. Can you put the board into DFU mode and try to reflash the loader?

Ok,
i take a second fez cerb 40 ii and i reflash the loader. It was in 4.2 and i put the 4.3.

So in the first use, no problem, but when i put for the second time the program, i have the same exeption.

And, when i put your code, 1st time no problem, but i have exeption in 2nd time.

code (for your test) it"s just :


using System.Threading;
using GHI.Processor;



namespace testODB
{
    public class Program
    {
        


        public static void Main()
        {
            Watchdog.Enable(1000 * 15);

            while (true)
            {
                Watchdog.ResetCounter();

                Thread.Sleep(1000);
            }
        }

    }

}

francois910 - We are still unable to reproduce the issue. Can you try using the just released SDK?

I put the 4.3.3.

1st time it’s good, 2nd time exeption^^

@ francois910 - Can you take a screenshot of the window that pops up when you get the exception?

it’s done.

@ francois910 - When you run the program the second time, do you unplug the board at all or do you just restart the program in Visual Studio?

i just restart

i test with unplug and restart but same error

@ francois910 - That is the source of the problem, we do not uninitialized watchdog properly during a restart. The only workaround is to completely unplug the board and plug it back in. This will be fixed in the next release.

Ok, ty.

Note, if i unplug and plug it’s not good too for restart with wisualstudio .I need to put a program without watchdog and reset after a new program with a watchdog to be able to restart one time (because bug in the 2nd time) with visual studion.

@ francois910 - That is correct. When you start debugging with VS, the program was already running so it is restarted and you will get the bug.

Has this been fixed in the .NET MF latest bits?? i get this error all the time, i have a requirement for the watchdog now

This was fixed in the first SDK released after my reply three years ago. If you still have an issue with watchdog it’ll be best to create a new thread.