cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 Input pulse capture w/ compare?

cphelan
Associate II
Posted on September 26, 2014 at 14:47

Greetings. I am trying to determine the best methodology to capture an input pulse train (from a motor encoder), compare the input count to a set point, and generate an event when the input count reaches the setpoint. I know I can set a timer up for input capture, generate an interrupt per pulse, and count/react in the ISR, but I'd rather not deal with the processor burden of excessive interrupts. It seems like I want a hybrid of input capture and output compare, but I'm not sure of the best way to accomplish this. Options?

Ideally the solution would work for timer 10 because that is what we have allocated for the current system, but maybe we can shuffle things around if there is a compelling reason to do it.

Any help would be greatly appreciated.

Thanks,

Chris 
4 REPLIES 4
Posted on September 26, 2014 at 15:00

Configure the timer to external clock mode, then use output compare.

[EDIT] There's no external clock mode on TIM10, use timer other than 6, 7, 10, 11, 13, 14.

JW

Posted on September 26, 2014 at 16:53

There is also Encoder Mode, which would allow for multiple set points

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
cphelan
Associate II
Posted on September 26, 2014 at 20:35

Thanks for the help. Unfortunately we are locked out of encoder mode due to other inputs, but we do have access to Timer3 which has the functionality it sounds like we need.

Reading through AN4013, I am not clear on how to connect/configure the external clock with respect to TI1/TI2. AN4013 states that the external clock can be connected to TI1 or TI2, but how does that relate to the physical pin on the part? Ultimately I would like to use TIM3_CH2 as the external clock, physical connection on PC7.

If I've already selected external clock mode, do I need to specify a trigger?

Can someone explain what ''User-ETR-as-Clearing-Source'' means?

I'm attempting to use CubeMX to simplify setting up the HAL . . . 

Thanks again,

Chris
Posted on September 26, 2014 at 20:45

TIM3_CH2 -> TI2 (Timer Input 2)

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..