Skip to content

tinyUSBv18 RP2040 on Windows 11 using UAC2 and CDC #3213

@mdhosale

Description

@mdhosale

Operating System

Windows 11

Commit SHA

version 0.18.0 bundled by pico

Board

RP2040 custom board

Firmware

full code example is available here: https://github.com/mdhosale/tinyUSBv18bugRP2040
this code is from a larger project but was tested and verified before uploading.

I am using a custom descriptor to get 2-channel out from USB - but from what I can tell it aligns with the format of the 1 and 4 channel descriptor embedded in the API

What happened ?

UAC2 and CDC composite work with TinyUSB v0.17.0 on windows 11 but not on TinyUSB v0.18.0
It does work on MacOS - not tested on Linux

  • I have tried updating:

tusb_init();

to

    tusb_rhport_init_t dev_init = {
        .role = TUSB_ROLE_DEVICE,
        .speed = TUSB_SPEED_AUTO
     };
     tusb_init(0, &dev_init); 

with no luck - tusb_init(); should be backwards compatible with v0.018

How to reproduce ?

In the latest SDK the code does not work on Wondows 11.

to fix - I rolled back the TinyUSB Library without rolling back the pico SDK by navigating to:

../pico-sdk/lib/tinyusb

and doing the following:

git fetch --tags
git checkout 0.17.0

make clean and compile and the USB enumerates and runs on Windows 11 (and Mac)

If I roll back to USB v0.18 by navigating to:

../pico-sdk/lib/tinyusb

and doing the following:

git fetch --tags
git checkout 0.18.0

make clean and compile and the USB enumerates but the audio freezes on Windows 11; while the USB still enumerates and runs on Mac

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

I am receiveing this error on WIndows 11 and v0.18.0:

adportaudio_start: error Invalid device from portaudio opening stream

here's the dump from USB Device Viewer on Windows 11:

[Port2] : USB Composite Device

Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 4
Companion Hub Symbolic Link Name: USB#ROOT_HUB30#5&16684953&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
Protocols Supported:
USB 1.1: yes
USB 2.0: yes
USB 3.0: no

Device Power State: PowerDeviceD0

   ---===>USB4 Information<===---

Port is USB4 Capable: No
Device is tunneled through USB4: No

   ---===>Device Information<===---

English product name: "testing"

ConnectionStatus:
Current Config Value: 0x01 -> Device Bus Speed: Full (is not SuperSpeed or higher capable)
Device Address: 0x01
Open Pipes: 3

      ===>Device Descriptor<===

bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF -> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02 -> This is the Common Class Sub Class
bDeviceProtocol: 0x01 -> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0xCAFE = Vendor ID not listed with USB.org
idProduct: 0x4011
bcdDevice: 0x0100
iManufacturer: 0x01
English (United States) "Test"
iProduct: 0x02
English (United States) "testing"
iSerialNumber: 0x03
*!*ERROR: No String Descriptor for index 3!
bNumConfigurations: 0x01

      ---===>Open Pipes<===---

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0008 = 0x08 bytes
bInterval: 0x10

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x04 -> Direction: OUT - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00

   ---===>Full Configuration Descriptor<===---

      ===>Configuration Descriptor<===

bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x00D3 -> Validated
bNumInterfaces: 0x04
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 -> Bus Powered
MaxPower: 0x32 = 100 mA

      ===>IAD Descriptor<===

bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x00
bInterfaceCount: 0x02
bFunctionClass: 0x01 -> Audio Interface Class
bFunctionSubClass: 0x00
*!*CAUTION: This appears to be an invalid bFunctionSubClass
bFunctionProtocol: 0x20
iFunction: 0x00

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x01 -> Audio Control Interface SubClass
bInterfaceProtocol: 0x20
*!*WARNING: must be set to PC_PROTOCOL_UNDEFINED 0 for this class
iInterface: 0x04
English (United States) "UAC2"

      ===>Audio Control Interface Header Descriptor<===

bLength: 0x09
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x01 (HEADER)
bcdADC: 0x0200
wTotalLength: 0x4003
bInCollection: 0x00

      ===>Descriptor Hex Dump<===

