cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get HAL_I2C_Master_Transmit_DMA to work, stuck on HAL_I2C_STATE_BUSY_TX

MIerv.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
MIerv.1
Associate II

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

View solution in original post

1 REPLY 1
MIerv.1
Associate II

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