Library wanted for 2 COM ports from one USB cable

I have a ham radio PC application (N1MM+) that talks to two serial devices on separate COM ports: one is a Morse keyer (Winkey) and the other is the frequency setting on a transceiver. Both are low speed, typically 4800 or 9600 baud, with only a few hundred bytes of data a second.

I have an embedded Arduino Uno which easily has enough processing power to service the traffic from both COM ports. is there a library that will cause the PC to create 2 COM ports when the (single) USB cable is plugged in and offer the data on each COM port to my Arduino sketch via something like the Serial() and Serial1() libraries?

In summary is there a way to make a single USB hardware device appear as two independent COM ports?

Welcome, you have an Interesting question but I do not understand exactly what you are trying to do. Can you post either a schematic, not a frizzy picture or a block diagram. As com ports that is determined by the PC, the device only tells it what it is. The Arduino can have as many serial ports as you want but you need to be careful how much you are sending and receiving it has real limits. Check the messages coming from each device, are they the same format? is there some way to determine which message came from what?

The Arduino Mega has four serial ports, one used for the console and three others. I believe they already have the software buffers in the software so something like serial.print1("hello world"); will be stuffed in a buffer and your software will continue while it is being sent. In the end you will still need a driver for the PC if it requires two ports. You could possibly get a module that will convert the output of a serial port to USB. I use linux so it is an entirely different machine on the other end of the Arduino.

I received a suggestion that I should use 2 Arduinos, one for each serial stream, and connect their USB ports to a USB hub (FE1.1s or similar chip) and then connect that hub to the PC to get the two COM ports. This seems easier.

Your Arduino knows nothing about COM ports. Only your PC knows about them, since that is where they are defined. MY ICOM 7100 required a custom PC driver program from ICOM to be able to use the transceiver control port and the FT8 USB signal all over a single USB connection. The 7100 internal program separates to the two data streams.

I suspect you will need a similar program for you PC.

Also, should you begin down the Arduino-RS232 path, be aware that the Arduino is not RS232-compatible, it's a strictly 5V device, so you'll need, at a minimum, an interface circuit to allow your existing RS232 devices to talk to Arduinos.

Other MCU's have multiple com ports, like an ESP32 which has 4 com ports, 3 useable. One MCU could receive the traffic from both devices and then do the thing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.