Unable to reverse PWM polarity debian-8.4-console

Hi ,

I am unable to reverse polarity to PWM port P8_19.

My Linux version Linux arm 4.4.6-ti-r15 #1 SMP Tue Apr 5 08:05:26 UTC 2016 armv7l GNU/Linux

I get Invalid argument error.

root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 1000000 > period
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 500000 > duty_cycle
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 1 > enable
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 0 > enable
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# cat polarity
normal
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 1 > polarity
bash: echo: write error: Invalid argument
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1#

I am using the ehrpwm2A PWM on P8_19. The following device tree overlay (BB-PWM2-00A0.dts):

/dts-v1/;

/plugin/;

/{

compatible = “ti,beaglebone”, “ti,beaglebone-black”;

part-number = “BB-PWM2”;

version = “00A0”;

fragment@0 {

target = <&am33xx_pinmux>;

overlay {

pinctrl_spec: Panel_Pins {

pinctrl-single,pins = <

0x020 0x04 /* P8_19 MODE4 ehrpwm2A PWM */

;

};

};

};

fragment@1 {

target = <&ocp>;

overlay {

test_helper: helper {

compatible = “bone-pinmux-helper”;

pinctrl-names = “default”;

pinctrl-0 = <&pinctrl_spec>;

status = “okay”;

};

};

};

fragment@2 {

target = <&epwmss2>;

overlay {

status = “okay”;

};

};

fragment@3 {

target = <&ehrpwm2>;

overlay {

status = “okay”;

};

};

};

root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# cat polarity
normal
root@arm:/sys/devices/platform/ocp/48304000.epwmss/48304200.ehrpwm/pwm/pwmchip0/pwm1# echo 1 > polarity
bash: echo: write error: Invalid argument

The error here is self explanatory, and obvious. Look at the difference between your cat of polarity, and then what you attempt to echo into polarity.

I’ll give you a hint. polarity is not expecting a numerical value.

I know you’ve solved it or moved on but “inversed” is the secret word you’re looking for. Took a bunch of digging through source & guessing to find it, maybe I can save somebody else the headache if they happen to find this thread.

Thank you Brett Hamilton!