Добавил:
ИВТ (советую зайти в "Несортированное") Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
interfeysy_1 / ИДЗ_машинка / даташиты / esp32_technical_reference_manual_en.pdf
Скачиваний:
16
Добавлен:
26.01.2024
Размер:
9.62 Mб
Скачать

16 Motor Control PWM (PWM)

16.3Submodules

16.3.1 Overview

This section lists the configuration parameters of key submodules. For information on adjusting a specific parameter, e.g. synchronization source of PWM timer, please refer to Section 16.3.2 for details.

16.3.1.1 Prescaler Submodule

Figure 16­2. Prescaler Submodule

Configuration parameter:

• Scale the PWM clock according to CLK_160M.

16.3.1.2 Timer Submodule

Figure 16­3. Timer Submodule

Configuration parameters:

Set the PWM timer frequency or period.

Configure the working mode for the timer:

Count-Up Mode: for asymmetric PWM outputs

Count-Down Mode: for asymmetric PWM outputs

Count-Up-Down Mode: for symmetric PWM outputs

Configure the the reloading phase (including the value and the phase) used during software and hardware synchronization.

Espressif Systems

412

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16Motor Control PWM (PWM)

Synchronize the PWM timers with each other. Either hardware or software synchronization may be used.

Configure the source of the PWM timer’s the synchronization input to one of the seven sources below:

The three PWM timer’s synchronization outputs.

Three synchronization signals from the GPIO matrix: SYNC0, SYNC1, SYNC2.

No synchronization input signal selected

Configure the source of the PWM timer’s synchronization output to one of the four sources below:

Synchronization input signal

Event generated when value of the PWM timer is equal to zero

Event generated when value of the PWM timer is equal to period

No synchronization output generated

Configure the method of period updating.

16.3.1.3 Operator Submodule

Figure 16­4. Operator Submodule

The configuration parameters of the operator submodule are shown in Table 16-1.

Espressif Systems

413

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16 Motor Control PWM (PWM)

 

Table 16­1. Configuration Parameters of the Operator Submodule

 

 

 

 

 

Submodule

Configuration Parameter or Option

 

 

 

• Set up the PWM duty cycle for PWMxA and/or PWMxB out-

 

 

 

 

put.

 

 

 

 

• Set up at which time the timing events occur.

 

 

 

• Define what action should be taken on timing events:

 

 

 

 

– Switch high or low PWMxA and/or PWMxB outputs

 

 

PWM Generator

 

– Toggle PWMxA and/or PWMxB outputs

 

 

 

 

– Take no action on outputs

 

 

 

• Use direct s/w control to force the state of PWM outputs

 

 

 

• Add a dead time to raising and / or failing edge on PWM out-

 

 

 

 

puts.

 

 

 

 

• Configure update method for this submodule.

 

 

 

 

 

 

 

• Control of complementary dead time relationship between

 

 

 

 

upper and lower switches.

 

 

 

• Specify the dead time on rising edge.

 

 

 

Specify the dead time on falling edge.

 

 

Dead Time Generator

• Bypass the dead time generator module. The PWM wave-

 

 

 

 

form will pass through without inserting dead time.

 

 

 

• Allow PWMxB phase shifting with respect to the PWMxA out-

 

 

 

 

put.

 

 

 

 

• Configure updating method for this submodule.

 

 

 

 

 

 

 

 

Enable carrier and set up carrier frequency.

 

 

 

Configure duration of the first pulse in the carrier waveform.

 

 

PWM Carrier

• Set up the duty cycle of the following pulses.

 

 

 

• Bypass the PWM carrier module. The PWM waveform will be

 

 

 

 

passed through without modification.

 

 

 

 

 

 

 

• Configure if and how the PWM module should react the fault

 

 

 

 

event signals.

 

 

 

• Specify the action taken when a fault event occurs:

 

 

 

 

– Force PWMxA and/or PWMxB high.

 

 

 

 

– Force PWMxA and/or PWMxB low.

 

 

 

 

– Configure PWMxA and/or PWMxB to ignore any fault

 

 

 

 

event.

 

 

 

Fault Handler

• Configure how often the PWM should react to fault events:

 

 

 

 

– One-shot

 

 

 

 

– Cycle-by-cycle

 

 

 

Generate interrupts.

 

 

 

Bypass the fault handler submodule entirely.

 

 

 

Set up an option for cycle-by-cycle actions clearing.

 

 

 

• If desired,

independently-configured actions can be taken

 

 

 

 

when time-base counter is counting down or up.

 

 

 

 

 

 

 

Espressif Systems

 

414

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16 Motor Control PWM (PWM)

16.3.1.4 Fault Detection Submodule

Figure 16­5. Fault Detection Submodule

Configuration parameters:

Enable fault event generation and configure the polarity of fault event generation for every fault signal

Generate fault event interrupts

16.3.1.5 Capture Submodule

Figure 16­6. Capture Submodule

Configuration parameters:

Select the edge polarity and prescaling of the capture input.

Set up a software-triggered capture.

Configure the capture timer’s sync trigger and sync phase.

Software syncs the capture timer.

16.3.2 PWM Timer Submodule

Each MCPWM module has three PWM timer submodules. Any of them can determine the necessary event timing for any of the three PWM operator submodules. Built-in synchronization logic allows multiple PWM timer submodules, in one or more MCPWM modules, to work together as a system, when using synchronization signals from the GPIO matrix.

16.3.2.1 Configurations of the PWM Timer Submodule

Users can configure the following functions of the PWM timer submodule:

Control how often events occur by specifying the PWM timer frequency or period.

Configure a particular PWM timer to synchronize with other PWM timers or modules.

Espressif Systems

415

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16Motor Control PWM (PWM)

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 configured 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 PWMx timer mode register:

Count-Up Mode:

In this mode, the PWM timer increments from zero until reaching the value configured in the period register. 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 (x = 0, 1, 2), i.e., PWM_TIMER0_PERIOD, PWM_TIMER1_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 synchronization events.

Figure 16­7. Count­Up Mode Waveform

Espressif Systems

416

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16 Motor Control PWM (PWM)

Figure 16­8. Count­Down Mode Waveforms

Figure 16­9. Count­Up­Down Mode Waveforms, Count­Down at Synchronization Event

Figure 16­10. Count­Up­Down Mode Waveforms, Count­Up at Synchronization Event

Espressif Systems 417 ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16 Motor Control PWM (PWM)

When the PWM timer is running, it generates the following timing events periodically and automatically:

UTEP

The timing event generated when the PWM timer’s value equals to the value of the period register (PWM_TIMERx_PERIOD) and when the PWM timer is increasing.

UTEZ

The timing event generated when the PWM timer’s value equals to zero and when the PWM timer is increasing.

DTEP

The timing event generated when the PWM timer’s value equals to the value of the period register (PWM_TIMERx_PERIOD) and when the PWM timer is decreasing.

DTEZ

The timing event generated when the PWM timer’s value equals to zero and when the PWM timer is decreasing.

Figures 16-11 to 16-13 show the timing waveforms of U/DTEP and U/DTEZ.

Figure 16­11. UTEP and UTEZ Generation in Count­Up Mode

Espressif Systems

418

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

16 Motor Control PWM (PWM)

Figure 16­12. DTEP and DTEZ Generation in Count­Down Mode

 

Figure 16­13. DTEP and UTEZ Generation in Count­Up­Down Mode

Espressif Systems

419

ESP32 TRM (Version 5.0)

Submit Documentation Feedback

Соседние файлы в папке даташиты