Skip to main content
CDesh
Associate III
May 31, 2021
Solved

Multiple ADC channels on STM32L072xx

I am using STM32L072xx module and I would like to use ADC4, ADC5 and ADC 17 (Vrefint) at the same time. But I want to use ADC4 with DMA of buffer size 500 or more. It is not necessary to store ADC5 & ADC17 in DMA.

Can I use DMA only for ADC 4 and dump 500 samples and use the following API calls for ADC5 and ADC17?

  HAL_ADC_Start( &hadc);

  /* Wait for the end of conversion */

  HAL_ADC_PollForConversion( &hadc, HAL_MAX_DELAY );

  /* Get the converted value of regular channel */

  adcData = HAL_ADC_GetValue ( &hadc);

Is this the right way of configuring multiple ADC channels?

This topic has been closed for replies.
Imen.DBest answer
ST Technical Moderator
June 1, 2021

Hello @CDesh​ ,

You'll probably want to review the working "ADC_DMA_Transfer" example within the STM32CubeL0 MCU package and you can get inspired from this:

STM32Cube_FW_L0_V1.12.0\Projects\NUCLEO-L073RZ\Examples\ADC\ADC_DMA_Transfer

Imen

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. Thanks

11 replies

Philippe Cherbonnel
ST Employee
August 9, 2021

Hello @CDesh​ ,

Good you have found the cause of your issue.

If it is a matter of interruption occurring too often in your application, leading to interrupt overhead, there is no obvious solution. Some choices have to be done at application level: either slow down interruptions rate is possible, or disable less important peripherals (as you have done), or optimize interruptions priority and manage occurrences missing of the ones with lowest priorities.

Best regards

Philippe