R01UH0822EJ0100 Rev.1.00
Page 421 of 1041
Jul 31, 2019
RX13T Group
19. Multi-Function Timer Pulse Unit 3 (MTU3c)
(1) Example of Procedure for Setting Reset-Synchronized PWM Mode
shows an example of procedure for setting the reset-synchronized PWM mode.
Figure 19.42
Procedure for Selecting Reset-Synchronized PWM Mode
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[9]
[10]
Reset-synchronized
PWM mode
Stop counting
Select count clock and
counter clear source
Brushless DC motor
control setting
Set TCNT
Set TGR
Enable PWM cyclic output,
set PWM output level
Set reset-synchronized
PWM mode
Set MPC
Start count operation
<Reset-synchronized PWM mode>
[8]
Enable waveform output
[1] Set the TSTRA.CST3 and TSTRA.CST4 bits to 0 to stop the TCNT
count operation.
Specify the reset-synchronized PWM mode while MTU3.TCNT
and MTU4.TCNT are stopped.
[2] Set the TCR.TPSC[2:0] and TCR.CKEG[1:0] bits of MTU3 to
select the count clock source and clock edge for MTU3.
Set the TCR.CCLR[2:0] bits to select TGRA compare match as the
counter clear source.
[3] To control a brushless DC motor, set the TGCRA.BDC bit and set
the feedback signal input source and output chopping or gate
signal direct output (only when MTU3 and MTU4 are used).
[4] Set MTU3.TCNT and MTU4.TCNT to 0000h.
[5] MTU3.TGRA is the period register. Set the PWM period in
MTU3.TGRA.
Set the PWM output transition timing in MTU3.TGRB,
MTU4.TGRA, and MTU4.TGRB.
Note that the setting values should be within the range of compare
match with MTU3.TCNT.
X
MTU3.TGRA (X: Set value)
[6] Set the PSYE bit in the TOCR1A register to enable or disable
toggle output synchronized with the PWM period, and set the
OLSP and OLSN bits to select the PWM output level.
When specifying the PWM output level using the TOCR2A and
TOLBRA in buffer operation, refer to Timer Output Level Buffer
Registers (TOLBRA).
[7] Set the MD[3:0] bits in MTU3.TMDR1 register to 1000b to select
the reset-synchronized PWM mode. Specify the buffer operation
(BFA = 1) of the MTU3.TGRA register and the buffer operation
(BFB = 1) of the MTU3.TGRB register when necessary. Set the
MTU4.TMDR1 register to the initial value (normal operation; BFA
= 0 and BFB = 0).
[8] Set the TOERA register to enable or disable output from the PWM
output pin. Then, set the MTU3.TIORH, MTU3.TIORL,
MTU4.TIORH, and MTU4.TIORL registers to 00h.
[9] Set the MPU and the port mode register (PMR) of the I/O ports.
[10] Set the TSTRA.CST3 bit to 1 to start count operation.
Note:
The output waveform starts to toggle at the point of
MTU3.TCNT = MTU3.TGRA = X by setting X = MTU3.TGRA,
i.e., period = duty ratio.