2021-09-16 03:41 AM
I am a beginner and learning I2C DMA, could you tell me what I'm doing wrong?
I connected the LCD to Blue Pill and it works fine with function "HAL_I2C_Master_Transmit" i.e. without DMA!
But, when DMA is configured, it is dosn't works!
Very simple code, but I can not find a mistake!
Link to my main.c https://pastebin.com/cz7b2Bbu
Solved! Go to Solution.
2021-09-16 03:56 AM
Hello @DK.7
I advise you to start with the I2C example available under STM32CubeF1 MCU package, to use I2C via DMA:
\STM32Cube_FW_F1_V1.8.4\Projects\STM32F103RB-Nucleo\Examples\I2C\I2C_TwoBoards_ComDMA
Have a look at this FAQ "STM32 I2C does not work" 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
2021-09-16 03:47 AM
You need to wait for the transfer to complete before starting another DMA transfer. You can do so by polling the state of the handle.
You should always monitor the return status from HAL_* to verify it succeeds (HAL_OK).
2021-09-16 03:56 AM
Hello @DK.7
I advise you to start with the I2C example available under STM32CubeF1 MCU package, to use I2C via DMA:
\STM32Cube_FW_F1_V1.8.4\Projects\STM32F103RB-Nucleo\Examples\I2C\I2C_TwoBoards_ComDMA
Have a look at this FAQ "STM32 I2C does not work" 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
2021-09-16 06:01 AM
Thanks for answers! I rewrote my code according to the example, but something does not work! Link to my new main.c https://pastebin.com/BvDa3ivg
2021-09-16 08:10 AM
I found my mistake, one more time THANK YOU!
my code now https://pastebin.com/yP56NqX8