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

Thread: Emulate two serial ports through the USB connection (Teensy 3.2)

  1. #1
    Senior Member
    Join Date
    Jan 2015
    Posts
    176

    Emulate two serial ports through the USB connection (Teensy 3.2)

    I'm working on a project (Teensy 3.2) where I need to communicate with two separate apps (different protocols) installed on the same PC.

    Is it possible to emulate a second virtual COM port through the USB connection?

  2. #2
    Senior Member
    Join Date
    Jan 2015
    Posts
    176
    I thought it was a stupid question but, after reading about some implementations using a much slower CPU (Xmega 128A4U) I guess it should be doable.
    Any clues on this matter? Thank you very much for your time.

  3. #3
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    196
    I'd love to have that capability too.

  4. #4
    Senior Member
    Join Date
    Jan 2015
    Posts
    176
    I'm kind of surprised that no one has done it yet (Teensy/Arduino world).
    I need no mapping to physical (GPIO) pins - so no bit banging. I just need one more pair of (virtual) UART registers to set up an extra (low baud rate: 9600) serial connection through the same USB port.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,825
    If this were done, which operating system would you expect to be supported?

    Windows XP, 7 and 8 are the problematic ones...

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,136
    Why not just run 2 uarts separately through USB converters, better yet, use the same UART and dynamically change baudrate, over a single usb to uart adaptor

    Serial1.begin(115200);
    //Do Something...
    Serial1.begin(9600);
    //Do Something Else...

    If you are looking to split the same Com port data, look into Xport, used to use that back in the carPC days when gps was being shared with frontend software's spedometer

  7. #7
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    196
    Quote Originally Posted by PaulStoffregen View Post
    If this were done, which operating system would you expect to be supported?

    Windows XP, 7 and 8 are the problematic ones...
    Id care about macOS and Linux.

  8. #8
    Senior Member
    Join Date
    Jan 2015
    Posts
    176
    Hi, Paul

    I forgot to mention, the host PC runs on Windows 10.

  9. #9
    Senior Member
    Join Date
    Jan 2015
    Posts
    176
    Quote Originally Posted by tonton81 View Post
    Why not just run 2 uarts separately through USB converters
    Because the client wants to use a single USB connection between the host and the Teensy based device.

  10. #10
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    578
    That would be really great for debugging apps which have their normal communication channel (commands, data etc) to the PC via Serial. For those apps I usually connect a a USB/Serial cable to one of the hardware uarts to spit out debug messages which is kind of tedious (but of course possible). I'd like that for Win10.

  11. #11
    Senior Member
    Join Date
    Jan 2015
    Posts
    176
    According to this blog post (three serial ports at the same time):

    The STM32 has three UARTs, so how about a USB to three serial ports? [..] Map each of the serials to a virtual serial port over USB using a composite device.
    I know it's a different MCU but I think the whole theory could apply to any ARM (M4) processor. Although I've read that article for many times, I have no clue of what or where to insert an additional code into Teensy core files to implement that stuff.

    Anyway, it seems not to emulate some virtual UARTs (registry) from scratch but "tunneling" the existing hardware UARTs through that USB connection (CDC/ACM class).

Posting Permissions

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