Skip to main content
MIerv.1
Associate
November 10, 2020
Solved

Can't get HAL_I2C_Master_Transmit_DMA to work, stuck on HAL_I2C_STATE_BUSY_TX

  • November 10, 2020
  • 1 reply
  • 1746 views

Hi everyone!

This is my first time with I2C on the STM32 platform so I may be missing something trivial.

I'm using an STM32WB55RG and I'm trying to use an Adafruit IS31FL3731, which works with I2C.

I ported the Arduino library (https://github.com/adafruit/Adafruit_IS31FL3731/blob/master/Adafruit_IS31FL3731.cpp) using the HAL functions.

If I use blocking functions, everything works, but if I try to use DMA for non-blocking code, the program gets stuck on HAL_I2C_STATE_BUSY_TX after having called HAL_I2C_Master_Transmit_DMA.

I've searched a bit and tried different solutions but none of them work. What's wrong with the code?

Thanks in advance

Matteo Iervasi

This topic has been closed for replies.
Best answer by MIerv.1

Ok I've solved it (forgot to update the thread sorry). It was a very stupid error.

Everything was ok with the configuration, interrupts, callbacks, etc., but looking with the debugger I found out that I forgot to declare the I2C_HandleTypeDef as a pointer and the definition in the library was effectively a copy.

Now everything works ok.

Best regards

Matteo Iervasi

1 reply

MIerv.1
MIerv.1AuthorBest answer
Associate
November 23, 2020

Ok I've solved it (forgot to update the thread sorry). It was a very stupid error.

Everything was ok with the configuration, interrupts, callbacks, etc., but looking with the debugger I found out that I forgot to declare the I2C_HandleTypeDef as a pointer and the definition in the library was effectively a copy.

Now everything works ok.

Best regards

Matteo Iervasi