Adding a watchdog timer to the Lynx10 kit

 

 

1.   General

Ever wonder what to do with the empty right side of the Lynx10 kit board? Well, how about increasing the robustness of your home automation system by immunizing it to software lockups, operating system crashes, brownouts and hardware freezes.

This document describes a modification (actually addition) to the Lynx10 kit. The addition, called a watchdog timer, resets the PC if no X-10 commands were transceived in the last 4 minutes. In conjunction with a routine that sends a dummy X-10 command if no command was tranceived in the last 3 minutes, this device guarantees that the software is alive, that the Lynx10 is working, that the TW523 is tranceiving, that the operating system is running and that the PC is not frozen. If any of these or related cases occur, the watchdog ‘pushes’ the PC reset button.

 

Pros of the Lynx-10 watchdog timer:

1.      Very, very cheap. The parts cost around $2. Compare this to commercial PC watchdog timers by Adicon (makers of CPU-XA) that costs  $100 and up. 

2.      Directly uses signals and power from the Lynx-10 kit. Thus there is no need for any other PC resources: com-port, slot, IRQ, power plug, space. Everything that’s needed is already on the Lynx-10 kit board.

 

Cons:

1.      The reset is a hard reset (warm boot), identical to pushing and releasing the PC reset button. No questions asked. No graceful shutdown. No NMI sent. Some NT machines may not like this. My win95 never had any problems with this.

2.      The expiration time is ‘hard-coded’ by resistors. It’s not changeable thru software.

2.   Principle of operation

Because the Lynx-10 kit includes most everything that’s needed, the watchdog timer uses only 3 active components:

  • 4060B – a binary counter IC used to send a very slow square waveform, with a half-period of about 4 minutes.
  • 4093 – a quad-nand IC used for some logic.
  • A NPN transistor – used to make the hard reset. I used BDX53 (a huge overkill, but that’s what I found lying around). Any NPN should be fine for this.
  • R1 – 330K
  • R2 – 300K
  • R3 4.7M
  • C1 - 47nF
  • C2 – 0.2uF

 

Figure 2‑1 shows the schematic of the watchdog timer.

 

 

Figure 21: Schematic of Lynx10 watchdog timer

 

When there is no X-10 activity, The Lynx-10 RX LED voltage is low. This is true for both transmission and reception since all transmitted commands are immediately received by the TW523. Thus the reset port of the 4060B (4060:12) is at low and the 4060 is counting. Any activity on X10 flashes the RX LED, which in turn generates a rise-fall pulse on the 4060 Reset pin and the 4060 restarts the count. The line could equally be connected to the BUSY LED.

 

The expiration period of the watchdog is set by the combination of C1 and R1 according to the formula:

If the RX LED does not flash within the watchdog expiration time, the 4060 raises its pin 3 (4060:3), lowers N3:10 and raises pin N4:11. This in turn generates two events:

  • BDX pin 1 is raised and the transistor conducts, and shorts the PC reset terminal, which begins a warm reboot. This is equivalent to pushing the reset button.
  • Pin N3:10 lowering slowly lowers pin N2:6 due to R3, C1 loading. After about 2 seconds pin N2:6 is lowered, pin N2:4 is raised and this raises the 4060 reset (4060:12). Raising the reset lowers the 4060 pin 3, which in turn raises pin N3:10, lowers pin N4:11, stops BDX53 conduction. This is equivalent to releasing the reset button.

 

Thusly this is a self-terminating pulse:

4060:3 Rise (due to the watchdog timer expiration)

N3:10 Fall (slowly, due to  R3/C2)

N2:6 Fall

N2:4 Rise

4060:12 Rise

4060:3 Fall (due to the 4060 reset rise).

 

The time length of this loop determines the length of the reset push (the time between depression and release of the reset button). It can be varied by changing the values of R3 and C2.

 

Finally, a manual switch or jumper is added to the output of BDX53 so that the watchdog could be disabled for times in which the Lynx10 routine responsible for the watchdog reset is not active.

3.   Implementation

Figure 3‑1 , Figure 3‑2 and Figure 3‑3 show the layout of the watchdog timer on the Lynx-10 board. If the resistors and caps look abnormally large, it’s because they are. There is absolutely no need for such large ratings. They just happened to be around. There is no special reason for the sockets either.

 

The 4093 IC is lined north of 4060B and I ran the wire tracks parallel to the ICs first and then shorted on the backside of the board the perpendicular lines to the IC pins. My kit board sits inside the PC on the floor of the box. This makes accessing the PC reset switch easy.

 

The hook to the PC reset switch wire pairs is in parallel to the wire pair.

 

Figure 31: Layout of the lynx10 watchdog timer

 

Figure 32: layout from LED edge looking towards connector edge

Figure 33: Layout from Lynx10 side looking towards bredboard side

 

Switch

Give this point a little thought. I started with a simple jumper, but then it occurred to me that on my PC the front panel Turbo switch is unconnected to anything. My board doesn’t support the ancient frequencies. This switch also toggles a front panel 7 segment LED display between two states, that on my PC displayed HI/LO. Finding this, I connected the switch to the Lynx10 watchdog timer and modified the jumpers on the LED panel to read OF/On.

4.   Application notes

Dummy commands

The Lynx-10 command sent for the watchdog reset is a dummy command in that it’s not intended to operate an X-10 receiver module. So as not to waste an X-10 address you can send a command to a module that will not respond to it. Some examples: sending an OFF command to a chime module; a dim command to a universal or appliance module; an “All Lights OFF” to a house code that doesn’t have lights etc.

Software changes

There are several events when the software must support the watchdog timer:

  • When the software initially loads, it needs to send a watchdog command, since this could be after a reboot.
  • If there is no watchdog command scheduled, (e.g. one was just executed), schedule a watchdog command 3 minutes from now.
  • Whenever a command is sent or received, reschedule the watchdog timer 3 minutes from now.
  • Finally, if your software keeps a log of commands, you might want to considering excepting logging of the watchdog command as it happens often and does not hold much info (no real module changes state).

 

Timer expiration options

The expiration time can be set from minutes to hours based on the formula in the equation above. The other outputs of the 4060 are derived from binary division of the base frequency that comes from pin 7 of the 4060. Each of the following pins have a frequency half that of its predecessor:

Pin 7, 5, 4, 6, 14, 13, 15, 1, 2, 3. The last one is used in the Lynx-10 watchdog timer. However, the others are available from these pins.

 

Copyright ã 1999 Ido Bar-Tana