cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0x: ADC single conversion triggered by OC

stanzanim
Associate III
Posted on September 20, 2016 at 13:55

Hi there

I am trying to set up the output compare value of timer3 in my STM32F030 to trigger a single channel, single shot ADC conversion every 60ms. I'd like to use the HAL drivers (see UM1785, I am bulding the project around the CubeMX). How do I setup the trigger? I suppose I have to write a 16 bit value somewhere to program the OC timeout suited for 60ms. Should I use HAL_TIM_OC_MspInit API? how?

I cannot find example code around, please advice

many thanks
1 REPLY 1
Walid FTITI_O
Senior II
Posted on September 21, 2016 at 11:25

Hi stanzani,

The easy way that you keep the ready-to-use example provided by ST your help source. I recommend that you check the example ''ADC-TriggerMode'' in

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

firmware package at this path: STM32Cube_FW_F0_V1.6.0\Projects\STM32091C_EVAL\Examples\ADC\ADC_TriggerMode

You will figure out then out the TIM and ADC are configured. In example, The timer is used to trigger an ADC measure at 20 KHz.

-Hannibal-