3
\$\begingroup\$

Most low-power applications operate in burst mode, where the system is asleep most of the time.
I don't understand how to use a watchdog (WD) in those kinds of systems.

The perfect scenario would be to wake up periodically to reset my MCU's internal WD.
The problem: internal WDs are too energy expensive (usually more than 1uA) to use while sleeping. (Assuming a CR2032 coin cell battery as a power source).

What are the strategies to use a WD in a low power system?
Use a specialized IC?
Enable WD at wakeup?

\$\endgroup\$
10
  • \$\begingroup\$ Internal WD is simple oscilator with counter a little logic only, so it draw very close to as litle as possible. You have option to make external low power oscilator and wake according to it using some sleep active pin of MCU. \$\endgroup\$ Apr 4 at 14:42
  • \$\begingroup\$ Are you looking at run-of-the-mill microcontrollers, or at specially-designed low-power microcontrollers? \$\endgroup\$
    – Hearth
    Apr 4 at 14:44
  • \$\begingroup\$ @MichalPodmanický "so it draw very close to as litle as possible" In my experience, they are rarely lower than 1uA. When they are, like for the STM8L51, the datasheet mentions typical value not tested in production. \$\endgroup\$
    – gberth
    Apr 4 at 15:03
  • \$\begingroup\$ @Hearth Specially designed. If you have any suggestion. let me know. \$\endgroup\$
    – gberth
    Apr 4 at 15:03
  • 1
    \$\begingroup\$ What is your power source? \$\endgroup\$ Apr 4 at 22:30
2
\$\begingroup\$

The watchdog has the task to monitor code execution and possibly to reset the CPU.

When the CPU is stopped, there's no reason for the watchdog to work or to be awaken.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ What about a situation where a problem would trigger unwanted endless sleep? \$\endgroup\$
    – gberth
    Apr 6 at 18:46
  • \$\begingroup\$ In this case you need an external ultra low power watchdog timer like Texas Instruments TPL5010 Nano-Power System Timer With Watchdog. \$\endgroup\$ Apr 6 at 21:35
1
\$\begingroup\$

You don't say what processor you are using but I have used the WD timer in an AVR for performing the processor wake-up.

Here is a section of my code that goes to sleep to be awakened by the WD timer reset.

When the WD expires the processor is reset and wakes up, it configures the processor as with a normal reset and disables the WD (if you wish to use the WDT to monitor your code you could leave it enabled but configure it for the timing you need during execution).

After performing the required operations it enables and configures the WD timer for the required sleep time, turns off the various peripherals not needed during sleep then sets the WD timer for a later wake up. It then goes into an infinite loop (that will never execute) until the next reset.

Although a similar behaviour can be obtained using the normal timers they require that the clocks be operating and as such the quiescent current of the system is usually much higher even if using the low power internal RC clock (varies with processor).

The power consumption during sleep was about 20-30uA in my design although just the processor itself with WD timer takes about 3uA at normal temperatures. This would be about 5 or 6 years when powered from a CR2032 lithium cell.

void power_down(void){
cli();
bit_dir_inp(LED1);          // Disable LED
ADCSRA= 0;                  // Disable ADC
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
wdt_enable(WDTO_2S);
sleep_mode();               // Power down, wait for reset
for(;;);
}
\$\endgroup\$
4
  • \$\begingroup\$ So you're abusing the watchdog as a completely normal timer, this is not what OP asks about. Your use of the watchdog is the complete opposite, since you turn it off during the time that it's supposed to be used - guarding against logic bugs in your firmware. \$\endgroup\$
    – pipe
    Apr 4 at 22:17
  • \$\begingroup\$ @pipe - I was not using it during active operation but there is nothing stopping you using it for both purposes in the same piece of code. \$\endgroup\$ Apr 4 at 22:20
  • \$\begingroup\$ HI @KevinWhite. I'm sorry about my naive question, but I'm not sure I understand your point. Why would you only activate your watchdog in sleep and not while your application is running? Your 5 or 6 years estimate seems right to me, assuming I sleep 99% of the time and I don't do any expensive while running. \$\endgroup\$
    – gberth
    Apr 6 at 18:53
  • \$\begingroup\$ @gberth - I'm using the watchdog as the wakeup timer. I'm not using it for protection during execution. There is nothing stopping it from being used for both purposes. With the AVR I could get lower quiescent current this way rather than using a normal timer that would require the cpu clock to be running during sleep. \$\endgroup\$ Apr 6 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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