WD: Set / read watchdog timer¶
FAST Serial Protocol: Overview & First Steps
This documentation section is about the FAST Serial Protocol (FSP) commands, which are the low-level commands a host computer sends to a FAST board. Most FAST Pinball makers do not need to know about these details, since the pinball game framework (such as the Mission Pinball Framework) handles this communication for you.
If you're writing your own game framework, we have a series of programming guides. Also, be sure to read the overview of how FSP works and how to connect first.
FAST Controllers contain a watchdog timer which must be continuously refreshed by the host computer. If the watchdog ever counts down to zero (because the host computer crashed or is otherwise not responsive), then it will disable all driver outputs.
A typical timeout period is 500ms, but can be adjusted based on your particular needs and the speed at which the host computer can reliably deliver commands to the FAST platform.
For FAST Retro platform controllers, this watchdog timer controls the original blanking circuit, which will include the lamp matrix, display, and drivers. For FAST Modern Controllers, this blanking affects all drivers attached to FAST I/O Boards.
All current FAST controllers have a visual LED indicator showing the blanking state. If that indicator is on, the hardware is blanking (disabled). If the indicator is off, the hardware is enabled.
How the watchdog works¶
In the FAST Modern platform, the watchdog acts as an additional safety system which must be enabled in order for driver outputs to work. The watchdog circuitry is separate and completely unrelated to the regular driver control circuitry. The watchdog only connects into the driver at the final output stage.
Both the watchdog and driver control must agree for a driver to be activated. The following simple truth table illustrates the relationship between the watchdog and driver control:
WD | Driver | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Because the watchdog is separate and outside of the standard driver control, when the watchdog is disabled, the driver still continues to function normally. It will still watch switches, track its state, maintain timers, etc. An individual driver doesn't even know whether the watchdog is active or not. (The Neuron knows, and can report the watchdog status.)
It's important to understand that the watchdog is a safety cut-off circuit which is intended to be enabled (and consistently refreshed) whenever the host PC is on and communicating with the machine. The watchdog is not intended to be used as a control method in the machine. (e.g. Don't use the watchdog to disable drivers when a game is over, use proper TL:
or DL:
configuration commands instead.)
The reason for this is that because the drivers continue to run when the watchdog is expired, they could potentially change states or be in some unexpected state which could cause unexpected results when the watchdog was reenabled. So the best practice is to set the watchdog early in the boot process (just after the CH:
command) and keep it active until the machine is powered off.
Setting the watchdog timer¶
WD:<TIME><CR>
<TIME>
Time (in ms) until timeout
Note that the CH:
command must be set prior (and match the correct hardware platform) or the watchdog will fail being set. This is to prevent running the wrong application on incorrect hardware. See the CH:
and ID:
commands for more information.
Return values:
WD:P
Valid watchdog command submittedWD:X
Invalid watchdog command submittedWD:F
Invalid watchdog command submitted orCH:
command has not been successfully sent yet.
Forcing the watchdog timer to expire¶
If you want to use the watchdog to disable all the drivers, you can't set WD:0
since that will disable the watchdog feature (and therefore enable all the drivers), so instead just use WD:1
to set the watchdog to 1ms, which will cause it to disable the drivers 1ms later. (Prob even before the host computer receives the WD:P
confirmation.)
Disabling the watchdog timer¶
You can disable the Watchdog timer functionality by setting it to 0.
WD:0<CR>
(Returns WX:FFFFFFFF
)
Disabling the watchdog timer means that all drivers can be activated. This setting is useful when you're doing your initial bench testing and learning about the platform, but should not be used in a machine. (Servicing the watchdog timer should be one of the first things you build if you're writing your own pinball software. If you use something like MPF, the watchdog is handled automatically.)
Reading the watchdog timer¶
WD:<CR>
Return values:
WD:00000000
, the watchdog has expired, drivers are disabled.WD:<TIME>
, the time value is the number of milliseconds (in hex) until the watchdog expires. e.g.WD:000FF839
Drivers are enabled.WD: FFFFFFFF
, the watchdog is disabled, drivers are enabled.
N or > jump the next page, P or < for previous, search with S or ?