cancel
Showing results for 
Search instead for 
Did you mean: 

Can I count pulses on TIM2 and cascade to TIM3?

Posted on September 10, 2010 at 09:49

Can I count pulses on TIM2 and cascade to TIM3?

2 REPLIES 2
lipin
Associate II
Posted on May 17, 2011 at 14:06

Hi,

I may help but wow you confused me and I need some clarification.

I would like TIM2 to count pulses on an external pin (PA0-WKUP) and when it has counteda fixed number (say 50) it cascades to TIM3.

What does that mean cascades? Should it increase TIM3??

In the meantime TIM3 is counting the internalclock

Well I guess my previous sentence is not valid if TIM3 is counting internal clock or should I add 1 to it?

When TIM2kicks TIM3, TIM3 interrupts and I can get its count.

And now reaching TIM2 to 50 triggers TIM3 I am really confused.

Dou you want behavior like this (

measuring low frequency?):

TIM3 is counting internal clock. When TIM2 reaches 50 it zeroes itself and get reading of TIM3 counter?

Please put it in step by step instructions then i will work it out for you.

Regards

Thomas

Posted on May 17, 2011 at 14:06

Hi 

Thomas,

Thanks for answering so quickly. I'm sorry my original post was not very clear. After hours of trying to fix this I have an answer but just in case anyone else has this problem I'll try to explain what I was doing and the fix.

What I was looking for was to see how long it took (in clock ticks) for an input pin to see 50 cycles. So TIM2 has to count to 50 input pulses while TIM3 counts ticks. When TIM2 has finished it signals TIM3 which captures its count.

What I have is TIM2 in downcount mode with ARR set to 50 and its input set to TIM_TS_ETRF. The 1st problem was that I did not set its clock so now I'm using TIM_ETRClockMode2Config. Tim3 was just missing TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_TRC;

All is well now.

Thanks again.

Andy.