Skip to main content
Visitor II
February 24, 2020
Question

STM32H7 Duplex I2S cannot TX/RX simultaneously through the HAL.

  • February 24, 2020
  • 10 replies
  • 3776 views

Hi.

HAL_I2S_Transmit_DMA() and HAL_I2S_Receive_DMA doesn:'t work simultaneously. As a result, programmer cannot use I2S TX and RX together in the STMH7 Duplex I2S.

  • STM32H743
  • CubeIDE 1.2.1
  • STM32Cube FW_H7 v1.6.0

Attached screenshot points where the API returns error, and the attached project demonstrate the problem on Nucleo H743ZI.

In this program, I2S1 is configured as duplex master. Thus, TX and RX functions are available. The program checks the return code from API and display on LED.

LED2 (Blue) tests the TX API.

  • Turn On : HAL_OK
  • Blink : Not HAL_OK

LED2 (Red) tests the RX API.

  • Turn On : HAL_OK
  • Blink : Not HAL_OK

You can see the Blue LED turns on and Red LED blinks. If you remove the TX API call from program, RX API works well. Thus, this is interference of the both APIs.

Please check and fix.

    This topic has been closed for replies.

    10 replies

    Super User
    February 24, 2020

    I don't use 'H7 and I don't use Cube/HAL, but isn't the SPI/I2S module simplex?

    0690X00000DCBfkQAH.png

    You may want to have a look at SAI.

    JW

    Super User
    February 25, 2020

    The DS may be wrong... RM suggests the I2S in SPI can work in duplex.

    But there may be obstacles in Cube/CubeMX:

    https://community.st.com/s/question/0D50X0000CArlTHSQZ/fullduplex-i2s-with-master-clock-output-on-stm32h7-in-stm32cubeide

    JW

    PS. @Imen DAHMEN​  , can you please verify if the 'H743 I2S can indeed be used in Duplex, and if so, perhaps correct in the DS?

    Technical Moderator
    February 27, 2020

    Hello,

    Thanks for the report.

    We are aware of this limitation: I2S Full duplex Transmit/receive feature is not supported by the STM32H7 HAL Driver.

    We have already listed this issue and it will be fixed in the coming releases of cubeH7 firmware package.

    I will check the document and raise your feedback internally to the STM32CubeIDE team, then I come back to you soon with update.

    Best Regards,

    Imen

    TakemasaAuthor
    Visitor II
    February 28, 2020

    Thanks, Imen

    Takemasa

    Super User
    February 28, 2020

    Hi Imen,

    Thanks for the report on CubeID.

    But, I mean, the DS, as in my first post above, says the I2S is only simplex, whereas according to RM, it appears to be duplex.

    Can the DS be please checked and corrected if needed?

    Thanks,

    Jan

    @Imen DAHMEN​ 

    Technical Moderator
    February 28, 2020

    Hi Jan,

    I confirm, the datasheet is wrong. I raised your request to correct the STM32H7 Datasheets.

    For example, rephrase as follow: “They can be operated in master or slave mode, in simplex or full-duplex communication modes.�?

    Best Regards,

    Imen

    Super User
    February 28, 2020

    Thanks, Imen!

    Jan

    @Imen DAHMEN​ 

    Visitor II
    November 13, 2020

    Sorry to revive an old thread but I'm having similar difficulties in getting full duplex i2s working with DMA on the H7 as well. Has this been fixed?

    With hi2s1.Init.Mode = I2S_MODE_MASTER_TX, neither the TX or RX callbacks get called.

    With hi2s1.Init.Mode = I2S_MODE_MASTER_RX, the RX callback gets called and my RX buffer gets copied into my TX buffer but nothing gets out.

    Graduate II
    November 15, 2020

    It has a I2S_MODE_MASTER_FULLDUPLEX mode. But take a note that the HAL team is generally incapable of understanding asynchronous software design and the related issues...

    Visitor II
    November 15, 2020

    @Piranha AH! You're right, it does! The funny thing though is that I did set up my I2S as "Full duplex master" in Cube and yet it put the Mode as I2S_MODE_MASTER_RX.

    I'll give it a try today - I mean, it works well on the F4!

    Thank you

    Visitor II
    November 15, 2020

    @Piranha​ It works! I had to set the mode to Full Duplex Master and Transmission Mode as Master Transmit and *then* go and change  hi2s1.Init.Mode = I2S_MODE_MASTER_FULLDUPLEX; in the init code.

    That's very weird. I'm relatively inexperienced with STM32 and I would imagine that I will eventually rely less on Cube but for now, I'm just happy that it finally works.

    Thank you!