Skip to main content
Visitor II
October 23, 2025
Question

STM32M4 (TX) transmits i2s data to another STM32M4 (RX) fails

  • October 23, 2025
  • 4 replies
  • 502 views

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:

JuliusChen_0-1761197501348.png

JuliusChen_1-1761197527804.png

RX:

JuliusChen_2-1761197568551.png

JuliusChen_3-1761197591296.png

Let me know if you need more information,

thanks!!!

 

 

    This topic has been closed for replies.

    4 replies

    Super User
    October 23, 2025

    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. :) )

    Visitor II
    October 27, 2025

    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?

    Technical Moderator
    October 23, 2025

    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

     

    Super User
    October 23, 2025

    Looks like HAL_I2S_Transmit_IT is not keeping up with the needed data. Use HAL_I2S_Transmit_DMA instead.

    Visitor II
    October 27, 2025

    Thanks for your reply,

    I have tried to start RX and TX with DMA circular mode, but it still doesn't work

    Super User
    October 27, 2025

    > STM32F4CEUX

    Still not a chip that exists.

    I don't think the issue is within the code that you've presented.

    Super User
    October 27, 2025

    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 ... ?

    Visitor II
    October 27, 2025

    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.