cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve data via the SAI of the STM32

DYann.1
Senior

HI,

After having configured the SAI PORT of the STM32L5 to communicate with a CODEC do you know how to recover the data ?

Thank for your helps

Regards

4 REPLIES 4

Received data are in the SAI FIFO, read through SAI_xDR registers. Normally SAI is read by DMA, but while experimenting, you can handle it by polling, too. See Internal FIFOs subchapter of SAI chapter in RM.

JW

DYann.1
Senior

Hi,

First I open the example with the evaluation kit STM32L552E-EV, the file SAI Audio Play. But I need to read information from a sensor and not a pre-record.

After after configuring the SAI PORT with CubeMX, I don't know how to read samples.

You say

0693W00000Y7GJOQA3.pngDo you have the code so that I can concretely see how it works ? You says in RM what does that mean ?

Thank you

AScha.3
Chief II

RM = reference manual ( download from STM )

+

example code - see

https://github.com/STMicroelectronics/STM32CubeL5/tree/master/Projects/STM32L552E-EV/Examples/SAI/SAI_AudioPlay

to read, use : HAL_SAI_Receive(SAI...) or HAL_SAI_Receive_DMA() , read in HAL lib .

If you feel a post has answered your question, please click "Accept as Solution".
DYann.1
Senior

Hi,

I have this example in my IDE environment

0693W00000Y7HYeQAN.pngAnd I can see the function :

HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout)

In this example SAI_AudioPlay it's not the same thing i'm looking for. First I don't have the same CODEC and I just need to acquire the data via an input from the CODEC that's all.