cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743VIT6 Read VBat with ADC3 using DMA don`t work in CubeIDE 2.2.1

josevsan
Associate

Hello, I have a problem reading VBat voltage with ADC3 and DMA in STM32H743VIT6

If i compile with CubeIDE 1.17.0 and FW 1.12.1 my program works as spected, but if i compile with last CubeIDE 2.1.1 and last FW 1.13.0 my program enter in a infinite loop related to DMA and never execute the while(1) loop.

Can anybody help me?

Thanks in advance.

regards Jose.

My program is very simple (see below):

 

in main.c:

/* USER CODE BEGIN 2 */
HAL_ADC_Start_DMA(&hadc3, &VBat_ChAna, 2);

/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{

Vbat = 4 * (((VBat_ChAna &0xffff) * 3300) / 0xFFFF);/* Convert the result from 16 bit value to the voltage dimension (mV unit) *//* Vref = 3.3 V.*/

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
 

ADC3 configurationADC3 configurationADC3 DMA configurationADC3 DMA configuration

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

> sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;

Slow down the rate of conversions so it isn't stuck in interrupts forever.

 

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

View solution in original post

3 REPLIES 3
mƎALLEm
ST Employee

Hello,


@josevsan wrote:

my program enter in a infinite loop related to DMA and never execute the while(1) loop.

 

 Which DMA infinite loop?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
TDK
Super User

> sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;

Slow down the rate of conversions so it isn't stuck in interrupts forever.

 

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

Thanks for your answer. I change SamplingTime to maximum   810.5 cycles and now works.

My ""DMA infinite loop" seams the processor where stuck in DMA interrupts forewer as you say.