I just posted G120 Custom watchdog with MAX_TIMEOUT ~ 120 seconds on Codeshare. Feel free to discuss and make suggestions here.
From LPC178x/7x User’s Manual:
[quote]3.8.4 Watchdog oscillator The Watchdog Timer has a dedicated oscillator that provides a 500 kHz clock to the
Watchdog Timer that is always running if the Watchdog Timer is enabled. The Watchdog
oscillator clock can be output on the CLKOUT pin in order to allow observe its frequency.
In order to allow Watchdog Timer operation with minimum power consumption, which can
be important in reduced power modes, the Watchdog oscillator frequency is not tightly
controlled. The Watchdog oscillator frequency will vary over temperature and power
supply within a particular part, and may vary by processing across different parts. This
variation should be taken into account when determining Watchdog reload values.
Within a particular part, temperature and power supply variations can produce up to a
±17% frequency variation. Frequency variation between devices under the same
operating conditions can be up to ±30%.[/quote]
From 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.
22.214.171.124 Watchdog oscillator
The Watchdog Timer has a dedicated watchdog oscillator that provides a 500 kHz clock to
the Watchdog Timer.[/quote]
So I recommend that the we don’t exceed 70% of the max calculated time period = 0.7 * 1/500KHz x 2^24 x 4 = 94 secs
Warning: Watchdog.LastResetCause will not be correct on start-up when olif’s LowLevelWatchdog.Enable() is used in place of GHI’s Watchdog.Enable().