Showing results for 
Search instead for 
Did you mean: 

Help setting up I2S microphone!


I am trying to receive audio data from an I2S microphone ( 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!






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...