Skip to main content
Lee3
Associate III
September 22, 2021
Solved

I2C DMA stall

  • September 22, 2021
  • 2 replies
  • 1844 views

I'm configuring i2c with dma using the registers directly. I'm sure I have an error somewhere but I don't have a great idea on where to go next with debugging. Sometimes my i2c transfer goes through expediently, but sometimes it has a long stall after the address portion. Currently dma is only being used for this one peripheral. In the below scope trace, the purple is a gpio set in my function where the dma is set up, followed by an i2c start. I don't see how it could wait for 60 us before sending the data. Does anyone have any ideas what might cause this or where to look?

0693W00000FA9SEQA1.pngMy i2c clock and apb clock are both set to 170 MHz. There is a note in the errata about i2c stall, but it doesn't seem to apply.

This topic has been closed for replies.
Best answer by Lee3

Thanks for the help. Per your comment I did try the two boards comdma, though I couldn't quite get it to work right with the toolchain that I tried. So I looked more at the original problem and realized that it was the device that was doing clock stretching not the stm32.

0693W00000FAHOyQAP.png

2 replies

ST Technical Moderator
September 23, 2021

Hello @Lee,

I advise you to check and compare your code/config with the I2C example available under STM32CubeG4 MCU package, to use I2C via DMA, like this one:

\STM32Cube_FW_G4_V1.4.0\Projects\NUCLEO-G431RB\Examples\I2C\I2C_TwoBoards_ComDMA

Have a look also at this FAQ "STM32 I2C does not work", which describes few tips related to I2C peripheral on STM32 devices.

When your question is answered, please close this topic by choosing Select as Best.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Lee3
Lee3AuthorBest answer
Associate III
September 23, 2021

Thanks for the help. Per your comment I did try the two boards comdma, though I couldn't quite get it to work right with the toolchain that I tried. So I looked more at the original problem and realized that it was the device that was doing clock stretching not the stm32.

0693W00000FAHOyQAP.png