espressif,esp32-mcpwm
Vendor: Espressif Systems
Description
Espressif's Motor Control Pulse Width Modulator (MCPWM) controller Node
The MCPWM peripheral is intended for motor and power control.
It provides six PWM outputs that can be set up to operate in several topologies
ESP32 contains two MCPWM peripherals: MCPWM0 and MCPWM1
Each MCPWM peripheral has one clock divider (prescaler), three PWM timers, three PWM operators,
and a capture module.
Every PWM operator has two PWM outputs: PWMxA and PWMxB. They can work independently, in symmetric
and asymmetric configuration. MCPWMxA and MCPWMxB will share the same timer, thus having the same
operating frequency.
The driver currently always use the timer x for operator x. Timer 0 will use operator 0 for
PWM0A/B.
Timer 1 will use operator 1 for PWM1A/B, and so on.
Mapping channel ID:
Channel 0 -> Timer 0, Operator 0, output PWM0A
Channel 1 -> Timer 0, Operator 0, output PWM0B
Channel 2 -> Timer 1, Operator 1, output PWM1A
Channel 3 -> Timer 1, Operator 1, output PWM1B
Channel 4 -> Timer 2, Operator 2, output PWM2A
Channel 5 -> Timer 2, Operator 2, output PWM2B
Channel 6 -> Capture 0
Channel 7 -> Capture 1
Channel 8 -> Capture 2
Example: Use PWM0A output and capture 0:
pwm_loopback_0 {
compatible = "test-pwm-loopback";
pwms = <&mcpwm0 0 0 PWM_POLARITY_NORMAL>, #Channel 0 -> Output PWM0A
<&mcpwm0 6 0 PWM_POLARITY_NORMAL>; #Channel 6 -> Capture 0;
};
The mapping between the output PWMxA/B or CaptureX and GPIO is done through pinctrl:
&mcpwm0 {
pinctrl-0 = <&mcpwm0_default>;
pinctrl-names = "default";
}
The 'mcpwm0_default' node is defined inside the pinctrl node.
&pinctrl {
mcpwm0_default: mcpwm0_default {
group1 {
pinmux = <MCPWM0_OUT0A_GPIO0>,
<MCPWM0_OUT0B_GPIO2>,
<MCPWM0_OUT1A_GPIO4>;
output-enable;
};
group2 {
pinmux = <MCPWM0_CAP0_GPIO5>;
};
};
};
Note: Check espressif,esp32-pinctrl.yaml for complete documentation regarding pinctrl.
Use the prescale-timerX property to configure the timers:
&mcpwm0 {
pinctrl-0 = <&mcpwm0_default>;
pinctrl-names = "default";
prescale = <255>;
prescale-timer0 = <103>;
prescale-timer1 = <0>;
prescale-timer2 = <255>;
status = "okay";
};
Properties
Properties not inherited from the base binding file.
Name |
Type |
Details |
---|---|---|
|
|
Number of items to expect in a pwm specifier
This property is required. Constant value: |
|
|
Pin configuration/s for the first state. Content is specific to the
selected pin controller driver implementation.
|
|
|
Pin configuration/s for the second state. See pinctrl-0.
|
|
|
Pin configuration/s for the third state. See pinctrl-0.
|
|
|
Pin configuration/s for the fourth state. See pinctrl-0.
|
|
|
Pin configuration/s for the fifth state. See pinctrl-0.
|
|
|
Names for the provided states. The number of names needs to match the
number of states.
|
|
|
8 bit timer prescale for the global clock.
Period of PWM_clk = 6.25ns * (PWM_CLK_PRESCALE + 1).
This property is required. |
|
|
8 bit timer prescale for timer 0.
Period of PT0_clk = Period of PWM_clk * (PWM_TIMER0_PRESCALE + 1).
|
|
|
8 bit timer prescale for timer 1.
Period of PT1_clk = Period of PWM_clk * (PWM_TIMER1_PRESCALE + 1).
|
|
|
8 bit timer prescale for timer 2.
Period of PT2_clk = Period of PWM_clk * (PWM_TIMER2_PRESCALE + 1).
|
Deprecated properties not inherited from the base binding file.
(None)
Properties inherited from the base binding file, which defines common properties that may be set on many nodes. Not all of these may apply to the “espressif,esp32-mcpwm” compatible.
Name |
Type |
Details |
---|---|---|
|
|
Property to identify that a device can be used as wake up source.
When this property is provided a specific flag is set into the
device that tells the system that the device is capable of
wake up the system.
Wake up capable devices are disabled (interruptions will not wake up
the system) by default but they can be enabled at runtime if necessary.
|
|
|
Power domain the device belongs to.
The device will be notified when the power domain it belongs to is either
suspended or resumed.
|
|
|
Automatically configure the device for runtime power management after the
init function runs.
|
|
|
List of power states that will disable this device power.
|
|
|
indicates the operational status of a device
Legal values: See Important properties for more information. |
|
|
compatible strings
This property is required. See Important properties for more information. |
|
|
register space
See Important properties for more information. |
|
|
name of each register space
|
|
|
interrupts for device
See Important properties for more information. |
|
|
extended interrupt specifier for device
|
|
|
name of each interrupt
|
|
|
phandle to interrupt controller node
|
|
|
Human readable string describing the device (used as device_get_binding() argument)
See Important properties for more information. This property is deprecated. |
|
|
Clock gate information
|
|
|
name of each clock
|
|
|
number of address cells in reg property
|
|
|
number of size cells in reg property
|
|
|
DMA channels specifiers
|
|
|
Provided names of DMA channel specifiers
|
|
|
IO channels specifiers
|
|
|
Provided names of IO channel specifiers
|
|
|
mailbox / IPM channels specifiers
|
|
|
Provided names of mailbox / IPM channel specifiers
|
|
|
Do not initialize device automatically on boot. Device should be manually
initialized using device_init().
|
Specifier cell names
pwm cells: channel, period, flags