Skip to content

PluggableUSBAudio not working #546

@w9ran

Description

@w9ran

Trying this example:

#include "PluggableUSBAudio.h"
USBAudio audio(true, 44100, 2, 44100, 2);
static uint8_t buf[128];

void setup() {
for (int i = 0; i<sizeof(buf); i++) {
buf[i] = 128 * sin(i);
}
}
void loop() {
audio.write(buf, sizeof(buf));
}

Compiles without error but the Pico continues to enumerate as a USB Serial device, not as Mbed Audio.
Thanks,
Bob

Activity

facchinm

facchinm commented on Sep 5, 2022

@facchinm
Member

Hi @w9ran ,
it should enumerate as a composite device with both the Serial (CDC) functionality and the USBAudio one.
On Windows, a new driver scan should be automatically started thanks to 301d69d and you should see the new audio interface without any further intervention.
If it's not the case let me know and I'll try to reproduce the issue.

w9ran

w9ran commented on Sep 6, 2022

@w9ran
Author

Thanks for your reply and suggestion. I did prove that the Pico is sending audio via USB in Linux, so it's a Windows issue.

I deleted all Pico containers and attached the Pico afresh so Windows did the usual "setting up new device" routine. This resulted in three Pico entries in device manager, all identical and with the same "Code 10 - cannot start" error:

image

I tried updating the driver but Windows said the best driver was installed (USB Audio) - here is are the details:

image

I then tried disabling/re-enabling the device which produced a message "Device is enabled but still not working".

Adding a print statement to the main loop proved that during all the above the COM port remained connected and working.

I hope this helps to identify what's going on as having a composite serial/USBAudio device will be very nice.

Bob

facchinm

facchinm commented on Sep 6, 2022

@facchinm
Member

This page https://docs.microsoft.com/en-us/answers/questions/549388/windows10-usb-problem-0xc0000182-audio-vcom-compos.html might be explaining the issue but no solution is provided unfortunately 😞

w9ran

w9ran commented on Sep 7, 2022

@w9ran
Author

Yes, the "updates" suggested there were from 2017.
I can only add this: In Linux, the Pico presents itself as an audio device just fine, i.e. arecord -l:

card 2: Pico [RaspberryPi Pico], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

But when I attach the Pico in /dev I see /dev/ttyACM0 rather than something like /dev/ttyUSB0 that I was expecting. Apparently this is normal and I don't see how it could be affecting USBAudio on Windows since it sees the COM Port OK, but thought I'd mention it.

Bob

MNS26

MNS26 commented on Sep 8, 2022

@MNS26

@w9ran have you tried using tinyusb? It also has a template for usb descriptors (aka how a OS sees the device)
i personally havent tried/looked into it with audio yet but im using it to make a gamepad with 10 axis 3 hats and a unholy amount of buttons

i used the tinyusb library from adafruit for it

MNS26

MNS26 commented on Sep 8, 2022

@MNS26

also /dev/ttyACM is a linux serial modem whereas /dev/ttyUSB0 is your generic usb to serial chip (from my understanding)

Gerriko

Gerriko commented on Sep 13, 2022

@Gerriko
Contributor

I'm throwing this in the pot as a guess, as I suspect Windows is seeking out a parameter to inform it that you've just inserted a composite device rather than a single USB device type. I know you can define some USB settings inside code, such as vendor id etc. but no idea what can be done here.

https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/register-a-composite-driver

je1rav

je1rav commented on May 26, 2023

@je1rav

The reason why not working on Windows seems to be the lack of IAD descriptor in USBAudio.cpp.
By adding the IAD descriptor, It becomes working on Windows too.

w9ran

w9ran commented on Aug 14, 2023

@w9ran
Author

je1rav - that's great news! I just looked at this thread after nearly a year and was pleased to find your comment - but I'm not enough of a USB expert to know exactly how to make the change to add the IAD descriptor. Could you perhaps post a snippet or the entire modified USBAudio.cpp file?

Thanks!
Bob

je1rav

je1rav commented on Aug 17, 2023

@je1rav
je1rav

je1rav commented on Aug 17, 2023

@je1rav

Dear Bob,

The above address was wrong.
The correct address is https://github.com/je1rav/QP-7C_RP2040_CAT_Arduino

Hitoshi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @w9ran@facchinm@Gerriko@MNS26@je1rav

        Issue actions

          PluggableUSBAudio not working · Issue #546 · arduino/ArduinoCore-mbed