Using TPL5110 as Watchdog

Started by designDemon, October 02, 2018, 09:59:16 AM

designDemon

Hey

I want to use the tpl5110 as an external watchdog which can
cycle power if the MCU freezes and is not able to send the done
signal within the set delay period.

However, right now when the MCU is running the done signal
is causing the tpl to switch off the MCU for the remainder of
the delay period and power it on subsequently.
How do I prevent this?

Rgds
Karan

Felix

You set a TPL timeout with the resistors.
When the timeout expires you get a quick power-off and power-on. That is equivalent to a reset, except power is cutoff for a brief time, see datasheet.
If you assert DONE sooner (the normal case) then power-off happens at that time, and power-on resumes at the start of the next cycle.
If your system needs to keep some device/timer ON all the time then this might not work, or you might need to keep power on separately to that device/timer.

TomWS

#2
Quote from: designDemon on October 02, 2018, 09:59:16 AM
I want to use the tpl5110 as an external watchdog which can
cycle power if the MCU freezes and is not able to send the done
signal within the set delay period.
The TPL5110 is a different function than the TPL5010 Watchdog timer. 

Think of the TPL5110 as a super low power timer that keeps your main function turned completely OFF until a set time has elapsed.  Once that time has elapsed, the TPL5110 will power up your main device, which does whatever it is supposed to do and then literally signals 'Done' to power itself off.  Consequently the only time there is any measurable power drawn on your battery is the brief time your function is active. 

It really can't be configured conveniently as a Watchdog.  The TPL5010, however, is an excellent Watchdog, resetting your device if it doesn't keep signalling 'Done'.

Felix

I would also recommend the TPL5010 if you are REQUIRED to have your device always powered or only want the pure reset and not power cycle.

My previous statement about an MCU/timer is technically incorrect because normally a MCU even if only reset, would also reset any timers so there is no advantage in that case with the TPL5010.
BUT to me, practically, a pure reset and a power cycle "reset" are basically the same thing.

The 5010 watchdog is still on a timeout cycle. The difference is that it does not ever cut power off for power saving purposes, so it does not interfere with what the MCU is doing, it only issues a RESET to the MCU RST pin if timeout expires before a DONE signal (ie watchdog "clear/reset") is received.

I would call the TPL5110 a timer and a pseudo-watchdog. If your MCU cannot be powered down for power savings, then yes, the 5110 cannot be used as a watchdog.
You can use its ability to power your device off and back on, as a fake "reset".
Your device is supposed to signal DONE within the timeout period - this is the normal case where the device does not lock up and is able to finish the task long time before the timeout.
If the device becomes unresponsive and the timeout expires, then the TPL5110 will power cycle it ("reset" it). So inherently it's a sort of (improper) watchdog.

designDemon

The atmega1284  has an internal watchdog,
but when we were testing it for its reliability, we noticed
that if we externally short the SDA pin when i2c is live,
the uC freezes and the internal watchdog stops
working and only an external reset solves this problem.

So we started looking for an external watchdog to pre-empt
this case in our production devices.

Recently, we also encountered a case where not even a reset
and only an external power cycle would "unfreeze" our micro-
controller.

(in both the above cases we are quite sure that it was not
a firmware level bug and the watchdog function was indeed
enabled and initialised)

So we were looking for an external watchdog solution that
could power cycle our device incase it froze in the production
environment and stumbled upon the tpl5110 and tpl5111, and
were happy to see that LPL had a breakout board for it.

Are you guys saying that the normal watchdog function where
the watchdog timer resets ( or power cycles in the case of 5110)
the uC if an "all OK" pulse is not received before there
is a timeout, is not achievable with the 5110? Because, currently
the done signal is not only reseting the timer (which is desirable)
but is also turning the uC off. Ideally it should have
kept the uC on, reset the timer, and only if the done signal was
not received, initiated a quick power cycle to reset the uC.

I'm evaluating the 5010, but it still doesn't solve the case where
a power cycle might be necessary.

Thanks for your replies
Karan

Uncle Buzz

Quote from: designDemo
Are you guys saying that the normal watchdog function where
the watchdog timer resets ( or power cycles in the case of 5110)
the uC if an "all OK" pulse is not received before there
is a timeout, is not achievable with the 5110? Because, currently
the done signal is not only reseting the timer (which is desirable)
but is also turning the uC off.

As Felix and Tom said,  the TPL5110 will powered your MCU only from a periodic start, until the"done" signal from the MCU, telling it has finished its job.

If you need a power off/power on cycle when the MCU is not responding, maybe you could use the TPL5010 but instead of driving the reset pin of your MCU, you could drive the gate of a mosfet to cut of the power suply of your MCU a short time ? I don't know if the pulse is long enough to completely shutdown your MCU

TomWS

Quote from: Uncle Buzz on October 03, 2018, 10:08:07 AM
I don't know if the pulse is long enough to completely shutdown your MCU
I believe the reset pulse width is 350mS.

TomWS

Quote from: designDemon on October 03, 2018, 04:56:16 AM
Are you guys saying that the normal watchdog function where
the watchdog timer resets ( or power cycles in the case of 5110)
the uC if an "all OK" pulse is not received before there
is a timeout, is not achievable with the 5110? Because, currently
the done signal is not only reseting the timer (which is desirable)
but is also turning the uC off. Ideally it should have
kept the uC on, reset the timer, and only if the done signal was
not received, initiated a quick power cycle to reset the uC.
The TPL5110 is really a very low power timer and it would take an 'unnatural' act to get it to operate as a watchdog.  It's purpose is to power on a circuit for only a brief amount of time where 'Done' signals termination of that power cycle with a safety margin guaranteeing a power off if Done isn't signaled by the next interval.
Quote
I'm evaluating the 5010, but it still doesn't solve the case where
a power cycle might be necessary.
I would recommend the 5010 for your application.  For your needs, as @Uncle Buzz suggested, I'd use the Reset pin on the 5010 to drive the gate of an N channel FET (rather than MCU reset), which, in turn, drives a P channel load switch. 

