cancel
Showing results for 
Search instead for 
Did you mean: 

How works the function HAL_SAI_Transmit_DMA()

Gia Hung Tran
Associate
Posted on July 26, 2017 at 09:58

Hi Communities, 

can any body please explain me, how works exactly the function HAL_SAI_Transmit_DMA(). I am using STM32F746VGTX.

This is one example:

uint8_t TestArray[4] = {0x00,0xff,0x00,0x00};

HAL_SAI_Transmit_DMA(hsai, TestArray, 1);

my configuration of Sai for the transmitter: 

hsai_BlockA1.Instance = SAI1_Block_A;

hsai_BlockA1.Init.AudioMode = SAI_MODEMASTER_TX;

hsai_BlockA1.Init.Synchro = SAI_ASYNCHRONOUS;

hsai_BlockA1.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE;

hsai_BlockA1.Init.NoDivider = SAI_MASTERDIVIDER_ENABLE;

hsai_BlockA1.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_FULL;

hsai_BlockA1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_8K;

hsai_BlockA1.Init.SynchroExt = SAI_SYNCEXT_DISABLE;

hsai_BlockA1.Init.MonoStereoMode = SAI_STEREOMODE;

hsai_BlockA1.Init.CompandingMode = SAI_NOCOMPANDING;

hsai_BlockA1.Init.TriState = SAI_OUTPUT_NOTRELEASED;

if (HAL_SAI_InitProtocol(&hsai_BlockA1, SAI_PCM_LONG, SAI_PROTOCOL_DATASIZE_16BIT, 2) != HAL_OK)

{

Thank you for your help!

#sai-hal_sai_transmit_dma
1 REPLY 1
Imen.D
ST Employee
Posted on August 01, 2017 at 18:09

Hi

Tran.Hung.005

,

In master TX mode, enabling the audio block immediately generates the bit clock for the external slaves even if there is no data in the FIFO, However FS signal generation is conditioned by the presence of data in the FIFO.

After the FIFO receives the first data to transmit, this data is output to external slaves.

In case no data to transmit in the FIFO, 0 values are then sent in the audio frame with an underrun flag generation.

You may refer to the reference manual

http://www.st.com/content/ccc/resource/technical/document/reference_manual/c5/cf/ef/52/c0/f1/4b/fa/DM001248pdf/files/DM001248pdf/jcr:content/translations/en.DM001248pdf

in sectionSerial audio interface (SAI)

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen