cancel
Showing results for 
Search instead for 
Did you mean: 

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

tobias2
Associate II
Posted on October 28, 2016 at 14:45

Hello,

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;-) Greets, Tobi #i2c #stm32 #hal #dma #cubemx
1 REPLY 1
tobias2
Associate II
Posted on October 31, 2016 at 12:58

Since I changed to use the separate ''Mem'' functions to read/write to the chip, it works.

It is still not clear to me, why it was changed since last HAL and why it was different before.

Greets,

Tobi