Main Site Documentation

Watchdog MAX_TIMEOUT constant is possibly wrong on G120HDR


#1

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:

  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.


#2

Look here
https://www.ghielectronics.com/community/forum/topic?id=15091


#3

There was a discussion with a solution just recently here:

https://www.ghielectronics.com/community/forum/topic?id=15091&page=2

[EDIT] jay jay was faster :stuck_out_tongue:


#4

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!

Cheers!


#5

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


#6

I just posted More Complete G120 Custom Watchdog on Codeshare.