Greetings,
I am working with G120HDR and implemented Watchdog in my code in accordance with:
https://www.ghielectronics.com/docs/31/watchdog
When trying to set the timeout in ‘Watchdog.Enable(timeout)’ to 30 secs to prevent the board from restarting when trying to reprogram it, I get an exception saying that the MAX_TIMEOUT has been exceeded. Setting a break point and examining it, I found out that it’s approx. 16 secs.
A CTRL+MouseClick revealed the following:
// Summary:
// Maximum supported timeout.
//
// Remarks:
// Value is platform dependant.
According to LPC178x/7x datasheet:
[quote]
7.30 Windowed WatchDog Timer (WWDT)
• Selectable time period from (Tcy(WDCLK) x 256 x 4) to (Tcy(WDCLK) x 2^24 x 4) in
multiples of Tcy(WDCLK) x 4.
• The Watchdog Clock (WDCLK) source is a dedicated watchdog oscillator, which is
always running if the watchdog timer is enabled.
7.33.1.4 Watchdog oscillator
The Watchdog Timer has a dedicated watchdog oscillator that provides a 500 kHz clock to
the Watchdog Timer.[/quote]
So the max time period = 1/500KHz x 2^24 x 4 = 134.2177 secs
My questions:
-
Does the code GHI.Premium.Hardware.LowLevel.Watchdog know the platform it’s running on? Should I specify it some where?
-
Could it be that the MAX_TIMEOUT constant is possibly calculated wrong?
Thanks in advance.