Skip to main content
Associate III
Question

STM32H7 ADC DMA Read Problem: Value Not Updating, Callback Not Triggered

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!

    This topic has been closed for replies.

    4 replies

    Karl Yamashita
    Super User

    You didn't enable the NVIC for the ADCx

     

    KarlYamashita_1-1752268980518.png

    I would disable Continuous Conversion Mode. 

    KarlYamashita_2-1752269096402.png

    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.

     

     

    If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
    durnaAuthor
    Associate III

    Thank you for your feedback, I tried the methods you mentioned but did not get any positive results.

    ST Technical Moderator
    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om