cancel
Showing results for 
Search instead for 
Did you mean: 

How to set up SAI on STM32L4 for I2S on the STM32L476 Discovery Board?

JRiin.215
Associate

We're trying to get the DAC on our discovery board to work, and we're having issues setting up the SAI ports on our dev board for I2S. Any examples would be super helpful! We're trying not to use the HAL, but there's not many examples out there without it, so any help would be great. Thanks!

2 REPLIES 2

I can't share code - first it's not mine, I got payed for it, second it's not a standalone example, and third, it's not for 'L4.

But it's nothing miraculous - there basically only 3 registers which are important for the setup in SAI itself. Start with setting up a clock in RCC and the pins in GPIO. Then set up a few key fields in SAI_xCR1, SAI_xFRCR and SAI_xSLOTR - they may be mostly set right by default. Then enable SAI by setting SAIEN, run a simple polled loop throwing some conspicuous data at the data register, and observe what's coming out from the pins.

When you get it roughly right, you add DMA. And that's it...

https://i.kym-cdn.com/photos/images/original/000/572/093/7dd.jpg

JW

So we've set up those three registers, but nothing's coming out. It could be a clock issue, on the L4 as far as we can tell the SAI must be clocked with a PLL, and it seeeeeeeems like it's set up right (the PLL is locked and the clock source is set to PLLSAI1). Can you shed any more light on the "set up a clock in RCC" step?