testing, “config defaults” in LJCP can be used to enable the watchdog all the time, but often it is desirable to enable/disable the
watchdog in user software so it is only active while that software is running.
Note that some USB hubs do not like to have any USB device repeatedly reset. With such hubs, the operating system will quit
reenumerating the device on reset and the computer will have to be rebooted, so avoid excessive resets with hubs that seem to
have this problem.
If the watchdog is accidentally configured to reset the Comm processor with a very low timeout period (such as 1 second), it could
be difficult to establish any communication with the device. In such a case, the reset-to-default jumper can be used to turn off the
watchdog. Power up the U3 with a short from FIO2<=>SCL, then remove the jumper and power cycle the device again. This resets
all power-up settings to factory default values.
There is one IOType used to configure and control the watchdog:
LJ_ioSWDT_CONFIG //Channel is enable or disable constant.
The watchdog settings are stored in non-volatile flash memory (and reloaded at reset), so every request with this IOType causes a
flash erase/write. The flash has a rated endurance of at least 20000 writes, which is plenty for reasonable operation, but if this
IOType is called in a high-speed loop the flash could be damaged.
The following are special channels used with the watchdog config IOType above:
LJ_chSWDT_ENABLE // Value is timeout in seconds (1-65535).
LJ_chSWDT_DISABLE
The following are special channels, used with the put config IOType, to configure watchdog options. These parameters cause
settings to be updated in the driver only. The settings are not actually sent to the hardware until the
LJ_ioSWDT_CONFIG
IOType
(above) is used:
LJ_chSWDT_RESET_DEVICE
LJ_chSWDT_RESET_COMM
LJ_chSWDT_RESET_CONTROL
LJ_chSWDT_UDPATE_DIOA
LJ_chSWDT_UPDATE_DIOB
LJ_chSWDT_DIOA_CHANNEL
LJ_chSWDT_DIOA_STATE
LJ_chSWDT_DIOB_CHANNEL
LJ_chSWDT_DIOB_STATE
LJ_chSWDT_UPDATE_DAC0
LJ_chSWDT_UPDATE_DAC1
LJ_chSWDT_DAC0
LJ_chSWDT_DAC1
LJ_chSWDT_DAC_ENABLE
Following is example pseudocode to configure and enable the watchdog:
//Initialize EIO2 to output-low, which also forces the direction to output.
//It would probably be better to do this by configuring the power-up defaults.
AddRequest(lngHandle, LJ_ioPUT_DIGITAL_BIT, 10,0,0,0);
//Specify that the Comm processor should be reset on timeout.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_RESET_COMM,1,0,0);
//Specify that the Control processor should be reset on timeout.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_RESET_CONTROL,1,0,0);
//Specify that the state of digital line A should be updated on timeout.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_UDPATE_DIOA,1,0,0);
//Specify that EIO2 is the desired digital line A.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_DIOA_CHANNEL,10,0,0);
//Specify that the digital line should be set high.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_DIOA_STATE,1,0,0);
//Specify that DAC0 should be updated on timeout.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_UPDATE_DAC0,1,0,0);
//Specify that DAC0 should be set to 4.1 volts on timeout.
AddRequest(lngHandle, LJ_ioPUT_CONFIG, LJ_chSWDT_DAC0,4.1,0,0);
//Enable the watchdog with a 60 second timeout.
AddRequest(lngHandle, LJ_ioSWDT_CONFIG, LJ_chSWDT_ENABLE,60,0,0);
//Execute the requests.
GoOne(lngHandle);
Following is pseudocode to disable the watchdog:
//Disable the watchdog.
ePut(lngHandle, LJ_ioSWDT_CONFIG, LJ_chSWDT_DISABLE,0,0);
4.3.14 - Miscellaneous
The following are special channels, used with the get/put config IOTypes, to read/write the calibration memory and user memory:
LJ_chCAL_CONSTANTS
LJ_chUSER_MEM
For more information, see the low-level descriptions in Sections 5.3.10 – 5.3.12, and see the Memory example in the VC6_LJUD
archive.
50
Summary of Contents for UE9
Page 84: ...84 ...