16 Motor Control PWM (PWM)
• Configure a particular PWM timer to synchronize with other PWM timers or modules.
• Get a PWM timer in phase with other PWM timers or modules.
• Set one of the following timer counting modes: count-up, count-down, count-up-down.
• Change the rate of the PWM timer clock (PT_clk) with a prescaler. Each timer has its own prescaler con-
figured with PWM_TIMERx_PRESCALE of register PWM_TIMER0_CFG0_REG. The PWM timer increments
or decrements at a slower pace, depending on the setting of this register.
16.3.2.2 PWM Timer's Working Modes and Timing Event Generation
The PWM timer has three working modes, selected by the
• Count-Up Mode:
In this mode, the PWM timer increments from zero until reaching the value configured in the period reg-
ister. Once done, the PWM timer returns to zero and starts increasing again. PWM period is equal to the
value of period register + 1.
Note: The period register is PWM_TIMERx_PERIOD
PWM_TIMER2_PERIOD.
• Count-Down Mode:
The PWM timer decrements to zero, starting from the value configured in the period register. After reaching
zero, it is set back to the period value. Then it starts to decrement again. In this case, the PWM period is
also equal to the value of period register + 1.
• Count-Up-Down Mode:
This is a combination of the two modes mentioned above. The PWM timer starts increasing from zero
until the period value is reached. Then, the timer decreases back to zero. This pattern is then repeated.
The PWM period is the result of (the value of period register × 2 + 1).
Figures
16-7
to
16-10
show PWM timer waveforms in different modes, including timer behavior during synchro-
nization events.
Espressif Systems
PWMx
(x
= 0, 1, 2), i.e., PWM_TIMER0_PERIOD, PWM_TIMER1_PERIOD,
Figure 16-7. Count-Up Mode Waveform
423
Submit Documentation Feedback
timer mode register:
ESP32 TRM (Version 5.2)
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?