2026-03-27 7:40 AM - last edited on 2026-03-27 7:47 AM by mƎALLEm
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 configuration
ADC3 DMA configuration
Solved! Go to Solution.
2026-03-27 8:41 AM
> sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
Slow down the rate of conversions so it isn't stuck in interrupts forever.
2026-03-27 7:51 AM
Hello,
@josevsan wrote:
my program enter in a infinite loop related to DMA and never execute the while(1) loop.
Which DMA infinite loop?
2026-03-27 8:41 AM
> sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
Slow down the rate of conversions so it isn't stuck in interrupts forever.
2026-03-27 9:40 AM
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.