Enable multiple serial over usb for rp2040
We utilize multiple serial ports on RP2040 boards. We do so today by manually editing the library (the change is committed). I can verify the RP2040 has no problem running multiple USB Serial Interfaces at the same time.
Example below how to initialize in .ino file for 2 Serial ports at same time,
#include <Adafruit_TinyUSB.h>
Adafruit_USBD_CDC USBSer1;
// In setup method
// Setup Serial
Serial.begin(115200);
// initialize 2nd CDC interface
USBSer1.begin(3686400);
enable multiple CDCs take more memory, most people don't need it, that is why it is not enabled by default.
Ok. That makes sense. What is the recommended way to enable multiple when needed? Just edit the library file like I did?
is this still a thing? haveing this in place I would assume the issue is solved?
#ifndef CFG_TUD_CDC #define CFG_TUD_CDC 1 #endif
An update. There is a strange bug when running the serials at fairly high baud (3,000,000+). Occasionally if you try to write out on one while receiving on the other, it will result in a complete lock up of the Rp2040.
I’m not sure if this is a library issue or a hardware issue. I suspect there is a way to do it using the PIOs onboard, but I never came back around to the issue. Just figured out how to multiplex the different signals over the single serial line.
TLDR; this works fine at lower baud speeds (<1M probably )