
EM358x
Rev. 0.4
185
Figure 10-25 gives an example of counter operation, showing count signal generation and direction control. It also
shows how input jitter is compensated for when both inputs are used for counting. This might occur if the sensor
is positioned near one of the switching points. This example assumes the following configuration:
TIM_CC1S = 01 (TIMx_CCMR1 register, IC1FP1 mapped on TI1).
TIM_CC2S = 01 (TIMx_CCMR2 register, IC2FP2 mapped on TI2).
TIM_CC1P = 0 (TIMx_CCER register, IC1FP1 non-inverted, IC1FP1 = TI1).
TIM_CC2P = 0 (TIMx_CCER register, IC2FP2 non-inverted, IC2FP2 = TI2).
TIM_SMS = 011 (TIMx_SMCR register, both inputs are active on both rising and falling edges).
TIM_CEN = 1 (TIMx_CR1 register, counter is enabled).
Figure 10-25. Example of Counter Operation in Encoder Interface Mode
Figure 10-26 gives an example of counter behavior when IC1FP1 polarity is inverted (same configuration as
above except TIM_CC1P = 1).
Figure 10-26. Example of Encoder Interface Mode with IC1FP1 Polarity Inverted
The timer configured in encoder interface mode provides information on a sensor’s current position. To obtain
dynamic information (speed, acceleration/deceleration), measure the period between two encoder events using a
second timer configured in capture mode. The output of the encoder that indicates the mechanical zero can be
used for this purpose. Depending on the time between two events, the counter can also be read at regular times.
Do this by latching the counter value into a third input capture register. (In this case the capture signal must be
periodic and can be generated by another timer).
10.3.12 Timer Input XOR Function
The TIM_TI1S bit in the TIM1_CR2 register allows the input filter of channel 1 to be connected to the output of a
XOR gate that combines the three input pins TIMxC2 to TIMxC4.
Summary of Contents for EMBER EM358 series
Page 2: ...EM358x 2 Rev 0 4 ...
Page 7: ...EM358x Rev 0 4 7 ...