cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger ADC Conversion with a Timer

ee06091
Associate III
Posted on October 12, 2017 at 22:25

http://www.st.com/content/ccc/resource/technical/document/reference_manual/cf/10/a8/c4/29/fb/4c/42/DM00091010.pdf/files/DM00091010.pdf/jcr:content/translations/en.DM00091010.pdf

 talks about ADC external trigger and I don't understand if we can only use the timers for input capture or we can use use a timer event (without external signal) to trigger the conversion.

I want to set a timer to trigger a ADC conversion at 100Hz. I know how to set up a timer to achieve that. I tried per example to start the ADC conversion on a Timer IRQHandler but should be a better way to do that without cpu.

Thank you

#adc-trigger #trigger-timer
1 ACCEPTED SOLUTION

Accepted Solutions
ee06091
Associate III
Posted on November 02, 2017 at 10:40

Thank you all,

I have that working!

View solution in original post

4 REPLIES 4
Posted on October 12, 2017 at 23:12

>>

I don't understand if we can only use the timers for input capture or we can use use a timer event (without external signal) to trigger the conversion.

Either method would work.

You can use the TIM to control periodicity and phase angle when the ADC is fired.

Not sure I've posted examples for the STM32F0, but have for several STM32 SPL platforms

https://community.st.com/0D50X00009XkibiSAB

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
Posted on October 13, 2017 at 04:11

For bringup and debug, use Timer output compare pin connected to the ADC trigger pin. Then you can even trigger your adc by hand and monitor what is happening on an scope. Once this is fine, use the equivalent internal signal (this will tell you which timer to use right from the beginning). No Timer interrupt service routine needed here.

Philippe Cherbonnel
ST Employee
Posted on October 26, 2017 at 12:36

Hi Xavier,

In addition to Clive One comment, there are several examples showing how to use ADC+timer using recent drivers HAL or LL.

The examples are available for each STM32 serie.

For example, in the case of STM32L4, you can find some examples in STM32L4 FW package (can be downloaded here:

http://www.st.com/en/embedded-software/stm32cubel4.html)

.

You can find an example here:

Using driver HAL:

...\Projects\STM32L496ZG-Nucleo\Examples\ADC\ADC_AnalogWatchdog

Using driver LL:

...\Projects\STM32L476RG-Nucleo\Examples_LL\ADC\ADC_SingleConversion_TriggerTimer_DMA
ee06091
Associate III
Posted on November 02, 2017 at 10:40

Thank you all,

I have that working!