Cannot reprogram after waking from Snooze.hibernate or Snooze.deepSleep

Status
Not open for further replies.

birostris

New member
Hey there, I'm using the Snooze library on a Teensy 3.2 and trying to save power when off by using the Snooze library. My code goes to sleep, then wakes up successfully via a pushbutton interrupt.

When I use Snooze.deepSleep or Snooze.hibernate, I can't re-program the Teensy unless I do a hard reset by disconnecting power, despite the program resuming successfully (LEDs turn on, etc.).

When I use Snooze.sleep, I'm able to reprogram without the hard reset as normal even after waking from sleep, but the power usage savings in this mode isn't good enough.

I know deepSleep and hibernate use the VLLSx modes. Is there something about these modes that prevent me from reprogramming after using them? If so, how can I reprogram without the power disconnection? I'm using a battery and in an enclosure, so in production this is an issue.

Thanks!
 
Last edited:
Possible fix by hardware: add a transistor/mosfet switch for powering the Teensy. Use pullup/pulldown to have it switching by default, then override the gate from a Teensy pin? So you could implement a reset, e.g. when you continue holding the pushbutton 2 more seconds after wakeup...
 
Thanks for the idea! I haven't tested it, but sounds like it might work. However, it has been a while, and we've since decided to move forward in another way.

We ended up adding a second "program" button to the design, attached to the Program pin on the teensy. We went with this because it was easier to think about and test with the components on hand.

One note is that entering bootloader mode causes the program to halt and requires intervention from a computer or cycling the power. So, we wanted to prevent an accidental press of the button from entering bootloader mode. We decided to wire up the buttons so that you have to press the normal input button and the program button at the same time to enter the bootloader mode.
 
I know deepSleep and hibernate use the VLLSx modes. Is there something about these modes that prevent me from reprogramming after using them? If so, how can I reprogram without the power disconnection? I'm using a battery and in an enclosure, so in production this is an issue.
I know, you moved on with another solution.
One observation I made is that (Windows) PC's can behave very strange when USB disappears. I cannot tell which side is not implementing all possible error handling, but I have, when developing, to remove regularly my teensies from PC (resetting power and communication) to allow downloading. I'm not able to nail the issue down, but it exists.
 
I know, you moved on with another solution.
One observation I made is that (Windows) PC's can behave very strange when USB disappears. I cannot tell which side is not implementing all possible error handling, but I have, when developing, to remove regularly my teensies from PC (resetting power and communication) to allow downloading. I'm not able to nail the issue down, but it exists.

It turns out that the cause of my teensy not being programmable was due to the bootloader chip going into low power mode after entering deep sleep and not coming back even when the processor woke up from an interrupt. As is mentioned in this thread, the bootloader will only come back with a power cycle or when the program button is pressed.

In my particular case, I am getting power from a battery, so unplugging and replugging in the teensy doesn't actually turn it on/off. Hence the alternative solutions. Throwing hardware at the problem might not have been the most elegant, but I'm glad the problem was solvable.
 
Status
Not open for further replies.
Back
Top