2014-09-26 05:47 AM
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,Chris2014-09-26 06:00 AM
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. JW2014-09-26 07:53 AM
There is also Encoder Mode, which would allow for multiple set points
2014-09-26 11:35 AM
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,Chris2014-09-26 11:45 AM
TIM3_CH2 -> TI2 (Timer Input 2)