1
\$\begingroup\$

We have a CPU, and then several IO expanders. When the watchdog timer expires, we need the IO expanders to go into reset (inputs) instantly, otherwise bad things will happen if they stay configured as outputs.

If we do trigger a watchdog timeout, we would ideally like to dump our stack traces to either USART or USB filesystem. We need time to do this, however.

My current plan is to have an external chip control the watchdog timeout, the output of that chip goes to the IO expander ~RESET line, as well as a GPIO on the CPU. On the CPU, we will generate the highest priority interrupt, and use that to log the data, then preform a software reset (done by setting a bit in a register). However, if we're in a critical region on the CPU, and that critical region is where the software issue is, we might never to the logging section.

Ideally, we would have a delay (say, 2-3s) between the watchdog output going low, and the CPU power-on-reset line going low for a short pulse. That way if the CPU actually resets, it will disable the watchdog timer (via the enable pin which is active high and pulled low) and then the IO expander reset line will be cleared. If the CPU does NOT reset, then it forces a full POR.

I am OK with the CPU POR line pulling the IO Expander reset line low, which I figure I can accomplish with just a standard diode (cathode on CPU POR).

schematic

simulate this circuit – Schematic created using CircuitLab

I'm thinking about maybe using a 555, or an RC delay circuit. The accuracy of the timing isn't really important, because it's just saving someone from having to come click the reset button.

Is there a better way to do this? Or will a 555/RC delay work just fine.

(Watchdog timer MAX16997 datasheet)

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I've some experience of similar cases where we solved it by adding a big supercap to hold the line high while everything is getting handled. Pros: simple. Cons: the voltage will slowly drop and not necessarily in a linear way. But if you have something with Schmitt trigger on the other side, then it might be an option. \$\endgroup\$
    – Lundin
    Oct 2, 2023 at 14:36
  • \$\begingroup\$ "When the watchdog timer expires, we need the IO expanders to go into reset (inputs) instantly, otherwise bad things will happen if they stay configured as outputs." Why do BAD things happen if the the I/O expander outputs stays in the same state ? Can you stop these bad things from happening in the first place ? \$\endgroup\$
    – citizen
    Oct 2, 2023 at 15:19
  • 1
    \$\begingroup\$ @citizen it's an industrial controller and we might have metal moving at 500ft/min. Forcing the IO off means that the output enable to the servos is disabled, any shears are stopped, etc. \$\endgroup\$
    – Shaken_U
    Oct 5, 2023 at 13:04

1 Answer 1

1
\$\begingroup\$

A 74HC123 Dual Monostable IC (or a derivative) is at least as cheap as a 555 but more flexible as each monostable can be edge-triggered.

The below diagrams are taken from the Texas Instruments datasheet for it.

For your circuit, you can use MONO1 to produce the delay between watchdog timeout and the reset, then use MONO2 to produce the reset pulse. The widths of each pulse is controlled by its R-C pair.

To do this, trigger MONO1 from your Watchdog Timer output, driving /1A with it and tying `1B' HIGH. MONO1 will produce a positive pulse on its '1Q' output. This is your delay period.

Then connect 1Q to /2A' and tie 2B' HIGH. MONO2 will trigger on the 1Q falling edge, at the end of the delay period. A MONO2 output can go to your CPU circuitry as your reset (2Q for active HIGH, /2Q for active LOW). The MONO2 pulse period is the reset pulse period.

Remember to connect monostable resets /1R and /2R to a power-up reset source. Another R-C circuit can do this, with a clamp diode across the resistor, but a cheap power supervisor reset IC is a better option.

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This is a much better solution than a 555 IMO, and is likely never going to be obsolete. Thanks! \$\endgroup\$
    – Shaken_U
    Oct 2, 2023 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.