:orphan: .. raw:: html .. dtcompatible:: espressif,esp32-mcpwm .. _dtbinding_espressif_esp32_mcpwm: espressif,esp32-mcpwm ##################### Vendor: :ref:`Espressif Systems ` Description *********** .. code-block:: none 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 = , , ; output-enable; }; group2 { pinmux = ; }; }; }; 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 ********** .. tabs:: .. group-tab:: Node specific properties Properties not inherited from the base binding file. .. list-table:: :widths: 1 1 4 :header-rows: 1 * - Name - Type - Details * - ``prescale`` - ``int`` - .. code-block:: none 8 bit timer prescale for the global clock. Period of PWM_clk = 6.25ns * (PWM_CLK_PRESCALE + 1). This property is **required**. * - ``#pwm-cells`` - ``int`` - .. code-block:: none Number of items to expect in a pwm specifier This property is **required**. Constant value: ``3`` * - ``prescale-timer0`` - ``int`` - .. code-block:: none 8 bit timer prescale for timer 0. Period of PT0_clk = Period of PWM_clk * (PWM_TIMER0_PRESCALE + 1). * - ``prescale-timer1`` - ``int`` - .. code-block:: none 8 bit timer prescale for timer 1. Period of PT1_clk = Period of PWM_clk * (PWM_TIMER1_PRESCALE + 1). * - ``prescale-timer2`` - ``int`` - .. code-block:: none 8 bit timer prescale for timer 2. Period of PT2_clk = Period of PWM_clk * (PWM_TIMER2_PRESCALE + 1). * - ``pinctrl-0`` - ``phandles`` - .. code-block:: none Pin configuration/s for the first state. Content is specific to the selected pin controller driver implementation. * - ``pinctrl-1`` - ``phandles`` - .. code-block:: none Pin configuration/s for the second state. See pinctrl-0. * - ``pinctrl-2`` - ``phandles`` - .. code-block:: none Pin configuration/s for the third state. See pinctrl-0. * - ``pinctrl-3`` - ``phandles`` - .. code-block:: none Pin configuration/s for the fourth state. See pinctrl-0. * - ``pinctrl-4`` - ``phandles`` - .. code-block:: none Pin configuration/s for the fifth state. See pinctrl-0. * - ``pinctrl-names`` - ``string-array`` - .. code-block:: none Names for the provided states. The number of names needs to match the number of states. .. group-tab:: Deprecated node specific properties Deprecated properties not inherited from the base binding file. (None) .. group-tab:: Base properties 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. .. list-table:: :widths: 1 1 4 :header-rows: 1 * - Name - Type - Details * - ``status`` - ``string`` - .. code-block:: none indicates the operational status of a device Legal values: ``'ok'``, ``'okay'``, ``'disabled'``, ``'reserved'``, ``'fail'``, ``'fail-sss'`` See :ref:`dt-important-props` for more information. * - ``compatible`` - ``string-array`` - .. code-block:: none compatible strings This property is **required**. See :ref:`dt-important-props` for more information. * - ``reg`` - ``array`` - .. code-block:: none register space See :ref:`dt-important-props` for more information. * - ``reg-names`` - ``string-array`` - .. code-block:: none name of each register space * - ``interrupts`` - ``array`` - .. code-block:: none interrupts for device See :ref:`dt-important-props` for more information. * - ``interrupts-extended`` - ``compound`` - .. code-block:: none extended interrupt specifier for device * - ``interrupt-names`` - ``string-array`` - .. code-block:: none name of each interrupt * - ``interrupt-parent`` - ``phandle`` - .. code-block:: none phandle to interrupt controller node * - ``label`` - ``string`` - .. code-block:: none Human readable string describing the device (used as device_get_binding() argument) See :ref:`dt-important-props` for more information. This property is **deprecated**. * - ``clocks`` - ``phandle-array`` - .. code-block:: none Clock gate information * - ``clock-names`` - ``string-array`` - .. code-block:: none name of each clock * - ``#address-cells`` - ``int`` - .. code-block:: none number of address cells in reg property * - ``#size-cells`` - ``int`` - .. code-block:: none number of size cells in reg property * - ``dmas`` - ``phandle-array`` - .. code-block:: none DMA channels specifiers * - ``dma-names`` - ``string-array`` - .. code-block:: none Provided names of DMA channel specifiers * - ``io-channels`` - ``phandle-array`` - .. code-block:: none IO channels specifiers * - ``io-channel-names`` - ``string-array`` - .. code-block:: none Provided names of IO channel specifiers * - ``mboxes`` - ``phandle-array`` - .. code-block:: none mailbox / IPM channels specifiers * - ``mbox-names`` - ``string-array`` - .. code-block:: none Provided names of mailbox / IPM channel specifiers * - ``wakeup-source`` - ``boolean`` - .. code-block:: none 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`` - ``phandle`` - .. code-block:: none Power domain the device belongs to. The device will be notified when the power domain it belongs to is either suspended or resumed. * - ``zephyr,pm-device-runtime-auto`` - ``boolean`` - .. code-block:: none Automatically configure the device for runtime power management after the init function runs. Specifier cell names ******************** - pwm cells: channel, period, flags