Serial on 2 separate COM ports with Arduino Pro micro 32u4

Hi, I am using a Arduino Pro micro (32u4) as a HID and I have 2 code parts which are now sending on the same serial. On my PC there are 2 programs which both need to communicate to the Arduino via Serial, but they are disturbing each other. Is there a way to create 2 virtual Com ports on the arduino and split the communication? I want that my PC detects 2 devices which the programs can communicate with separately. Is this even possible or do you know a work-around?

The pro Micro ( 32u4) has a native USB interface and a separate UART interface on pins 0 and 1. Unlike the UNO these to interfaces are independent from each other.
You could use the UART on pins 0/1 together with a TTL-USB adapter to have a second path to your PC.

In theory, a native-USB microcontoller can support multiple USB devices, including multiple virtual Serial ports. See for example Adafruit_TinyUSB_Arduino/cdc_multi.ino at master · adafruit/Adafruit_TinyUSB_Arduino · GitHub which supports two virtual Serial ports on a SAMD21 (eventually, I want to make a QT Py board be a three-port serial/usb converter.)

Practically, the 32u4 on the Pro Micro only supports 6 USB "endpoints" and each Serial port requires 3 of them (Control, Input, output), so I don't know whether a 32u4 can do this. Also, the SAMD example uses the TinyUSB library, which isn't available on 32u4 (AFAIK), and is relatively complicated to set up. I don't know offhand whether you could do this with the Arduino "pluggable USB" library.

It would certainly be "easier" to add an external USB/Serial convert and use the HardwareSerial port on pins 0/1 as well as the USBSerial port.

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