cancel
Showing results for 
Search instead for 
Did you mean: 

Cortex M0 - STM32F030R8 Internal Timers and ADC

markjohnson9
Associate II
Posted on October 26, 2015 at 16:18

ST Community - 

An application has the current design parameters for the STM32F030:

CLK: 20MHz external xtal on (PF0 & PF1) internal PLL to 40MHz. Complete. 

MCO: 40MHz CLK/2 = 20MHz out on PA8 (MCO alternate function) to clock external device. Complete.

Now the major internal timer(s) / ADC preferred methodology...

Can PA2 be used in input capture compare mode to capture a rising external pulse to trigger TIM15 CH1 to count for 30uSec (needed delay), then trigger TIM3 CH? to start an 12Bit ADC conversion approximately every 2uSec for 8 samples? I plan to move ADC results into RAM without the use of the DMA. I'm not asking for the code but the feasibility to use 2 internal timers for a delay and to start an ADC conversion for a period of time.

I'm going to post this in the ARM community as well.

Thanks for anyone's input, expertise or other possible approach(s).

8 REPLIES 8
Posted on October 26, 2015 at 17:11

Fixed length burst of pulses, something you'd typically do with one of the Advanced Timers (TIM1/TIM8 ?), using One-Shot and Repetition Count.

Sonar / Ultrasound ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
markjohnson9
Associate II
Posted on October 26, 2015 at 19:17

Same concept as sonar or ultrasound. In the application under design an echo or ring from a pulsed frequency transmission is available for a short period of time to be sampled and averaged. TIM1 is the only advanced timer available and CH1 is used in MCO mode for this device.

Posted on October 26, 2015 at 19:49

I fail to see that PA8 (MCO) precludes the use of TIM1 to internally trigger the ADC 8 times...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
markjohnson9
Associate II
Posted on October 26, 2015 at 20:27

Can TIM1 Ch1 Trigger the ADC internally when PA8 is used for RCC MCO out?

markjohnson9
Associate II
Posted on October 26, 2015 at 21:36

The conflict I'm having with TIM1 CH1 is I need to use it as input capture mode, this can only be done only on PA8 which is MCO out...

markjohnson9
Associate II
Posted on October 26, 2015 at 23:21

I'm going to use TIM1 CH2 as the Input Capture Compare on PA9.

Posted on October 26, 2015 at 23:43

The RM says I can trigger the ADC with TIM1_CH4, or TIM1_TRIG (ie whatever I decide that TIM_TRGO is)

If you are using PA8 with the MCO AF configuration, I'm hard pressed to see that as being usable for TIM1_CH1 in Input Capture, as that's a different AF routing. You're direct experience with the AF Mux might be better than mine, but I don't see this working.

Let's try a different tack. What are you using TIM1 for now? Does that work?

My best stab at this is that you could Slave TIM1 to something that causes the 30us delay, and the TIM1 fires an 8x One-Shot pulse sequence with the desired periodicity.

Not personally using Cortex-M0 (F0) parts for anything.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 26, 2015 at 23:47

I'm going to post this in the ARM community as well.

If you're cross-posting, please link to the other discussion(s)
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..