Serial communication via USB only after Arduino's Serial Monitor was opened?

Status
Not open for further replies.

ikue

New member
Hi there,

I would like to use the serial communication via the normal USB connector, and remote-control a Teensy 4.0 this way.

Everything works fine if I follow this sequence:
1) Connect Teensy 4.0 by USB cable
2) In Arduino IDE, choose the right serial port and open serial monitor
3) Use my own software (or some serial terminal program) to send and receive data from the Teensy by its Serial interface.

If I connect by USB or reset the Teensy, it does not seem to interact with any serial port communication until the serial monitor was opened in the Arduino IDE.

Even more curious: If the Teensy was connected and some serial terminal program was used to send some bytes to the COM port (found by Windows), these bytes appear in the serial monitor of the Arduino IDE as soon as it is opened.

Is there any way to overcome this problem? The serial interface works perfectly, but opening the monitor to "activate" serial communication on every start would not be an option.

Thank you in advance!
Frederic
 
Many people have successfully used USB serial communication with Teensy from software other than Arduino. It definitely does work. If you believe it does not, I recommend running CoolTerm, which is a known-good program which works on Windows.

After you've seen that CoolTerm can indeed open the COM port and communicate with Teensy, maybe you can tell us what software you're using which doesn't work?
 
Dear Paul,

Thank you for this quick feedback. I have identified this code fragment as problematic:

while (!Serial) {
; // wait for serial port to connect. Needed for native USB
}

It was mentioned in source code for earlier Teensy boards and I assumed it would be necessary to properly initialize the USB connection with Teensy 4.0. As it turned out, it kept the port from becoming accessible. After I removed these lines, the port becomes available immediately to any terminal software.

Thank you a lot, I am a big fan of your work. I loved the earlier models, too, but Teensy 4.0 is really fantastic.
 
Status
Not open for further replies.
Back
Top