cancel
Showing results for 
Search instead for 
Did you mean: 

Is ADC1&2 in Multimode with Timer Trigger and ADC3 standalone Software-Triggered possible?

Daniel Studer
Associate II

Hi,

I'm using STM32F767 and it's ADC. This STM has 3 ADC.

I configured the ADC1 & ADC2 in multimode which is triggered by a timer. I also use DMA for data transfer. ADC1 and ADC2 both convert 2 channels (I measure voltage and current of two channels simultaneously).

ADC3 is configured as standalone to convert 5 channels, software started, also using DMA.

Configuring is done with HAL-libray.

ADC1 and ADC2 are working correct, but when I start the ADC3 no interrupt is generated of ADC3. I looked into HAL-driver for ADC start with DMA and the problem there is, when one ADC is configured in Multi-Mode, no software start is possible for another ADC.

When I doesn't configure ADC1 and ADC2 in Multi-mode and doesn't start it, ADC3 is running correctly. When I start ADC3 with DMA, the Bit ADC_CR2_SWSTART is set. But with ADC1 & ADC2 in Multi-mode, this bit is never set becaus of line 1.

Here is a code part of HAL Library (function HAL_ADC_Start_DMA):

...

1 if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI))

2 {

3      /* if no external trigger present enable software conversion of regular channels */

4      if((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)

5      {

6        /* Enable the selected ADC software conversion for regular group */

7        hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;

8      }

9 }

10 else

11 {

12      /* if instance of handle correspond to ADC1 and no external trigger present enable

13 software conversion of regular channels */

14     if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))

15     {

 16      /* Enable the selected ADC software conversion for regular group */

17         hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;

18     }

19}

...

If I comment line 1,2 and 9, everything is working. ADC1 and ADC2 are running with timer trigger and ADC3 is running with software trigger.

Is this a fault of HAL-driver or is it just not a good idea to run ADC as I want?

Thanks for helping.

Dani

1 REPLY 1
Tomas DRESLER
Senior II

Dear Dani,

is the ADC3->CCR.MULTI set or not? Normally it shouldn't , please check whether this bit isn't accidentally set by setup code.

Further, your setup is perfectly right and ADCs can be used this way.