Teensy microcontroller functions on poweron from external source

Peasant

New member
Hello All,

Currently, I am working on a project that is semi-confidential, so I can't show code snippets, but I am using a Teensy LC (for reasons that are definitely not my fault, my teensy 4 burnt out 😳 - or I don't know how the on/off pin works well. either way, I am on the LC now) and am powering the Teensy LC on from an external source (a 4.2-3.3v lipo).

When power is recieved, it seems like the teensy is resuming operation from where it last was (the middle of void loop) rather than running void setup and then moving to void loop. Is this expected behavior, or is there something I can do to make the device run void setup after power-on?

My current idea for a solution involves using a voltage divider connected to an RC timer circuit so that I can use an analog pin at some voltage less than 3v to read the startup in void loop and then trigger a software reset using the SCB_AIRCR = 0x05FA0004; method, but I would much appreciate being able to instead handle this issue in software instead of having to find a capacitor that matches the time needed for the teensy to start across all of 4.2-3.3v.

my other potential solution involves using millis() to check how long it is since the device was powered on, and use the same software reset listed above on it when the time is less than maybe 1000ms. If I am right about execution continuing from where it left off though, I don't believe this would work (within 50 days at least, iirc. micros() would be better at like 2hrs though, lmao).

For context, I am using an I2C peripheral (a version of the SSD1306) that requires a signal from a teensy to restart, which I have built into void setup, as the restart takes about a second and I am looking for continuous screen functionality.

Thanks in advance, whoever gets this!
 
I think you might have a circuit problem. 4 x Teensy 4 burnt out, Teensy LC not working properly!
Power removed from 5V, assuming you don't have smoothing capacitors, re-apply voltage WILL start from SetUp.
 
I think you might have a circuit problem. 4 x Teensy 4 burnt out, Teensy LC not working properly!
Power removed from 5V, assuming you don't have smoothing capacitors, re-apply voltage WILL start from SetUp.
Thanks for the response BriComp!

the burnt out teensy 4. was entirely due to me not having good soldering tools and getting it too hot manually. It did work fine prior to that, and the issue with the teensy 4.0 I don't believe is with the circuitry.

The Teensy LC is working great in the circuit however, it just doesn't seem to be running setup. I am going to do some more investigating with serial.print()s and my multimeter, but I will say I don't believe the issue is with the circuitry.

that said, at your advice I will do my due diligence and check the circuit again. Thanks for the reply!
 
Alright, so...

I added a slightly longer delay before trying to initialize my sensors, and now everything works.

Thanks again to everyone who read this and thanks to you BriComp for taking the time to reply. All I really wanted to get from this was figuring out whether or not teensys power-on to setup, and you answered that excellently. That my circuit works now is even better. Thank you once again. I truly appreciate the reply.
 
Back
Top