C12 Embedded systems in MicroPython and C · Practice
Watchdogs and robustness
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
What WDT_LOAD gives a 50 ms timeout on the 10 MHz board?
Check
A program hangs 200 ms after every start, and its watchdog resets it 20 ms after the last kick (at the hang). How many resets happen in 3 s?
Check
The longest normal gap between kicks is 15 ms. With a 2× margin, what timeout?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A program waits for 1 bytes at 9600 baud, with a timeout of 2 times the time they should take. What timeout is that?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A fault makes a device reset 20 times a day, and each reset leaves it out of action for 50 ms while it restarts. What percentage of the time is it out of action?
Check
A main loop takes up to 12 ms, and the device may be out of action for at most 100 ms.
(a)
What is the shortest safe watchdog timeout?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the longest allowed?
Check
A windowed watchdog must be kicked between 5 ms and 20 ms after the last kick. A loop kicks every 30 ms.
(a)
Is that inside the window (1 for yes)?
(b)
How wide is the window?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
WDT_LOAD for 100 ms?
Check
Resets in 5 s: hang after 150 ms, timeout 25 ms?
Check
Timeout for a 5 ms gap with 3× margin?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12