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.