Hi,

O.K. I have distilled it down to copy and paste. This should give you a PWM 
with 25% duty cycle at 10khz. The graph should look like the attached 
picture.

1)   include this dtsi file at the end of your XXX.dtb

&am33xx_pinmux {
    pwm_P8_P13: pinmux_pwm_P8_P13_pins {
        pinctrl-single,pins = <0x024 0xC>;
    };
};

&ocp {
    P8_13_pinmux {
        status = "disabled";
    };

    epwmss@48304000 {
        status = "okay";
        ehrpwm@48304200 {
            status = "okay";
        };
    };

    pwm_test_P8_13 {
        compatible    = "pwm_test";
        pwms         = <&ehrpwm2 1 100000 1>;
        pwm-names     = "PWM_P8_13";

        pinctrl-names    = "default";
        pinctrl-0    = <&pwm_P8_P13>;

        enabled        = <1>;
        duty        = <25000>;
        status         = "okay";
    };
};

2)   Compile the pwm_test.c into a pwm_test.ko by following instructions 
from:

https://github.com/SaadAhmad/beaglebone-black-cpp-PWM

and installing as a kernel module.

3)  You should get:

/sys/devices/ocp/ocp:pwm_test_P8_13# ls -l
total 0
lrwxrwxrwx 1 root root    0 Jan  4 19:09 driver -> 
../../../bus/platform/drivers/pwm_test
-rw-r--r-- 1 root root 4096 Jan  4 19:09 driver_override
-rw------- 1 root root 4096 Jan  4 19:09 duty
-r--r--r-- 1 root root 4096 Jan  4 19:09 modalias
-rw------- 1 root root 4096 Jan  4 19:09 period
-rw------- 1 root root 4096 Jan  4 19:09 polarity
drwxr-xr-x 2 root root    0 Jan  4 19:09 power
-rw------- 1 root root 4096 Jan  4 19:09 run
lrwxrwxrwx 1 root root    0 Jan  4 19:09 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Jan  4 18:56 uevent

And you can echo 10000 > duty

or 

echo 100000 > period

To change the PWM.

Best, Mike.




-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to