USBdev Audio
(too old to reply)
bones@bonesio.net [nuttx]
2018-02-14 00:10:49 UTC
A search on these forums showed a while back there was some talk of getting USB audio working on an
Atmel ATSAM4S system.

I'm using a similar system, and I am wanting to get the device to respond as a USB audio device. So far it looks like I need to use drivers/usbdev/cdcacm.c or drivers/usbdev/usbmsc.c as examples/templates to create something similar for audio.

Has anyone gotten this to work? What sort of stumbling blocks might I run into?

Thanks for the help.
spudarnia@yahoo.com [nuttx]
2018-02-14 00:35:20 UTC
I presume you mean a USB Audio *device*. All USB audio specifications are here http://www.usb.org/developers/docs/devclass_docs/

I presume are referring specifically to http://www.usb.org/developers/docs/devclass_docs/

There are some good examples in that document for various USB audio devices. They tend not to be so uniform as other USB classes.

That all seems pretty straightforward to me. You will need to know what kind of audio device you are going to support; A USB device driver really supports two interfaces, a lower interface to the device controller driver (DCD) and an upper level interface to the OS and applications.

The first decision is whether you are writing some kind of audio source device (like a microphone) or and audio sink device (like speakers or an equalizer). There are examples of audio sink devices in drivers/audio. There are no audio source devices.

The application at /apps/system/nxplayer is an audio source. It reads audio files and passes the audio data into audio system, that is, code in audio/ and drivers/audio. The trick for good performance is to pass audio buffers with no unnecessary data copying.

That is all defined by header files in include/nuttx/audio/.

There is a some audio examples using the nxplayer, PWM, and DACs at:


Good luck.
spudarnia@yahoo.com [nuttx]
2018-02-14 02:51:00 UTC
Another issue will be the fact that USB audio uses isochronous endpoints. There is no use of ischronous endpoints in the system now and, in fact, most USB DCDs don't even bother to implement them.