cancel
Showing results for 
Search instead for 
Did you mean: 

ADC

BoboyeOkeya
Associate III

Hi All,

I would like to configure my ADC such that it is able to read from 2 channels. And that the conversion of the channels will be stored in the memory through DMA. But most importantly, I want the conversion to be triggered by a TIMer's rising/falling edge.

So basically multichannel ADC conversion triggered by timer and stored through DMA.

Can anyone point me in the right direction to look at, links, books? etc. I am presently working with an STM32F031C6 MCU.

Many thanks

4 REPLIES 4
Amel NASRI
ST Employee

Hi @BoboyeOkeya​ ,

A step by step hands-on is described in this video: Trigger Periodic ADC Conversions.

As it is based on STM32CubeMX/STM32CubeIDE, you can select your target MCU but the steps will be almost the same.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Amel,

This has been very useful.

Can you also help with links to a multchannel ADC using DMA and timer trigger?

Many thanks.

The video ADC DMA TIM HAL lab will answer your need.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Philippe Cherbonnel
ST Employee

Hello @BoboyeOkeya​ ,

Additionally to previous post, you can refer to examples in FW packages.

For example in STM32F0 FW package:

Using ADC LL driver:

...\Firmware\Projects\STM32F072RB-Nucleo\Examples_LL\ADC\ADC_SingleConversion_TriggerTimer_DMA

Using ADC HAL driver:

a combination of these 2 examples using DMA and trigger from timer:

...\Firmware\Projects\STM32F072B-Discovery\Examples\ADC\ADC_DMA_Transfer

...\Firmware\Projects\STM32F072B-Discovery\Examples\ADC\ADC_TriggerMode

About conversion triggered by timer rising/falling edge:

It is possible using these literals:

LL driver: LL_ADC_REG_TRIG_EXT_RISINGFALLING

HAL driver: AdcHandle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING;

Best regards

Philippe