2025-07-11 11:13 AM
Hello,
I am using an STM32H755. I want to read a potentiometer via ADC and transfer the value to a variable using DMA. I have configured everything with CubeMX (ADC1, DMA, channel, sampling time, etc.) and I start the conversion with HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&adc_dma_val, 1).
When I use polling mode, ADC works perfectly and I get correct values.
However, when I try to read with DMA:
The adc_dma_val variable remains 0 and is never updated.
The HAL_ADC_ConvCpltCallback function is never triggered.
All init functions (MX_DMA_Init, MX_ADC1_Init) are called in the correct order, DMA interrupt handler is active.
ADC and DMA clocks are enabled.
There seems to be no issue in the code, and the hardware wiring is correct.
I have been struggling with this issue for a while. If anyone has experienced a similar problem or has an idea, I would appreciate your help.
I am attaching my source code.
Thank you!
2025-07-11 2:23 PM - edited 2025-07-11 2:27 PM
You didn't enable the NVIC for the ADCx
I would disable Continuous Conversion Mode.
You can either call the HAL_ADC_Start_DMA in the HAL_ADC_ConvCpltCallback
Or better yet, use a timer to trigger the ADC conversion in a timely fashion.