Showing results for 
Search instead for 
Did you mean: 

simple example of SAI audio output on STM32L476VG Discovery board

Ben Swift
Posted on March 06, 2017 at 05:17

I want to generate simple audio waveforms and send them out through the headphone jack, preferrably using a synchronous interface such as HAL_SAI_Transmit. (I know there are better/more efficient ways to do this which don't peg the CPU, but I just want to keep it simple to start off).

Are there any good resources (especially example code!) which show how to configure everything (oscillators, clocks, codecs) in this way?

#stm32l4 #sai
Associate III
Posted on September 23, 2017 at 21:03


You can find an example in the STM32F7cube under examples/SAI/. This example features how to play configure the SAI and clocks to play an audio.bin file. you'll find the required steps to run the example detailed in the Readme file. 

To play an audio wave file, there is no difference in the configuration steps but I thinks you need to use an SD card which will contain the wave file and then you must use the FATfs to extract audio data from the file in the audio buffer .