On power application, the Reset pin will be low and ensure that Power is not applied to the rest of the circuit until the 5010 initializes, then, the load switch will be turned on (assuming a pullup on 5010's Reset pin) and your circuit will be turned on.

From that point on, the 5010 will generate Wake signals, which, in your case, maybe can be ignored.  However, as your circuit loops normally, it should pulse Done at least once within every time interval (and once on startup).  If this is missed, then Reset will be pulled low turning off power to your MCU circuit for about 350mS.

Tom

Felix

I would too use a 5010 and if you want to ensure it's back up after a freeze, use the FET method suggested above.

To rephrase ... the 5010 will issue a hard reset, but not cut power (well unless you do the little hack to drive a FET instead of the MCU's RST pin).
The 5110 will always cut power (when DONE is received, or at timeout expiration). Probably in a lot of cases cases that's not acceptable, and normally the MCU has to keep going. In that case use the 5010.

designDemon

Thanks for this guys.

Quote from: TomWS on October 03, 2018, 10:50:44 AM
I would recommend the 5010 for your application.  For your needs, as @Uncle Buzz suggested, I'd use the Reset pin on the 5010 to drive the gate of an N channel FET (rather than MCU reset), which, in turn, drives a P channel load switch. 

I am quite the rookie here. I would be grateful if you recommend a FET and sketch a
rough schematic here. For the load switch can I use this -
https://www.diodes.com/assets/Datasheets/DMP2045U.pdf ?

It is the suggested replacement for the one that is used in the current 5110-breakout.

- Karan

TomWS

#10
Quote from: designDemon on October 04, 2018, 03:28:06 PM
I would be grateful if you recommend a FET and sketch a
rough schematic here.
For a quick sampling, here is a snip from one of my schematics. 

The part is a two transistor device from Vishay, Si1869DH.  A complete loadswitch.

VBAT (TPL5010 VCC) should be connected to pin 4 of the loadswitch.  Pin 5 (N channel gate) is tied to TPL5010 Reset pin and also needs a pullup to VBAT (value is arbitrary 10K-200K range).   And your MCU power is driven by pins 2 & 3 of Q1.  They're connected internally, but I'd tie them together on the PCB as well.

UPDATE: Sorry, R27 in the schematic should be set to a high value resistor since it is normally always in conduction.  3-10Mohm is probably ok but check the datasheet for pin 6 leakage current so you can guarantee that the loadswitch will turn off properly.

designDemon

#11
Hey Thanks so much TOM

is this schematic OK?
I've connected the wakeup pin to the interrupt pin d10
and the done is a GPIO. The jumpers are just in case
I decide I don't wish to power cycle.


I've replaced the vishay mosfet with tps27081a from TI,
as the prior wasn't available.

In the datasheet there is something about the slew rate
and selecting the R2 at the source and the C at the output
(depending on capacitive load). Will that be important in my case -
which is basically a moteino mega connected to 4 i2c slaves?

TomWS

#12
Quote from: designDemon on October 05, 2018, 09:10:41 AM
is this schematic OK?
The schematic is fine, but you might want to increase the value of R25 (10K) to at least 100K or more.  That resistor will be conducting most of the time and will affect your battery life.
Quote
I've connected the wakeup pin to the interrupt pin d10
and the done is a GPIO. The jumpers are just in case
I decide I don't wish to power cycle.

That arrangement should work fine.
Quote
I've replaced the vishay mosfet with tps27081a from TI,
as the prior wasn't available.
The TI part is similar, but I think the Vishay part is a slightly smaller footprint (SC70-6).  In any case, the TI part will work fine.  You could make a combo SOT23/SC70 footprint on the PCB so you could use either part.  Felix did this on his SOT23 breakout board and it works fine.
Quote
In the datasheet there is something about the slew rate
and selecting the R2 at the source and the C at the output
(depending on capacitive load). Will that be important in my case -
which is basically a moteino mega connected to 4 i2c slaves?
If you were switching a high capacitive load then slew rate would be very important.  As it is, the slew rate is probably ok since you're effectively clearing the entire device on timeout.

Tom
UPDATED: to correct footprint information.

designDemon

Thanks for your reply tom.

W.r.t the very valid point that you made here:

Quote from: TomWS on October 05, 2018, 03:19:52 PM
The schematic is fine, but you might want to increase the value of R25 (10K) to at least 100K or more.  That resistor will be conducting most of the time and will affect your battery life.That arrangement should work fine.

There is a note in TIs datasheet:
"TI recommends maintaining RR1 > 10 × RR2. The higher value of resistor R1 minimizes
quiescent current when PMOS is on, however, the higher value may adversely impact
OFF-state leakage current. Refer to the load current (ILOAD) specifications in the Electrical
Characteristics table.."

Doesn't this mean that if I use a very high value my off-stage leakage current will be negatively impacted?

Although I don't know how that will actually happen, because the electrical characteristics table that they are referring to has specified leakage currents in the sub uA range for a 10k value I thought 10k should be good enough. What do you say?

Also, I am not specifically driving a capacitive load but is there a threshold value for the effective load capacitance where considering the slew rate becomes important? Then I'll measure the effective load cap and if I am somewhere near the threshold then I'll include provisions for adding the R and C as per the proposed dchematic.

Rgds
Karan


TomWS

#14
The Off state leakage current will only be a factor if it is so high the drop across R1 doesn't allow turn off.  In your case, this would have to be more than 10uA for 100K R1.   Further, Off State leakage is not a battery life concern, the switch is only off for 350mS.  The ON State current drain of R1 is significant, however as this will be a constant 3.3V / R1.

Re Slew Rate control, it is a good practice to evaluate your capacitive load and adjust accordingly, but you should select values based on desired Slew Rate AND your select R1.
UPDATE: By this I mean, R1 will affect your Turn Off time.  Select C value based on the higher R1 value and desired Turn Off time, keeping in mind that the objective is to completely drain your MCU circuit in the alloted 350mS.  Once you've chosen C value, THEN you can select an appropriate R2 value to achieve the desired Turn On Slew rate.  In this calculation, bear in mind that the effective 'R' value is R1 & R2 in parallel (which I think is already factored into their calculation).