cancel
Showing results for 
Search instead for 
Did you mean: 

Possible a bug in DMA using STM32F767ZI and CUBE v5.6.0 and firmware STM32F7 1.16.0 and SW4STM32

JMJV
Associate II

Dear ST technical support

I'm working with a temperature sensor TMP102 and NUCLEO STM32F767ZI with I2C communication mode. CUBE v5.6.0 and firmware STM32F7 1.16.0, and SW4STM32.

Well, I started to read the sensor and I tested the next commands:

HAL_I2C_Mem_Read(); //it works properly and reads the sensor

HAL_I2C_Mem_Read_IT(); // it works properly and reads the sensor

HAL_I2C_Mem_Read_DMA(); //not working, value not updated, only when RESET is pressed on the nucleo board

However the first two commands work fine, but when I'm trying to use the I2C in DMA mode, this one is not working and only update the value every time that I press reset button of the NUCLEO board. I configured the CUBE project in CIRCULAR (correct one) and NORMAL mode, but no changes.

The I2C in DMA mode should works similar to ADC in DMA mode, should update the value of the register if this one is configured as CIRCULAR mode, right?

So, I don't know what else must be wrong with my code or IOC project. I'm attaching my project with the INC, SRC, and IOC files (see "main.c" line 82 to replace 83 by DMA).

I hope you can help me to solve this issue, I will be waiting for your feedback. THANKS!

Best!

3 REPLIES 3
TDK
Guru

> The I2C in DMA mode should works similar to ADC in DMA mode, should update the value of the register if this one is configured as CIRCULAR mode, right?

The ADC and the I2C peripherals have different usage patterns. For ADC, writing values continuously to a circular buffer makes sense. For I2C, one typically doesn't just write values to a circular buffer indefinitely. Perhaps add more detail about what you're trying to do. Maybe that really is your intention.

If you feel a post has answered your question, please click "Accept as Solution".
JMJV
Associate II

Well, ignoring the ADC in whatever mode. I want to focus only in the I2C communication protocol.

If you try to read any sensor by using I2C protocol, with the commands HAL_I2C_Mem_Read(); or HAL_I2C_Mem_Read_IT(); you can continuously read the value of that "desired" register without any problem.

But, is not the same when you use HAL_I2C_Mem_Read_DMA(); the value is not updated like there is something missing in the configuration or maybe I need to start something additional in the code (please check my I2C CUBE configuration (see picture) is based on the application note for STM32F7).

0693W000000VaDwQAK.jpg

Let me explain you what is the advantage by using DMA (Direct Memory Access) it is a way of reading or writing to memory without using the CPU of the microcontroller. I need to use I2C in DMA mode because I have other sensor that stream 6 byte.

This is what you can read from HAL_I2C_Mem_Read_DMA() specifications "Reads an amount of data in non-blocking mode with DMA from a specific memory address".

Best!

JMJV
Associate II

Anyway I got it, is working! I2C1_RX must be configured like Mode: NORMAL, my mistake