Skip to main content
Explorer II
February 17, 2025
Question

ADC Multichannel - DMA on STM32U545

  • February 17, 2025
  • 1 reply
  • 593 views

Good afternoon, 

I have some questions for reading multiple channels of the ADC in continuous mode and map the results in the DMA.

I have been able to monitor the voltage coming from a potentiometer and map it into the DMA and i can see the values in the "Live expression window". For doing so i have had to creater an ADCQueue and an ADCNode for the channel I am monitoring. 

Now, the problem arises when i try to monitor multiple channels. Do i have to create as many Queues and Nodes as channels i have? Do i have to create as many buffers as channels i have and therefore all the links? 

Find attached the part of the code where I declare the buffers: 

/* USER CODE BEGIN 0 */



#define ADC_CONVERTED_DATA_BUFFER_SIZE ((uint32_t) 32)



uint32_t aADCxConvertedData[ADC_CONVERTED_DATA_BUFFER_SIZE];

uint32_t secondVariable[ADC_CONVERTED_DATA_BUFFER_SIZE];



/* USER CODE END 0 */



MX_ADCQueue_Config();

__HAL_LINKDMA(&hadc4, DMA_Handle, handle_GPDMA1_Channel10);



if (HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel10, &ADCQueue) != HAL_OK)

{

Error_Handler();

}

if (HAL_ADC_Start_DMA(&hadc4, (uint32_t *)aADCxConvertedData, (ADC_CONVERTED_DATA_BUFFER_SIZE) ) != HAL_OK)

{

Error_Handler();

}
    This topic has been closed for replies.

    1 reply

    Technical Moderator
    February 17, 2025

    Hello @Marc3 and welcome to the community,

    First, please use </> button to paste your code. See this link. I've edited your post then.

    Second, did you solve your issue in this thread?

    Marc3Author
    Explorer II
    February 17, 2025

    Hi, 

     

    Thank you for your answer. 

     

    No, i have not solved the issue in my past thread. 

     

    I am currently trying to read with the ADC4 peripheral 5 channels to monitor voltages comming from 5 potientiometers. The idea is to trigger the ADC4 with a TIM and read the ADC values in the DMA.

    After posting the first thread you mentioned i thought it would be better to go step by step to try to read first the values from the 5 channels from the DMA and then trigger the ADC with the timer, thats why there are 2 posts ...

     

    Marc

    Technical Moderator
    February 17, 2025

    Did you configure ADC in Scan mode?