cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure audio output over USB using NULCEO-L476RG?

PIvan.9
Associate II

Hi,

I want to create a simple device that streams audio from a PC to a loudspeaker via NUCLEO-L476RG board. The connection to a PC is implemented via USB connector on the X-NUCLEO-CCA02M2 board, which is plugged into NUCLEO-L476RG.

I've configured the project using STM32CubeIDE.

The USB inputs are set for Audio Device Class and I'm using SAI1 block for audio output. The SAI1 block should take the audio data from the DMA buffer.

In terms of firmware modifications, I only implement the changes that are mentioned here:

https://www.programmersought.com/article/90827167498/

The only difference is that I changed I2S HAL functions to their SAI alternatives.

Currently the issue is that, although the device is recognised by a PC as an Audio Class device, it doesn't output any data via I2S pins. Through debugging I figured out that the device doesn't enter the USBD_AUDIO_DataOut() function in usbd_audio.c file, although it fully implements USBD_AUDIO_Init().

Could anyone tell me how to approch this issuse or give a hint on why USBD_AUDIO_DataOut() function is not implemented?

Regards,

Pavels

3 REPLIES 3
Simon V.
ST Employee

Hello,

You can refer to the following application example :

STSW-STLKT01 - Embedded software samples for SensorTile, including sensor data streaming via USB and BLE, data logging on SD card, audio acquisition and playback - STMicroelectronics

It includes audio acquisition, playback and streaming via USB and on SD card

Regards,

Simon

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

PIvan.9
Associate II

Thanks, but that didn't particularly help since there is no example for streaming audio exactly from a PC via USB to STM32L4 and then to a loudspeaker through SAI block.

Simon V.
ST Employee

Hello,

There is another library available USB device audio streaming Expansion Package for STM32Cube from X-CUBE-USB-AUDIO Expansion Package.

In chapter 5.1 STM32446E-EVAL board standalone playback example may help you to start your application design.

Regards,

Simon

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.