Teensy Not Starting Without USB Monitor

Status
Not open for further replies.

Ausplex

Active member
Hi, I have just put together a small project using Teensy 3.2 with Arduino. The Teensy is powered by a 3.7V LiPo, and the PCB trace has been cut to remove the USB bus power.

The problem is that my sketch will not run unless I have plugged the Teensy into the USB port and have started the Serial Monitor. If I remove the USB plug it then continues to run. However if I power up the project without the USB connected, the sketch simply doesn't run.

Is this because I am using serial.println functions within my sketch ? I don't want to have to remove these as the project is still in development, but I need the Teensy to run standalone without a computer connected to the USB port.

Help appreciated.

thanks
 
Hard to say without seeing the code. My first guess is the same as Paul mentioned.

In cases like this I would maybe do some debug stuff, like is the function setup begin called? I would maybe add something like:
Code:
pinMode(13, OUTPUT);
for (uint8_t i = 0; i < 10; i++) {
    digitalWrite(13, !digitalRead(13));
    delay(250);
}
Then run your code and see if you get like 5 blinks of the LED... If so you know that setup is begin called. You can then move that code farther into your setup code to see if your code gets there... Obviously if you are using pin 13 for SPI or Audio or ..., you may be limited on where or if you can do this... Alternatively I use other unused IO pins for similar things and either hookup to Logic Analyzer or to some external LEDs or...
 
The other common "not starting" problem involves code which is actually starting, but too soon. When you upload from Arduino, the power has already been powered, so other hardware is already up and running. But then you cold boot and that hardware needs time to start up. A common problem is code that doesn't wait for other hardware to start up, or doesn't check if it was running and initialized properly. Without that hardware to show results, every indication is Teensy didn't start up, when it fact it did but you can't see any results.

Blinking the LED as Kurt suggested is the first step to really see what's going on. But if you're initialing the hardware from a C++ constructor, consider it will run before setup().

But this is just a blind guess, and maybe not even a good one. This problem used to be really common, until we added a 400 ms second delay in the startup code. Most hardware manages to start up within 0.4 seconds, so this problem isn't nearly as common as it was years ago.
 
Thanks Paul,

We continued the development on the project, ignoring the issue and stayed connected to the USB. The problem still existed when we disconnected the USB. After quite a bit of further development work we started testing without the USB connected and it all worked fine this time. We can't quite pinpoint anything we did, but now there is more hardware on I2C that has been added and perhaps their was some timing issue that no longer exists.

Thanks for your post. Very happy with the Teensy, and we are going to develop a product with it as the core.
 
Status
Not open for further replies.
Back
Top