2025-10-22 10:42 PM
I am trying to use one STM32M4 as TX, and another STM32M4 as RX,
but RX can't receive the correct i2s data that TX transmits.
TX transmits 16bits data by HAL_I2S_Transmit_IT(&hi2s2, i2s_dummy_buffer, 16);
RX receives 16bits data by HAL_I2S_Receive_DMA(&hi2s2, i2s_received_buffer, 16);
The results:
1) If TX transmit 0,1,2,...,15:
RX receives:
[0] = 0xC000 [1] = 0x0000 [2] = 0x4000 [3] = 0x8000
[4] = 0xC001 [5] = 0x0001 [6] = 0x4001 [7] = 0x8001
[8] = 0xC002 [9] = 0x0002 [10]= 0x4002 [11]= 0x8002
[12]= 0xC003 [13]= 0x0003 [14]= 0x4003 [15]= 0x8003
2) If TX transmits 16bits of 0xAAAA
RX receives 16bits of 0xAAAA
3) If TX transmits a sin wave
RX receives 16bits of unknown number
The following is TX and RX's config:
TX:
RX:
Let me know if you need more information,
thanks!!!
2025-10-23 12:31 AM
Which cpu is STM32M4 ?
+
As I2S is a kind of SPI and you seem to set the rx and tx I2S correct - you put some wrong data to the tx array,
or dma reads on wrong address ..etc.
But fundamentally I2S is for continuous running streams, not just put some number in , to test it.
So start the rx and then tx with circular DMA on both and in callbacks put in data to tx arrays, or zero, to "pause",
but never stop it. And it will work, as it should.
(I made some audio players...so i know. :) )
2025-10-23 3:12 AM - edited 2025-10-23 6:00 AM
Hello @JuliusChen and welcome to the community;
Could you please give more details about the issue? How to write your question to maximize your chance... - STMicroelectronics Community
Please try to transmit data with DMA mode. Are you facing the same issue?
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-10-23 5:56 AM
Looks like HAL_I2S_Transmit_IT is not keeping up with the needed data. Use HAL_I2S_Transmit_DMA instead.
2025-10-26 8:04 PM - edited 2025-10-26 9:36 PM
Thanks for your reply,
I use STM32F4CEUX,
I have tried to start RX and TX with DMA circular mode, but it still doesn't work
Do you mean I can't transmit fake data like 0-15?
If I transmit a fake sin wave, can it work?
2025-10-26 9:37 PM
Thanks for your reply,
I have tried to start RX and TX with DMA circular mode, but it still doesn't work
2025-10-27 6:41 AM
> STM32F4CEUX
Still not a chip that exists.
I don't think the issue is within the code that you've presented.
2025-10-27 6:54 AM
Hi @JuliusChen ,
>Let me know if you need more information
1. The correct names of the involved chips and cpu's ?
2. why I2S ? for audio ... ?
2025-10-27 4:37 PM
Sorry...
Chip : STM32F411CE
2025-10-27 4:47 PM
1.STM32F411CE
2.I want to record a sound in PC using my device (CPU:STM32F411CE(slave), audio codec(master), DMIC, tinyUSB UAC).
However, the current issue is STM32F411CE can't receive the correct i2s data from audio codec.
So, I want to do a experiment that both TX and RX use STM32F411CE to test STM's I2S DMA function.