cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 ADC Dual regular simultaneous, Multichannel (scan), single conversion mode

raron
Associate
Posted on June 05, 2016 at 02:32

Hello,

I would like to use the uC to measure three-phase power. I have six analog channels (3 for the voltages, and 3 for the currents). I would like to use the ADC1 and ADC2 to simultaneously sample the voltage and the current of each of the phases.

Based on the AN3116 I need to use the dual regular simultaneous, multichannel (scan), single conversion mode of the ADC.

I would like to start the conversation of the three phase with a timer interrupt to set the sampling frequency.

I have set up the three channels per ADC in the STM32CubeMX, but I don't get real results.

I tried to copy the results with DMA to a buffer of uint32, but only the lower half of the words were actual ADC values (the three samples of the same ADC), the upper half was static random value (changed only at reset).

I started the conversation with the HAL_ADCEx_MultiModeStart_DMA function with the master (ADC1) as argument.

After that I tried the interrupt config, I start the conversation with HAL_ADC_Start_IT(slaveADC); HAL_ADC_Start_IT(masterADC);

It works fine if I only use one (pair) channel, but if set up three channels for scanning, I only get two interrupt / callback (HAL_ADC_ConvCpltCallback).

The attached the STM32CubeMX config was used in this configuration.

Have anybody met some problem like this?

How can I correctly set up the ADC for this operation?

uC: STM32L476RG

board: Nucleo-L476RG

STM32CubeMX version: 4.15

stm32l4xx_hal_adc version: V1.4.0

1 REPLY 1
slimen
Senior
Posted on June 08, 2016 at 15:22

Hi raron,

You can find this ADC example under 

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubel4.html

firmware package, that can help you using the ADC peripheral to convert several channels :

STM32Cube_FW_L4_V1.5.0\Projects\STM32L476RG-Nucleo\Examples_LL\ADC\ADC_MultiChannelSingleConversion

Regards