This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: eHRPWM output issue

Part Number: AM3358


Hi ,

SDK : ti-processor-sdk-linux-rt-am335x-evm-03.03.00.04-Linux-x86-Install.bin

Device Tree : am335x-boneblack.dts 

pwm1 normal use, pwm2 no signal output .

Will the device tree is configured correctly ?

How to make gpmc_ad9.ehrpwm2B can output signal normally? 

Modify the device tree as follows:

ehrpwm2a_pins: pinmux_ehrpwm2a_pins {
    pinctrl-single,pins = <
       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE4) /* gpmc_ad8.ehrpwm2A */
    >;
};

ehrpwm2b_pins: pinmux_ehrpwm2b_pins {
     pinctrl-single,pins = <
        AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE4) /* gpmc_ad9.ehrpwm2B */
     >;
};

&epwmss1 {
    status = "okay";
};

&ehrpwm1 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&ehrpwm2a_pins>;
};

&epwmss2 {
    status = "okay";
};

&ehrpwm2 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&ehrpwm2b_pins>;
};

BR

  • Hello andre,

    Please, use this syntax:

    &epwmss2 {
    	status = "okay";
    
    	ehrpwm2: pwm@48304200 {
    		status = "okay";
    		pinctrl-names = "default";
    		pinctrl-0 = <&ehrpwm2b_pins>;
    	};
    };

    Best regards,
    Kemal

  • Hi ,

    Thank you for your reply.

    ehrpwm2b_pins: pinmux_ehrpwm2b_pins {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE4) /* gpmc_ad9.ehrpwm2B */
    >;
    };

    &epwmss2 {
    status = "okay";

    ehrpwm2: pwm@48304200 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&ehrpwm2b_pins>;
    };
    };

    Follow the above configuration, but ehrpwm2b_pins still can not use.
    User mode configuration is as follows:

    echo 0 > /sys/class/pwm/pwmchip0/export
    echo 2000000 > /sys/class/pwm/pwmchip0/pwm0/period
    echo 500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
    echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

    How do I enable the pwm function of the gpmc_ad9.ehrpwm2B pin?


    BR
  • These commands will make the pwm2 to output signal:

    echo 1 > /sys/class/pwm/pwmchip2/export
    echo 2000000 > /sys/class/pwm/pwmchip2/pwm1/period
    echo 500000 > /sys/class/pwm/pwmchip2/pwm1/duty_cycle
    echo 1 > /sys/class/pwm/pwmchip2/pwm1/enable

  • Hello ,

    Thank you for your reply.

    The ehrpwm2A and ehrpwm2B pins can be used individually.

    For example :
    &epwmss2 {
    status = "okay";

    ehrpwm2: pwm@48304200 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&ehrpwm2b_pins>;
    };
    };

    I need to use ehrpwm2: pwm@48304200 to control the ehrpwm2A and ehrpwm2B pins.

    How to configure the device tree?

    BR
  • Use this:

    &epwmss2 {
    status = "okay";

    ehrpwm2: pwm@48304200 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&ehrpwm2a_pins &ehrpwm2b_pins>;
    };
    };

  • Hi Kemal ,

    Thank you for your reply.
    Now I can control the ehrpwm2A and ehrpwm2B pins.

    Best regards,
    Anre