Watchdog MAX_TIMEOUT constant is possibly wrong on G120HDR


I am working with G120HDR and implemented Watchdog in my code in accordance with:

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:

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. 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:

  1. Does the code GHI.Premium.Hardware.LowLevel.Watchdog know the platform it’s running on? Should I specify it some where?

  2. Could it be that the MAX_TIMEOUT constant is possibly calculated wrong?

Thanks in advance.

Look here

There was a discussion with a solution just recently here:

[EDIT] jay jay was faster :stuck_out_tongue:

Thanks to both of you Jay Jay and David@ Emro for the referral.

I can’t believe I missed that in my search on the Forum! I guess not knowing what IFU stood for threw me off. I know now! I can’t keep up: ICD, ICSP, OTA (Over The Air Programming), IFU, … Pretty soon I’ll run out of memory cells!

I am not sorry I missed that find since I got the chance to thank you both for your kind assistance.

But I’ll pay more attention next time!


you are welcome!
and Welcome to the community :slight_smile:

I just posted More Complete G120 Custom Watchdog on Codeshare.