It is hard to get the USB Composite creating two USB/Serial interfaces when you aren’t expert in USB protocol, but after some tinkering I was able to get it working:
[28670.308677] usb 3-5: new full-speed USB device number 32 using xhci_hcd
[28670.459397] usb 3-5: New USB device found, idVendor=03eb, idProduct=2022, bcdDevice=10.10
[28670.459409] usb 3-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[28670.459413] usb 3-5: Product: Composite device
[28670.459416] usb 3-5: Manufacturer: NuttX
[28670.459419] usb 3-5: SerialNumber: 0101
[28670.463882] cdc_acm 3-5:1.0: ttyACM0: USB ACM device
[28670.464175] cdc_acm 3-5:1.2: ttyACM1: USB ACM device
Basically I modified the rp2040_composite.c to register the CDC/ACM twice, changing:
dev[n].devinfo.ifnobase = 0;
dev[n].minor = 0;
for the first interface and:
dev[n].devinfo.ifnobase = 2;
dev[n].minor = 1;
for the second interface!
The complete modification for future reference:
diff --git a/boards/arm/rp2040/common/src/rp2040_composite.c b/boards/arm/rp2040/common/src/rp2040_composite.c
index 9b059f48fe..e00c9d2794 100644
--- a/boards/arm/rp2040/common/src/rp2040_composite.c
+++ b/boards/arm/rp2040/common/src/rp2040_composite.c
@@ -250,7 +250,7 @@ void *board_composite_connect(int port, int configid)
/* Interfaces */
- dev[n].devinfo.ifnobase = ifnobase; /* Offset to Interface-IDs */
+ dev[n].devinfo.ifnobase = 0; /* Offset to Interface-IDs */
dev[n].minor = 0; /* The minor interface number */
/* Strings */
@@ -259,12 +259,45 @@ void *board_composite_connect(int port, int configid)
/* Endpoints */
- dev[n].devinfo.epno[CDCACM_EP_INTIN_IDX] = 3;
- dev[n].devinfo.epno[CDCACM_EP_BULKIN_IDX] = 4;
- dev[n].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = 5;
+ dev[n].devinfo.epno[CDCACM_EP_INTIN_IDX] = 1;
+ dev[n].devinfo.epno[CDCACM_EP_BULKIN_IDX] = 2;
+ dev[n].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = 3;
n++;
#endif
+#ifdef CONFIG_CDCACM_COMPOSITE
+ /* Configure the CDC/ACM device */
+
+ /* Ask the cdcacm driver to fill in the constants we didn't
+ * know here.
+ */
+
+ cdcacm_get_composite_devdesc(&dev[n]);
+
+ /* Overwrite and correct some values... */
+
+ /* The callback functions for the CDC/ACM class */
+
+ dev[n].classobject = cdcacm_classobject;
+ dev[n].uninitialize = cdcacm_uninitialize;
+
+ /* Interfaces */
+
+ dev[n].devinfo.ifnobase = 2; /* Offset to Interface-IDs */
+ dev[n].minor = 1; /* The minor interface number */
+
+ /* Strings */
+
+ dev[n].devinfo.strbase = strbase; /* Offset to String Numbers */
+
+ /* Endpoints */
+
+ dev[n].devinfo.epno[CDCACM_EP_INTIN_IDX] = 4;
+ dev[n].devinfo.epno[CDCACM_EP_BULKIN_IDX] = 5;
+ dev[n].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = 6;
+ n++;
+#endif
+ //
return composite_initialize(composite_getdevdescs(), dev, n);
}
else
I configure to use the composite board profile:
$ ./tools/configure.sh raspberrypi-pico:composite
And removed the USB MSC support (to let only USB CDC/ACM).