Table 272. Counting Direction Versus Encoder Signals(Cc1P = Cc2P = 0) - ST STM32G4 Series Reference Manual

Advanced arm-based 32-bit mcus
Hide thumbs Also See for STM32G4 Series:
Table of Contents

Advertisement

General-purpose timers (TIM2/TIM3/TIM4/TIM5)

Table 272. Counting direction versus encoder signals(CC1P = CC2P = 0)

Active edge
SMS[3:0]
Counting on
tim_ti1 only
1110
x1 mode
Counting on
tim_ti2 only
1111
x1 mode
Counting on
tim_ti1 only
0001
x2 mode
Counting on
tim_ti2 only
0010
x2 mode
Counting on
tim_ti1 and
0011
tim_ti2
x4 mode
A quadrature encoder can be connected directly to the MCU without external interface logic.
However, comparators are normally be used to convert the encoder's differential outputs to
digital signals. This greatly increases noise immunity. The third encoder output which
indicate the mechanical zero position, may be connected to the external trigger input and
trigger a counter reset.
Figure 402
direction control. It also shows how input jitter is compensated where both edges are
selected. This might occur if the sensor is positioned near to one of the switching points. For
this example we assume that the configuration is the following:
CC1S= 01 (TIMx_CCMR1 register, tim_ti1fp1 mapped on tim_ti1)
CC2S= 01 (TIMx_CCMR2 register, tim_ti2fp2 mapped on tim_ti2)
CC1P and CC1NP = '0' (TIMx_CCER register, tim_ti1fp1 noninverted,
tim_ti1fp1=tim_ti1)
CC2P and CC2NP = '0' (TIMx_CCER register, tim_ti2fp2 noninverted,
tim_ti2fp2=tim_ti2)
SMS= 011 (TIMx_SMCR register, both inputs are active on both rising and falling
edges)
CEN= 1 (TIMx_CR1 register, Counter is enabled)
1230/2083
Level on opposite
signal (tim_ti1fp1
for tim_ti2,
tim_ti2fp2 for
tim_ti1)
High
Low
High
Low
High
Low
High
Low
High
Low
gives an example of counter operation, showing count signal generation and
RM0440 Rev 1
tim_ti1fp1 signal
Rising
Falling
Down
Up
No count
No count
No count
No count
No count
No count
Down
Up
Up
Down
No count
No count
No count
No count
Down
Up
Up
Down
RM0440
tim_ti2fp2 signal
Rising
Falling
No count
No count
No count
No count
Up
Down
No count
No count
No count
No count
No count
Down
Up
Down
Down
Up
Up
Down
Down
Up

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32G4 Series and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF