Figure 349. Measuring Time Interval Between Edges On 3 Signals - ST STM32G4 Series Reference Manual

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

Advertisement

RM0440
This feature can be used for monitoring the counting direction (or rotation direction) in
encoder mode, or to have a signal indicating the up/down phases in center-aligned PWM
mode.
27.3.27
UIF bit remapping
The IUFREMAP bit in the TIMx_CR1 register forces a continuous copy of the Update
Interrupt Flag UIF into the timer counter register's bit 31 (TIMxCNT[31]). This allows both
the counter value and a potential roll-over condition signaled by the UIFCPY flag to be read
in an atomic way. In particular cases, it can ease the calculations by avoiding race
conditions, caused for instance by a processing shared between a background task
(counter reading) and an interrupt (Update Interrupt).
There is no latency between the UIF and UIFCPY flags assertion.
27.3.28
Timer input XOR function
The TI1S bit in the TIMx_CR2 register, allows the input filter of channel 1 to be connected to
the output of an XOR gate, combining the three input pins tim_ti1, tim_ti2 and tim_ti3.
The XOR output can be used with all the timer input functions such as trigger or input
capture. It is convenient to measure the interval between edges on two input signals, as per
Figure 349
27.3.29
Interfacing with Hall sensors
This is done using the advanced-control timers 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 (tim_ti1, tim_ti2 and tim_ti3) connected through a XOR
to the tim_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 tim_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 tim_trc (See
below.

Figure 349. Measuring time interval between edges on 3 signals

tim_ti1
tim_ti2
TI3
XOR
TIMx
Counter
Figure 293: Capture/compare channel (example: channel 1
RM0440 Rev 1
Advanced-control timers (TIM1/TIM8/TIM20)
Figure
350. The "interfacing
MSv62359V1
1121/2083
1181

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?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF