MCPWM Block¶
How this block appears in a Simulink model?¶
What can be configured?¶
Configuration Parameter | Selectable Option/Value | Description |
---|---|---|
Timer Tab | Timer 0--Timer 1--Timer 2 | Each tab has separate configuration parameters for each timer |
Activate Timer | on--off | Each timer if in use should be activated by this checkbox |
Frequency | Select the PWM frequency | |
Duty cycle of PWMxA/PWMxB | This is the initial duty cycle of PWMxA/B. The user can change this value later using esp32_mcpwm_func block | |
Counter Mode | MCPWM_UP_COUNTER--MCPWM_DOWN_COUNTER--MCPWM_UP_DOWN_COUNTER | Select counter mode. Check References for more details |
Duty Mode | MCPWM_DUTY_MODE_0--MCPWM_DUTY_MODE_1--MCPWM_HAL_GENERATOR_MODE_FORCE_LOW--MCPWM_HAL_GENERATOR_MODE_FORCE_HIGH | Select duty mode. Check References for more details |
Enable Dead Time | on--off | Enable/disable Dead Time feature |
Dead Time Mode | MCPWM_DEADTIME_BYPASS--MCPWM_BYPASS_RED--MCPWM_BYPASS_FED--MCPWM_ACTIVE_HIGH_MODE--MCPWM_ACTIVE_LOW_MODE--MCPWM_ACTIVE_HIGH_COMPLIMENT_MODE--MCPWM_ACTIVE_LOW_COMPLIMENT_MODE--MCPWM_ACTIVE_RED_FED_FROM_PWMXA--MCPWM_ACTIVE_RED_FED_FROM_PWMXB | Select Dead Time Mode. Check References for more details. |
Rising Edge Delay | Enter the rising edge delay | |
Falling Edge Delay | Enter the falling edge delay | |
Activate CAPx | on--off | Enable/disable capture component |
Capture Edge | MCPWM_POS_EDGE--MCPWM_NEG_EDGE--MCPWM_BOTH_EDGE | Select capture edge |
Number of Pulses | Enter the number of pulses |
When to use this block?¶
This block is used to generate PWM signals to control motors.
How does this block work?¶
ESP32 has two MCPWM units which can be used to control different types of motors. Each unit has three pairs of PWM outputs.
MCPWM_CONFIG is the configuration block that would enable user to configure everything in one MCPWM Unit. MCPWM_FUNC consists various API's created by ESPRESSIF to drive the PWM signal. Therefore the user can have one MCPWM_CONFIG block to configure all the components in a MCPWM unit and several MCPWM_FUNC blocks to create a sequence to drive the motor.
The current version (waijung2_20.11b) of the MCPWM_CONFIG block only allow user to configure one MCPWM Unit per model.
Reference¶
Check MCPWM documentation of ESPRESSIF
Demo¶
Previous : LEDC Block
Next : Aimagin Connect Block