RM0008
Figure 67
configuration as above except CC1P='1').
Figure 67. Example of encoder interface mode with TI1FP1 polarity inverted.
Counter
The timer, when configured in Encoder Interface mode provides information on the sensor's
current position. You can obtain dynamic information (speed, acceleration, deceleration) by
measuring the period between two encoder events using a second timer configured in
capture mode. The output of the encoder which 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. You can do this by latching the counter value into a third input capture
register if available (then the capture signal must be periodic and can be generated by
another timer). when available, it is also possible to read its value through a DMA request
generated by a Real-Time clock.
12.4.17
Timer input XOR function
The TI1S bit in the TIM1_CR2 register, allows the input filter of channel 1 to be connected to
the output of a XOR gate, combining the three input pins TIM1_CH1, TIM1_CH2 and
TIM1_CH3.
The XOR output can be used with all the timer input functions such as trigger or input
capture. An example of this feature used to interface Hall sensors is given in
below.
12.4.18
Interfacing with Hall sensors
This is done using the advanced control timer TIM1 to generate PWM signals to drive the
motor and another timer TIMx referred to as "interfacing timer" in
timer" captures the 3 timer input pins (CC1, CC2, CC3) connected through a XOR to the TI1
input channel (selected by setting the TI1S bit in the TIMx_CR2 register).
The slave mode controller is configured in reset mode; the slave input is TI1F_ED. Thus,
each time one of the 3 inputs toggles, the counter restarts counting from 0. This creates a
time base triggered by any change on the Hall inputs.
On the "interfacing timer", capture/compare channel 1 is configured in capture mode,
capture signal is TRC (See
stage) on page
changes on the inputs, gives information about motor speed.
gives an example of counter behavior when TI1FP1 polarity is inverted (same
forward
jitter
TI1
TI2
down
Figure 51: Capture/compare channel (example: channel 1 input
164). The captured value, which corresponds to the time elapsed between 2
Advanced control timer (TIM1)
backward
jitter
up
forward
down
Section 12.4.18
Figure
68. The "interfacing
181/501
Need help?
Do you have a question about the STM32F101 Series and is the answer not in the manual?