Hi,
My current Teensy 3.2 project is powered by 2 AAA batteries, which provide somewhere between 2.5 and 3 volts. Less than it's supposed to be, I know. And yet it all pretty much works.
However I'm sometimes seeing a curious problem with waking from sleep. Using the Snooze library, the teensy calls deepSleep() when idle. It wakes up every 5 seconds using a SnoozeTimer to check for activity (via SnoozeDigital), and goes back to sleep otherwise. And that works, even running from AAA batteries.
The curious problem is this: if I let the batteries run all the way down while Teensy is sleeping, then Teensy doesn't wake from sleep even after I put in fresh batteries. It doesn't even wake from sleep if I plug it into USB power! It's been completely powered down, and yet it won't reboot when power comes all the way back on. It's either completely hung or SnoozeDigital isn't seeing the pin activity so it's staying in the sleep loop. The only way I can unjam it is by reprogramming it.
How does my Teensy end up jammed in a way that a cold reboot won't fix? Is there some kind of watchdog reset that can guard against this?
Thanks,
-mykle-
My current Teensy 3.2 project is powered by 2 AAA batteries, which provide somewhere between 2.5 and 3 volts. Less than it's supposed to be, I know. And yet it all pretty much works.
However I'm sometimes seeing a curious problem with waking from sleep. Using the Snooze library, the teensy calls deepSleep() when idle. It wakes up every 5 seconds using a SnoozeTimer to check for activity (via SnoozeDigital), and goes back to sleep otherwise. And that works, even running from AAA batteries.
The curious problem is this: if I let the batteries run all the way down while Teensy is sleeping, then Teensy doesn't wake from sleep even after I put in fresh batteries. It doesn't even wake from sleep if I plug it into USB power! It's been completely powered down, and yet it won't reboot when power comes all the way back on. It's either completely hung or SnoozeDigital isn't seeing the pin activity so it's staying in the sleep loop. The only way I can unjam it is by reprogramming it.
How does my Teensy end up jammed in a way that a cold reboot won't fix? Is there some kind of watchdog reset that can guard against this?
Thanks,
-mykle-
Code:
uint powerNap(){
uint who = 0;
// Head towards deep sleep:
// turn off LEDs
digitalWrite(led1Pin, LOW);
digitalWrite(led2Pin, LOW);
delay(100);
// sleep accelerometer
imu.sleep();
// attach to buttons for button wakeup
s_config += s_digital;
do {
// sleep N seconds or until right button wakes us
who = Snooze.deepSleep(s_config);
awakePinState = digitalRead(PO_wake);
btn2.update();
} while (awakePinState == LOW && (! PRESSED(btn2)));
// detach from buttons
s_config -= s_digital;
// wake accelerometer
imu.wake();
// update button state for next loop
btn1.update();
btn2.update();
// LEDs will be restored on next loop.
awakeTime = 0;
return who; // loop again!
}