Teensy 4.0 doesn't start without USB connected

cezarg1410

New member
Hello,
i have a project with Teensy 4.0, can bus transceivers and ESP32.
The point is to get some data from CAN using teensy and pass to ESP32 to send it to the internet.
I have connected Teensy with ESP using Teensy Serial2 and ESP32 Serial1 (pins 7 and 8 on Teensy board)

The problem is: Teensy can't boot without USB plugged in. What am i doing wrong?

Here is the Teensy code:

Code:
#define HWSERIAL Serial2

void setup() {
  HWSERIAL.begin(115200);
  delay(1000);

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

}


void loop() {
  HWSERIAL.write(">33950313020301AF019C19F902209A5000<");
  delay(300000);
}
 
Programmed your code onto a Teensy 4.0 using Arduino 1.8.19 + Teensyduino 1.57.

When I power cycle the board, here is the startup my oscilloscope sees in the first 2 seconds:

file1.png

red = 5V power from USB
blue = 3.3V power
yellow = pin 8 (TX2)
green = pin 13 (LED)


Here is a zoomed in capture of the moment the LED turns on and TX2 begins transmitting

file2.png
 
Definetely my knowledge is too low to understand what are You trying to say me - if You could be more specific - i would be very grateful.
Forgot to mention - i have cutted the power from USB - so the board has power only from the external source.
 
Ok i probably understood.
Your osciloscope is saying that it really works.

Fun fact: i've just noticed that it works when i completely unplug the power and plug it again. It doesn't work when i just press the reset button on Teensy. But with USB cable i can use that button and that's fine :)
 
Here is test setup on my workbench. No USB. Power is from a 5V power supply.

powerup.jpg

Yes, you can see in the waveforms the 5V power turns on and then almost immediately (in the 2 second scale shown) the 3.3V power turns on, then about 0.3 seconds later (1.5 of the divisions on the horizontal grid - this scale is 200ms per div) setup() function starts running and TX2 goes high because Serail2.begin() ran. Then you can see 5 divisions later, due to the 1 second delay in the code, pin 13 goes high and TX2 starts transmitting data.
 
It doesn't work when i just press the reset button on Teensy.

The pushbutton on Teensy is Program, not Reset. Pressing the pushbutton causes your Teensy do go into programming mode. It does NOT cause Teensy to restart your program.

But if you have USB connected and Teensy Loader is still running on your PC, and if Teensy Loader is still configured in Auto mode, when you press the button and Teensy goes into programming mode Teensy Loader will erase and reprogram your Teensy and restart it with the freshly programmed code. If you're not viewing the Teensy Loader window, it's easy to believe the button caused your Teensy to restart running your program. But if you watch that small Teensy Loader window, you can see the real story is pressing the button causes Teensy to go into programming mode and it's only restarting your program because Teensy Loader happens to be running on your PC and Arduino IDE configured it to automatically reprogram your board.

If the USB cable isn't connected, or if Teensy Loader is no longer running on your PC, or if you just turn off its Auto mode, then your Teensy will remain in programming mode, waiting for Teensy Loader on your PC to transmit new code. While it is in this state, you should see the red LED near the USB connector on solid if USB is connected, or blinking slowly if no USB communication is possible.

The key point is the pushbutton on Teensy is NOT a Reset button. Its function is to put your Teensy into programming mode, not to restart your program.
 
Back
Top