Skip to main content
Visitor II
June 17, 2021
Question

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

  • June 17, 2021
  • 3 replies
  • 2755 views

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

    This topic has been closed for replies.

    3 replies

    ST Employee
    July 1, 2021

    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

    PIvan.9Author
    Visitor II
    July 2, 2021

    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.

    ST Employee
    July 2, 2021

    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