Skip to main content
one V
Associate III
February 26, 2019
Question

STM32H7's I2C4+BDMA method cannot read sensor data

  • February 26, 2019
  • 5 replies
  • 2313 views

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.

This topic has been closed for replies.

5 replies

After Forever
Senior III
February 26, 2019

> 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?

one V
one VAuthor
Associate III
February 26, 2019

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

After Forever
Senior III
February 26, 2019

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

one V
one VAuthor
Associate III
February 26, 2019

The function used is HAL_I2C_Mem_Read_DMA and SCB_InvalidateDCache_by_Addr.

After Forever
Senior III
February 26, 2019

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.

one V
one VAuthor
Associate III
February 26, 2019

.........

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
Associate III
June 26, 2019

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
one VAuthor
Associate III
July 10, 2019

Yes, you're right.

0690X000009Yc0XQAS.png

mkrug
Associate III
November 14, 2019

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

waclawek.jan
Super User
November 14, 2019

Read out and check the relevant I2C, DMAMUX and DMA registers.

You may want to start with the DMAMUX, and the I2C_CR1.RXDMAEN bit.

CubeMX-generated code? Maybe one of those "swapping calls solved the problem" eg. cases https://community.st.com/s/question/0D50X0000BcPXk2SQG/32f746-usart-dma-with-stemwin-not-working ?

JW