Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Platform IO / Teensyduino - No serial port listed

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    7

    Platform IO / Teensyduino - No serial port listed

    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 !

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,288
    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.

  3. #3
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    219
    I'm not on the PlatformIO team, but am intrigued by the HID-only serial. How does it work?

  4. #4
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    Quote Originally Posted by PaulStoffregen View Post
    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 ?

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,163
    Quote Originally Posted by drnicolas View Post
    Any ideas ?
    Yes, some USB modes just don't emulate a serial port.
    Arduino can display the data in these cases, because there is a fallback to a special HID protocol if no serial port is enabled.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,288
    Quote Originally Posted by drnicolas View Post
    So, the question is, why I cannot set an option in platformIO.ini to behave exactly like the project in Arduino IDE.
    That's a good question... to ask on PlatformIO's forum.

    https://community.platformio.org/

  7. #7
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    698
    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...


  8. #8
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    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.

  9. #9
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    698
    "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.

  10. #10
    Junior Member
    Join Date
    Jan 2020
    Posts
    10
    Quote Originally Posted by luni View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •