基于Raspberry Pi Pico的TinyUSB CDC+UAC2复合设备故障求助
组合TinyUSB CDC与UAC2设备时出现带宽不足及端点冲突问题
我需要制作一款包含双串口(CDC)与UAC2声卡端点的USB设备,采用Raspberry Pi Pico搭配TinyUSB库实现。已将dual_cdc示例与uac2_headset示例合并到example_cdc_uac2分支的cdc_uac文件夹中,代码可编译且能被主机识别,但无法正常工作——两个示例单独运行均无问题。
关键代码片段
enum { ITF_NUM_CDC_0 = 0, ITF_NUM_CDC_0_DATA, ITF_NUM_CDC_1, ITF_NUM_CDC_1_DATA, ITF_NUM_AUDIO_CONTROL, // FIXME: I have added here the AUDIO ITFs. Is it something wrong? ITF_NUM_AUDIO_STREAMING_SPK, ITF_NUM_AUDIO_STREAMING_MIC, ITF_NUM_TOTAL }; #define EPNUM_CDC_0_NOTIF 0x81 #define EPNUM_CDC_0_OUT 0x02 #define EPNUM_CDC_0_IN 0x82 #define EPNUM_CDC_1_NOTIF 0x83 #define EPNUM_CDC_1_OUT 0x04 #define EPNUM_CDC_1_IN 0x84 #define EPNUM_AUDIO_OUT 0x01 #define EPNUM_AUDIO_IN 0x81 uint8_t const desc_fs_configuration[] = { // Config number, interface count, string index, total length, attribute, power in mA TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100), // 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size. TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64), // 2nd CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size. TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_1, 4, EPNUM_CDC_1_NOTIF, 8, EPNUM_CDC_1_OUT, EPNUM_CDC_1_IN, 64), // Interface number, string index, EP Out & EP In address, EP size TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR(2, EPNUM_AUDIO_OUT, EPNUM_AUDIO_IN), };
主机dmesg输出
[65995.165040] usb 1-3: new full-speed USB device number 48 using xhci_hcd [65995.538127] usb 1-3: New USB device found, idVendor=cafe, idProduct=4012, bcdDevice= 1.00 [65995.538132] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [65995.538135] usb 1-3: Product: TinyUSB Device [65995.538137] usb 1-3: Manufacturer: TinyUSB [65995.538139] usb 1-3: SerialNumber: 123456 [65995.556877] cdc_acm 1-3:1.0: ttyACM0: USB ACM device [65995.562864] cdc_acm 1-3:1.2: ttyACM1: USB ACM device [65995.631858] xhci_hcd 0000:01:00.0: Trying to add endpoint 0x81 without dropping it. [65995.631862] usb 1-3: Not enough bandwidth for altsetting 1 [65995.646855] xhci_hcd 0000:01:00.0: Trying to add endpoint 0x81 without dropping it. [65995.646860] usb 1-3: Not enough bandwidth for altsetting 2 [65995.775643] xhci_hcd 0000:01:00.0: Trying to add endpoint 0x81 without dropping it. [65995.775650] usb 1-3: Not enough bandwidth for altsetting 1 [65995.775653] usb 1-3: 6:1: usb_set_interface failed (-22) [65995.775765] xhci_hcd 0000:01:00.0: Trying to add endpoint 0x81 without dropping it. [65995.775769] usb 1-3: Not enough bandwidth for altsetting 1 [65995.775771] usb 1-3: 6:1: usb_set_interface failed (-22) [65995.775883] xhci_hcd 0000:01:00.0: Trying to add endpoint 0x81 without dropping it.
完整代码已上传至对应的GitHub分支,恳请帮忙排查问题,感谢支持!
内容的提问来源于stack exchange,提问作者Angel
相关产品推荐
相关产品推荐

