GD32A50x User Manual
354
Figure 18-32. Counter behavior with CI0FE0 polarity inverted in mode 2
CI0FE0
CI1FE1
CNT_REG
19
20
18
17
16
15
16
17
18
19
20
21
TIMERx_CAR
99
Hall sensor function
Hall sensor is generally used to control BLDC motor, the timers can support this function.
Figure 18-33. Hall sensor is used for BLDC motor
shows how to connect the timer and the
motor. And two timers are needed. TIMER_in(Advanced/General L0 TIMER
)
is used to accept
three
HALL sensor signals
.
Each of the three input of HALL sensors provides a pulse which is applied to an input capture
pin, then both the speed and position of
rotor
can be calculated by analyzing the hall sensor
signals.
By the internal connection function (TRGO-ITIx), TIMER_in and TIMER_out can be
connected. TIMER_out will generate PWM signals to control the speed of BLDC motor based
on the ITIx. Then, the feedback circuit is finished, you can change the configuration to fit your
request.
Because the advanced/general L0 TIMER has the input XOR function, they can be used as
the TIMER_in timer. And the advanced timer has the functions of complementary output and
dead time, so it can be used as the TIMER_out timer.
In addition, the interconnected timer can be seleted by
TRIGSEL module, for example :
TIMER_in (TIMER0) -> TIMER_out (TIMER7 ITI0)
TIMER_in (TIMER1) -> TIMER_out (TIMER0 ITI1)
After appropriate interconnected timers are selected and wires are connected, the timers
need to be configured. Some key settings are as follows:
Enable XOR by setting TI0S, then, the change of each input signal will make the CI0
toggle. CH0VAL will record the current value of counter.
Choose ITIx to trigger commutation by configuring CCUC and CCSE.
Configure PWM parameters based on the requests.