cancel
Showing results for 
Search instead for 
Did you mean: 

I2C wrong slave address with STM32F429

Lecordier.Guy
Associate III
Posted on February 09, 2018 at 14:52

STM32F4xx HAL drivers V1.7.3 / 22-December-2017

I get some data by HAL_I2C_Master_Receive_DMA() and HAL_I2C_Mem_Read_DMA()

I found that a wrong Slave address could be sent when using the HAL_I2C_Mem_Read_DMA() due to the I2C interruption enabled.

In HAL_I2C_Master_Receive_DMA(), the address is sent by the EV interruption (HAL_I2C_EV_IRQHandler()).

In HAL_I2C_Mem_Read_DMA(), the address should be sent sequentially after the START flag but as the I2C interruptions are enabled, the address is sent by the EV interruption after START is generated (I2C_RequestMemoryWrite()) so a wrong address is sent.

So HAL_I2C_Master_Receive_DMA() and HAL_I2C_Mem_Read_DMA() should be called with the I2C interruptions disabled.

To have a correct behavior I disable the I2C interruptions in the CpltCallback().

Regards

1 REPLY 1
john doe
Lead
Posted on February 10, 2018 at 04:27

is this why i have to push the reset button twice on my f446 nucleo to kickstart the i2c?  i've tried several other 'fixes' but none work. same code, same slaves work fine on f7 and L4. got example code?