Platform IO / Teensyduino - No serial port listed

drnicolas

Active member
I finally managed to compile and upload a program to my Teensy 3.6 using PlatformIO on VisualStudio Code.

At least my program correctly connects to X-Plane using the Build flag USB_FLIGHTSIM.
But there is no serial port listed, which is used to send debug information.

This the platformio.ini I am using:

Code:
[env:teensy36]
platform = teensy
board = teensy36
framework = arduino

build_flags = -D USB_FLIGHTSIM 
; Custom Serial Monitor port
monitor_port = COM10

; Custom Serial Monitor speed (baud rate)
monitor_speed = 9600


What can I do ?
Adding "USB_SERIAL" to the buildflags gave me lots of compile errors.

Thank you !
 
First, open Arduino, select your Teensy in Tools > Port (install Teensyduino if that menu lacks Teensy choices). Then look for a HID-only entry in Tools > Ports. When you select that and then open the Arduino Serial Monitor, you should see the serial printing appear.

Get that working first.

How to get this in PlatformIO, I can not say. It may not be possible. If anyone from PlatformIO is interested in making this work (and joins this thread), I can explain how.

But again, before we dive down that rabbit hole, get the Arduino Serial Monitor on your PC showing the info. All modern versions of Teensyduino will automatically gray (but not disappear) the serial monitor window when Teensy reboots or disconnects, and automatically reconnect when it's plugged back in again or reappears after being reprogrammed. So just leaving Arduino running and the serial monitor window open should give you a way to use this.

After that's working (and a screenshot would help) if you find anyone from PlatformIO who wants to work on supporting this non-serial stuff, please invite them here.
 
First, open Arduino, select your Teensy in Tools > Port (install Teensyduino if that menu lacks Teensy choices). Then look for a HID-only entry in Tools > Ports. When you select that and then open the Arduino Serial Monitor, you should see the serial printing appear.

Get that working first.

How to get this in PlatformIO, I can not say. It may not be possible. If anyone from PlatformIO is interested in making this work (and joins this thread), I can explain how.

But again, before we dive down that rabbit hole, get the Arduino Serial Monitor on your PC showing the info. All modern versions of Teensyduino will automatically gray (but not disappear) the serial monitor window when Teensy reboots or disconnects, and automatically reconnect when it's plugged back in again or reappears after being reprogrammed. So just leaving Arduino running and the serial monitor window open should give you a way to use this.

After that's working (and a screenshot would help) if you find anyone from PlatformIO who wants to work on supporting this non-serial stuff, please invite them here.

1. Using my test-code in Arduino IDE works with some noticeable effect:
- When choosing only "Flightsim" as an option, then I can communicate with X-Plane, but I also see my test-output in serial-monitor. but it lists no serial port as expected, but a "hid...vid...pid"-something.
- Changing to "ALL of the above" changes something:
-- a new serial port (COM3) appears in Device-manager and also in serial-monitor -> my test-output goes there.

So, the question is, why I cannot set an option in platformIO.ini to behave exactly like the project in Arduino IDE. USB_FLIGHTSIM as a build flag works, but neither USB_SERIAL nor USB_ALL.

Any ideas ?
 
Alternatively, you can give VisualTeensy a try. https://github.com/luni64/VisualTeensy/releases

VisualTeensy is a lightweight, free, open source tool to generate all project files and settings to build your Teensy projects using vsCode. It should run out of the box and you can choose exactly the same settings as in the Arduino IDE. Additionally it supports intellisense, i.e., code completion, error wiggles, jump to definition/delcaration (F12) or referenced header files, clean compiler output etc...

 
Little success:

from another thread, I found that -D USB_EVERYTHING might work.

And indeed, it compiles successfully and I see an additional COM-Port ( in my case COM3), which gives me my debug messages.
But the setting "monitor_port= COM10" does not seem to have any influence on the COM-port number.
 
"monitor_port= COM10" does not seem to have any influence on the COM-port number.

The COM numbers are assigned by windows. While in principle it is possible to change that by software, I doubt that platform.io is doing this. The monitor_setting setting probably only defines the port on which some serial monitor listens.
 
Alternatively, you can give VisualTeensy a try. https://github.com/luni64/VisualTeensy/releases

VisualTeensy is a lightweight, free, open source tool to generate all project files and settings to build your Teensy projects using vsCode. It should run out of the box and you can choose exactly the same settings as in the Arduino IDE. Additionally it supports intellisense, i.e., code completion, error wiggles, jump to definition/delcaration (F12) or referenced header files, clean compiler output etc.

This is a little off topic, though nearly relevant. It would seem that VSCode and Sublime Text are the two main contenders for those needing a better IDE than the Arduino one. I have worked for a while with VSCode/Platformio and am underwhelmed, though it is clearly better than Arduino. I would try Visualteensy except that it is a Windows tool while I use Ubuntu Linux. My first impressions of Sublime Text are good. I also very much like KDevelop though that will take quite a bit of work to tailor to Arduino/Teensy. I suspect I will persevere with Sublime Text. I would love to hear the experiences of others.
 
Back
Top