2023-08-21 07:25 PM
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.
GPIO Settings :
We set GPDMA1 channel12 and channel13 for SAI
In main() :
MX_SAIQueue_Config():
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?
2023-08-24 10:24 PM
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)