Skip to content

PluggableUSBAudio not working #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
w9ran opened this issue Sep 3, 2022 · 11 comments
Open

PluggableUSBAudio not working #546

w9ran opened this issue Sep 3, 2022 · 11 comments

Comments

@w9ran
Copy link

w9ran commented Sep 3, 2022

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

@facchinm
Copy link
Member

facchinm commented Sep 5, 2022

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
Copy link
Author

w9ran commented Sep 6, 2022

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
Copy link
Member

facchinm commented Sep 6, 2022

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
Copy link
Author

w9ran commented Sep 7, 2022

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
Copy link

MNS26 commented Sep 8, 2022

@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
Copy link

MNS26 commented Sep 8, 2022

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

@Gerriko
Copy link
Contributor

Gerriko commented Sep 13, 2022

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
Copy link

je1rav commented May 26, 2023

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
Copy link
Author

w9ran commented Aug 14, 2023

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
Copy link

je1rav commented Aug 17, 2023 via email

@je1rav
Copy link

je1rav commented Aug 17, 2023

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
Projects
None yet
Development

No branches or pull requests

5 participants