cancel
Showing results for 
Search instead for 
Did you mean: 

Help setting up I2S microphone!

wecox2020
Associate

I am trying to receive audio data from an I2S microphone (https://www.adafruit.com/product/3421) using my STM32L476RG board and its Serial Audio Interface (SAI). I'm using cubeIDE and I have the SAI set up as in the pictures below, however I am not sure if this is correct. Specifically, what is the "Number of Slots" parameter? And my mic's datasheet says "I2S, 24 bit, 2’s compliment, MSB first" so does that mean I should be using the I2S MSB Justified protocol?

Then when I generate the code in cubeIDE it gives me an SAI_HandleTypeDef, but how do I use this to read the SAI's data? There are many functions in the driver like HAL_SAI_INIT() and HAL_SAI_RECEIVE() but I'm not sure how/what order to use them. Any guidance would be appreciated!

 

wecox2020_0-1710870921467.png

 

wecox2020_1-1710870961271.png

 

1 REPLY 1
gregstm
Senior III

That adafruit board uses the  SPH0645LM4H microphone. If you search this forum (or the internet generally) for "STM32L476  SPH0645LM4H" a number of previous discussions come up, maybe they will help - I think I have used this microphone with the STM32L476 (a number of years ago), but I wrote direct to registers to get it going, and have since moved on to PDM type microphones (so might have lost that code). One would hope that ST have a whole lot of real life examples of setting up microphones somewhere...