bLength: 0x08
bDescriptorType: 0x24
08 24 0A 04 01 01 01 00

      ===>Descriptor Hex Dump<===

bLength: 0x11
bDescriptorType: 0x24
11 24 02 01 01 02 03 04 02 00 00 00 00 00 04 00
00

      ===>Descriptor Hex Dump<===

bLength: 0x0C
bDescriptorType: 0x24
0C 24 03 03 01 01 01 02 04 00 00 00

      ===>Audio Control Feature Unit Descriptor<===

bLength: 0x12
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x06 (FEATURE_UNIT)
bUnitID: 0x02
bSourceID: 0x01
bControlSize: 0x0F
*!*WARNING: bLength is greater than number of bmaControls (bLength > ( 7 + (ch + 1) * n)
*!*WARNING: Either bLength or bControlSize are invalid. The calculated logical channel count is -1. ((bLength - 7)/ n) - 1

      ===>Descriptor Hex Dump<===

bLength: 0x12
bDescriptorType: 0x24
12 24 06 02 01 0F 00 00 00 0F 00 00 00 0F 00 00
00 00

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x20
*!*WARNING: must be set to PC_PROTOCOL_UNDEFINED 0 for this class
iInterface: 0x00

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x01
bNumEndpoints: 0x01
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x20
*!*WARNING: must be set to PC_PROTOCOL_UNDEFINED 0 for this class
iInterface: 0x00

      ===>Descriptor Hex Dump<===

bLength: 0x10
bDescriptorType: 0x24
10 24 01 03 00 01 01 00 00 00 02 00 00 00 00 00

      ===>Audio Streaming Format Type Descriptor<===

bLength: 0x06
bDescriptorType: 0x24 (CS_INTERFACE)
bDescriptorSubtype: 0x02 (FORMAT_TYPE)
bFormatType: 0x01 (FORMAT_TYPE_I)
bNrChannels: 0x02
bSubframeSize: 0x10
bBitResolution: 0x07 (7)
bSamFreqType: 0x05 (Discrete)
tSamFreq[1]: 0xC40581 (12846465 Hz)
tSamFreq[2]: 0x080100 (524544 Hz)
tSamFreq[3]: 0x000125 (293 Hz)
tSamFreq[4]: 0x000000 (0 Hz)
tSamFreq[5]: 0x0B0800 (722944 Hz)

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x05 -> Isochronous Transfer Type, Synchronization Type = Asynchronous, Usage Type = Data Endpoint
wMaxPacketSize: 0x00C4 = 0xC4 bytes
bInterval: 0x01

      ===>Descriptor Hex Dump<===

bLength: 0x08
bDescriptorType: 0x25
08 25 01 00 00 00 00 00

      ===>IAD Descriptor<===

bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x02
bInterfaceCount: 0x02
bFunctionClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bFunctionSubClass: 0x02
bFunctionProtocol: 0x00
iFunction: 0x00

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x00
iInterface: 0x05
English (United States) "CDC"
-> This is a Communications (CDC Control) USB Device Interface Class

      ===>Descriptor Hex Dump<===

bLength: 0x05
bDescriptorType: 0x24
05 24 00 20 01
-> This is a Communications (CDC Control) USB Device Interface Class

      ===>Descriptor Hex Dump<===

bLength: 0x05
bDescriptorType: 0x24
05 24 01 00 03
-> This is a Communications (CDC Control) USB Device Interface Class

      ===>Descriptor Hex Dump<===

bLength: 0x04
bDescriptorType: 0x24
04 24 02 06
-> This is a Communications (CDC Control) USB Device Interface Class

      ===>Descriptor Hex Dump<===

bLength: 0x05
bDescriptorType: 0x24
05 24 06 02 03

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0008 = 0x08 bytes
bInterval: 0x10

      ===>Interface Descriptor<===

bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x03
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A -> This is a CDC Data USB Device Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x04 -> Direction: OUT - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00

      ===>Endpoint Descriptor<===

bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00

Screenshots

No response

I have checked existing issues, discussion and documentation

  • I confirm I have checked existing issues, discussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions