cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575(Nucleo-U575ZI-Q) SAI Transmit/Receive

Brian Wang
Associate

When we use STM32U575 communicate with codec(ES8374) on SAI(I2S Bus). In SAI(I2S Bus),  STM32U575 is master and codec is slave. In STM32CubeMX, STM32U575 use SAI1a to Transmit with mode : Master with Master Clock OUT and use SAI1b to Receive with mode : Synchronous Slave. Set SAIa for Transmit and set SAIb for receive.

01.PNG

02.PNG

03.PNG

04.PNG

GPIO Settings :

05.PNG

We set GPDMA1 channel12 and channel13 for SAI

06.PNG

07.PNG

In main() :

08.PNG

MX_SAIQueue_Config():

09.PNG

When we use HAL_SAI_Transmit_DMA(&hsai_BlockA1, (uint8_t *)PlayBuff, PLAY_BUFF_SIZE), MCLK,SCLK,LRCK is working. TX pin transmit data to codec, and codec have sound on speaker. But we use HAL_SAI_Receive_DMA(&hsai_BlockA1, (uint8_t *)RecordBuff, RECORD_BUFF_SIZE), LRCK is not working(MCLK,SCLK is normal). 

We also change Tx and Rx for test. We set SAIa for receive, and set SAIb for transmit. In tihs case, HAL_SAI_Receive_DMA(&hsai_BlockA1, (uint8_t *) can work, but HAL_SAI_Transmit_DMA(&hsai_BlockA1, (uint8_t *)PlayBuff, PLAY_BUFF_SIZE) can not work. Is there anything wrong with my settings?

  

1 REPLY 1
Hugo0210
Associate

Hi, Brian,

I suppose you suffered FS with no signal at master RX mode, right? 
SAI_1 subblock A MCLK, FS, SCLK, DATAOUT (SPK)
SAI_1 subblock B DATAIN (DMIC)