AnsweredAssumed Answered

STM32F429 / HAL 1.5.2 / I2C read with DMA is broken?

Question asked by TobiB on Oct 28, 2016
Latest reply on Oct 31, 2016 by TobiB

I'm trying to solve a problem with I2C and the new HAL 1.5.2.
Since HAL 1.5.1 very much code was modified in the file stm32f4xx_hal_i2c.c.

With version 1.5.1 it worked like that:
HAL_I2C_Master_Transmit(&I2c3Handle, (uint16_t)slave_adr, (uint8_t*)I2C3_DATA, 1, I2C3_TIMEOUT)

HAL_I2C_Master_Receive_DMA(&I2c3Handle, (uint16_t)slave_adr, (uint8_t *)I2C3_DATA, cnt)

After that, the transfer starts and then the callback function HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
was called, so I could use the read values.

Beside some other changes the function HAL_I2C_Master_Receive_DMA was also changed in the new HAL:
One difference is, the HAL_I2C_Master_Receive_DMA was calling internally
I2C_MasterRequestRead(hi2c, DevAddress, I2C_TIMEOUT_FLAG, tickstart) != HAL_OK
(to Request Data from the slave?!?)

But this is missing in the new HAL. In the receive version without DMA, both the old and the new HAL calls the function MasterRequestRead.

So I wonder:
1. Is this a bug and if yes how can I correct it? Or was this a bug before and now it is correct?
2. How to use exactly the DMA reception of some values over I2C? The documentation is unfortunatelly not accurate enough (to me). In my case (requesting some values from a LSM9DS0) I need to write the address for the register and then receive multiple bytes (6 at the moment)

Please help me;-)