23.0 Watchdog [T-Series Datasheet] | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

23.0 Watchdog [T-Series Datasheet]

Overview

The Watchdog system can perform various actions if the T-Series device does not receive any communication within a specified timeout period. Actions include:

  • Reset/restart the device
  • Set DIO
  • Set DAC0/DAC1
  • Reset IO configs

Example: Reset after no communication for 60 seconds

The most common way to use Watchdog is to write:

WATCHDOG_ENABLE_DEFAULT=0        // Disable the Watchdog
WATCHDOG_TIMEOUT_S_DEFAULT=60    // Set the timeout in seconds
WATCHDOG_RESET_ENABLE_DEFAULT=1  // Enable reset upon timeout
WATCHDOG_ENABLE_DEFAULT=1        // Enable the Watchdog

With this configuration, the Watchdog will cause the device to reset if it does not receive any communication for 60 seconds. In other words, if nothing is talking to the device, it will reset every 60 seconds.

Use the IO Config system to configure the power-up defaults as desired.

Basic Usage

A typical usage is to use the IO Config system to set the power-up defaults as desired, then configure the Watchdog to reset the device on timeout.

Write 0 to WATCHDOG_ENABLE_DEFAULT to disable the Watchdog while setting Watchdog configurations. Write 1 to it to enable the Watchdog:

Name Start Address Type Access

WATCHDOG_ENABLE_DEFAULT             Write a 1 to enable the watchdog or a 0 to disable. The watchdog must be disabled before writing any of the other watchdog registers (except for WATCHDOG_STRICT_CLEAR).

61600 UINT32 R/W

Use WATCHDOG_TIMEOUT_S_DEFAULT to set the timeout in seconds:

Name Start Address Type Access

WATCHDOG_TIMEOUT_S_DEFAULT             When the device receives any communication over USB/Ethernet/WiFi, the watchdog timer is cleared. If the watchdog timer is not cleared within the timeout period, the enabled actions will be done.

61604 UINT32 R/W

The timeout period is reset when a response to a command-response packet is sent to the host, except when strict mode is enabled (see below).

In addition to enabling the Watchdog and setting a timeout, the Watchdog needs to be configured to take an action when the timeout is complete.

Actions

Most applications will simply need the Watchdog to reset the device. Use WATCHDOG_RESET_ENABLE_DEFAULT to enable device reset:

Name Start Address Type Access

WATCHDOG_RESET_ENABLE_DEFAULT             Timeout action: Set to 1 to enable device-reset on watchdog timeout.

61620 UINT32 R/W

To set DIO upon timeout, set the following configurations:

Name Start Address Type Access

WATCHDOG_DIO_ENABLE_DEFAULT             Timeout action: Set to 1 to enable DIO update on watchdog timeout.

61630 UINT32 R/W

WATCHDOG_DIO_STATE_DEFAULT             The state high/low of the digital I/O after a Watchdog timeout. See DIO_STATE

61632 UINT32 R/W

WATCHDOG_DIO_DIRECTION_DEFAULT             The direction input/output of the digital I/O after a Watchdog timeout. See DIO_DIRECTION

61634 UINT32 R/W

WATCHDOG_DIO_INHIBIT_DEFAULT             This register can be used to prevent the watchdog from changing specific IO. See DIO_INHIBIT for more information.

61636 UINT32 R/W

To set DAC0 or DAC1 upon timeout, set the following configurations:

Name Start Address Type Access

WATCHDOG_DAC0_ENABLE_DEFAULT             Timeout action: Set to 1 to enable DAC0 update on watchdog timeout.

61640 UINT32 R/W

WATCHDOG_DAC0_DEFAULT             The voltage of DAC0 after a Watchdog timeout.

61642 FLOAT32 R/W

WATCHDOG_DAC1_ENABLE_DEFAULT             Timeout action: Set to 1 to enable DAC1 update on watchdog timeout.

61650 UINT32 R/W

WATCHDOG_DAC1_DEFAULT             The voltage of DAC1 after a Watchdog timeout.

61652 FLOAT32 R/W

To reset IO configs, set the following advanced configuration:

Name Start Address Type Access

WATCHDOG_ADVANCED_DEFAULT             A single binary-encoded value where each bit is an advanced option. If bit 0 is set, IO_CONFIG_SET_CURRENT_TO_FACTORY will be done on timeout. If bit 1 is set, IO_CONFIG_SET_CURRENT_TO_DEFAULT will be done on timeout.

61602 UINT32 R/W

Short Timeouts

The Watchdog timeout can be set as low as 1 second—but such a low value can prevent the device from communicating if reset is enabled. For example, when a USB device resets it takes a little time for USB to re-enumerate and software to be able to talk to the device again, so you could get in a situation where the device keeps resetting so often that you can't start talking to it again. This might require using the reset-to-factory jumper—see 11.0 SPC for details.

Strict Mode

The default timeout period is reset when a response to a command-response packet is sent to the host. Alternatively, "strict" mode can be enabled using WATCHDOG_STRICT_ENABLE_DEFAULT:

Name Start Address Type Access

WATCHDOG_STRICT_ENABLE_DEFAULT             Set to 1 to enable strict mode.

61610 UINT32 R/W

When strict mode is enabled, the timeout period is reset by writing the key value to WATCHDOG_STRICT_CLEAR:

Name Start Address Type Access

WATCHDOG_STRICT_CLEAR             When running in strict mode, writing the key to this register is the only way to clear the watchdog. Writing to this register while not using strict mode will clear the watchdog.

61614 UINT32 W

To set the key, write to WATCHDOG_STRICT_KEY_DEFAULT:

Name Start Address Type Access

WATCHDOG_STRICT_KEY_DEFAULT             When set to strict mode, this is the value that must be written to the clear register.

61612 UINT32 R/W

When strict mode is disabled, writing any value to WATCHDOG_STRICT_CLEAR will clear the Watchdog.

Writing to WATCHDOG_STRICT_CLEAR will clear the Watchdog when the write is processed, not when a response packet is sent.

When Using Stream

Normal spontaneous stream data does not reset the Watchdog timeout. Write periodic command-response communication to reset the Watchdog timeout. For the difference between command-response and stream, see the Communication section.

Startup Delay

To set an initial delay, use WATCHDOG_STARTUP_DELAY_S_DEFAULT:

Name Start Address Type Access

WATCHDOG_STARTUP_DELAY_S_DEFAULT             This specifies the initial timeout period at device bootup. This is used until the first time the watchdog is cleared or timeout ... after that the normal timeout is used.

61606 UINT32 R/W