Teensy 3.1 runs for 27-37 msec, then...

Status
Not open for further replies.

AleXYZ

Member
I'm using a Teensy 3.1 and running a simple program using the NeoPixel library. On the board I have a push button soldered to the RESET* pin on the bottom of the board. I have a Tektronix scope connected to Pin 6 which is the assigned output for the NeoPixel library. No other hardware (except USB cord) is connected.

Programming the Teensy works just fine. But...

I have to press the RESET button (no, not the Program button, I know the difference!) on average about 15 times -- no exaggeration -- before the program will run and keep running. The other 14 times, the program runs for between 27 to 37 milliseconds according to the scope and then it just hangs. My program does not implement watchdog or any other feature I can think would cause this behavior.

When it does run, the program runs happily for hours... until I pull the power or press the RESET button.

Any ideas what is going on?
 
Tried this using a minimal program like blinky? Work from simple to complex until you see the problem?
 
Stevech ---
Well... you are right, I needed to go back to some Basics. What I found was that the setup() routine needed a delay(100) in it, otherwise the intermittent failure behavior happened most of the time. With the delay, it seems to reset properly (almost) every time.

Is there something that happens during initialization in the Teensy hardware that needs this delay?
 
If you have this anywhere in the code (setup or not)
Code:
while !(Serial) ;
it can hang now and then, I've read, varying by what the host PC is doing.

In my code, I use, instead of the above, delay(5000);
to give me time to open a serial terminal window if I wish to, and also to avoid the intermittent race condition with the host PC establishing the USB handshakes.

Your issue may be unrelated.
 
Last edited:
Status
Not open for further replies.
Back
Top