Page 1 of 1

SAI1 interface receive parameter?

Posted: Thu Feb 13, 2020 12:14 pm
by Bambo
Hi,

When using the SAI protocol i'm not sure what parameter to pass as Size for the HAL_SAI_Receive() function?

I posted a thread here but doesn't anyone know?

https://community.st.com/s/question/0D5 ... -parameter

Re: SAI1 interface receive parameter?

Posted: Thu Feb 13, 2020 2:16 pm
by fpiSTM
Maybe this could help:
UM1884: Description of STM32L4/L4+ HAL and low-layer drivers

STM32L4-Peripheral-Serial-Audio-Interface(SAI)

I never use it anyway, I guess this should be size of what you expect (at least the size of your allocated buffer)

Re: SAI1 interface receive parameter?

Posted: Thu Feb 13, 2020 2:39 pm
by Bambo
Yeah i've read these resources, its just that the parameter Size isn't documented anywhere, and i can't find documentation for hsai->XferSize or hsai->XferCount either so i'm sorta guessing here.

Looking at the source, i think it depends on your data size as to how the HAL_SAI_Receive() behaves because if you use a datasize of 1 byte, Size is the number of bytes to read, however, when its 32bit its the number of 32bit blocks to read.

It's annoying that they haven't documented this feature as fully as the others because it's the only way to interface with serious audio components!