Teensy 3.2 won't wake from deepSleep after low battery is replaced

Not open for further replies.


Well-known member

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?


uint powerNap(){
	uint who = 0;
	// Head towards deep sleep:

	// turn off LEDs
	digitalWrite(led1Pin, LOW);
	digitalWrite(led2Pin, LOW);

	// sleep accelerometer

	// 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);
	} while (awakePinState == LOW && (! PRESSED(btn2)));

	// detach from buttons
	s_config -= s_digital;

	// wake accelerometer

	// update button state for next loop

	// LEDs will be restored on next loop.

	awakeTime = 0;
	return who; // loop again!
What happens if you take the battery out and replace it before it locks up? I appreciate that you do not know exactly when it locks up.

On a project I am working on I will be using one of the items mentioned in the link below. When the battery voltage gets down to circa 3v (still providing 5v to teensy) I will be going into Hibernation mode until the battery is charged up again or replaced.
Not open for further replies.