cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7's I2C4+BDMA method cannot read sensor data

one V
Associate III

Reading sensor data using the STM32H7's I2c4+BDMA method was unsuccessful. It is okay to simply use I2C4 or other i2c+DMA methods. The read function when using BDMA is HAL_I2C_Mem_Read_DMA, and when BDMA is not used, it is HAL_I2C_Mem_Read.

10 REPLIES 10

> Why?

Most likely because you are doing something wrong. How should we know "why" without any provided code and/or detailed description of your problem?

Have you used STM32H7's I2C4+DMA method to read sensor data?

No, but I have used STM32L4's I2Cx+DMA to write data into I2C EEPROM.

one V
Associate III

The function used is HAL_I2C_Mem_Read_DMA and SCB_InvalidateDCache_by_Addr.

OK, but this is only the Cube file. Where is your code where you are trying/failing to read the sensor data? Show both versions (working, without DMA and not working, with DMA). Then we can see what's different and try understand what's wrong.

.........

Since there is an ioc file, you can just generate code tests directly. You can use the HAL_I2C_Mem_Read function to read data when not using BDMA, and you can use HAL_I2C_Mem_Read_DMA to read data when using BDMA.

A Maq
Senior

I figured out that problem. The buffer that you putting received value in should be mapped to or stored at a location on SRAM3 as BDMA can only read from SRAM3 or peripheral not normal memory.

If you require further assistance please reply to that post I will ​provide further details how to map it etc.

one V
Associate III

Yes, you're right.

0690X000009Yc0XQAS.png

mkrug
Associate III

I have more-less the similar problem. I'm using the STM32H7DISCO board.

I2C works fine without BDMA. However, I can see in the I2C Rx register that after issuing the HAL_I2C_Mem_Read_DMA() command the Rx register is getting filled with reasonable values. However, the BDMA channel byte counter is not reduced at all, although source and destination address is correct (including the above mentioned address in SRAM4) and the BDMA channel is enabled. Also the register I2C_CR1 looks ok to me. But somehow the BDMA is not fetching the data and somehow ignoring what is going on on the I2C. Any hint?

Best Regards

Markus