USB port usage in serial mode with standalone Teensy 4.0 CPU. SOLVED

Sorry, this post is inconsistent. IGNORE. I can't see a way to delete it.

I note the following in the documentation for Teensy4.0|USB|Serial:

“The Teensy does not actually become a serial device until your sketch is running, so you must select the serial port (Tools -> Serial Port menu) after your sketch begins.” How does this fit with running standalone, ie. with no connection to the Teensy serial port?

I want to download configuration data into EEPROM via USB|Serial, using a sketch to read the incoming bytes and burn to memory, then redeploy the device stand-alone, with nothing connected to the USB.

Thanks for any information.
 
Last edited:
so you must select the serial port (Tools -> Serial Port menu) after your sketch begins.” How does this fit with running standalone, ie. with no connection to the Teensy serial port?
You MUST select the Serial port type from the Serial Port menu BEFORE you compile your program. This is what instructs Teensy what sort of serial port to create.
 
It can work fine with nothing connected to the USB port, provided you don't write code that does one particular thing...

Sometimes at the beginning of setup(), it can be helpful to have a line of code similar to while (!Serial);
This makes the program wait until a PC initializes/opens the Teensy's USB serial port. If the Teensy isn't connected to anything, this won't happen and the Teensy will wait forever. So make sure not to do that if you want the Teensy to be able to work stand-alone.
 
Back
Top