cancel
Showing results for 
Search instead for 
Did you mean: 

USB Audio device class on NUCLEO-F446RE

Benjamin Brammer
Senior II
Posted on June 04, 2017 at 01:40

Hi Guys,

I want to experiment a bit with the USB middleware features from the CubeMX Software. My goal is to output audio from my computer via the NUCLEO board (recognized as an audio device class) and the integrated DAC or via I2S. Sadly I am not checking how this is going to work. I tried to read a lot of application notes (UM1734 on audio class, AM4711 as an example for the SMT32F0 and of course the reference manual) but I don't understand how this is going to work

:(

 or what I have to do to make it work.

In UM1734 it is said that I only need the USBD_AUDIO_DataIn() and USBD_AUDIO_DataOut() functions to handle the data transfers. So as I understand the buffer are already implemented right in the USBD_AUDIO_HandleTypeDef , right? So how do I manage to stream the data out to the DAC or I2S? Is there an interrupt generated each time a frame is received from USB (OTG_FS_IRQHandler)? And shall the DAC be triggered after the first received data from USB or - I don't know - after half the buffer size? Does the rest of the USB handle itself or do I have to implement more functions for data reception? As I understood it right only rudimental interface functions are implemented.

I would really appreciate some help here .

best regards

Benjamin

#nucleo-f446re #usb-audio-device-class #stm32f446re #dac
2 REPLIES 2
kraiskil
Associate III
Posted on June 06, 2017 at 07:41

If you search the Audio class sources, you'll notice a function AUDIO_AudioCmd_FS() gets called when the first OUT stream packet arrives.

I put a

HAL_I2S_Transmit_DMA(&hi2s2, (uint16_t*)pbuf, size);

there. This is a cyclic DMA, so it will send the contents of pbuf to the I2S indefiently.

The output quality is not good though - there will be noises though, as the board I2S clock doesn't match 48kHz as well as your PC. You need the USB audio feedback channel implemented, and some way of taking different size-packets into account on the device end (I think - I haven't solved this yet )

Posted on June 06, 2017 at 14:08

Hey Kalle,

thanks for your advise and help. I will try to get this basic version without feedback implemented.

best regards

Benjamin