The only overlay I know for a fact that works with recent kernels is
universaln. Which is one of the universal io overlays. But here is one I
personally made that works for all ehrpwms . . . keep in mind the file name
has to be univ-wph-00A0.dts . . . But this file is what universaln has it
in for pwm exactly. I just stripped out the pwm stuff and put it into this
file.


/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black",
"ti,beaglebone-green";

    /* identification */
    part-number = "univ-wph";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P8.13",    /* EHRPWM2B - ZONE 6 PWM */
        "P8.19",    /* EHRPWM2A - ZONE 4 PWM */
        "P9.14",    /* EHRPWM1A - ZONE 3 PWM */
        "P9.16",    /* EHRPWM1B - ZONE 5 PWM */
        "P9.21",    /* EHRPWM0A - ZONE 2 PWM */
        "P9.22",    /* EHRPWM0B - ZONE 1 PWM */
        /* the hardware ip uses */
        "ehrpwm0A",
        "ehrpwm0B",
        "ehrpwm1A",
        "ehrpwm1B",
        "ehrpwm2A",
        "ehrpwm2B";

        fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {

            /* P8_13 (ZCZ ball T10) */
            P8_13_pwm_pin: pinmux_P8_13_pwm_pin {
                pinctrl-single,pins = <0x024  0x24>; };     /* Mode 4,
Pull-Down, RxActive */

            /* P8_19 (ZCZ ball U10) */
            P8_19_pwm_pin: pinmux_P8_19_pwm_pin {
                pinctrl-single,pins = <0x020  0x24>; };     /* Mode 4,
Pull-Down, RxActive */

            /* P9_14 (ZCZ ball U14) */
            P9_14_pwm_pin: pinmux_P9_14_pwm_pin {
                pinctrl-single,pins = <0x048  0x26>; };     /* Mode 6,
Pull-Down, RxActive */

            /* P9_16 (ZCZ ball T14) */
            P9_16_pwm_pin: pinmux_P9_16_pwm_pin {
                pinctrl-single,pins = <0x04c  0x26>; };     /* Mode 6,
Pull-Down, RxActive */

            /* P9_21 (ZCZ ball B17) */
            P9_21_pwm_pin: pinmux_P9_21_pwm_pin {
                pinctrl-single,pins = <0x154  0x33>; };     /* Mode 3,
Pull-Up, RxActive */

            /* P9_22 (ZCZ ball A17) */
            P9_22_pwm_pin: pinmux_P9_22_pwm_pin {
                pinctrl-single,pins = <0x150  0x33>; };     /* Mode 3,
Pull-Up, RxActive */

        };
    };

    fragment@1 {
        target = <&ocp>;
        __overlay__ {

            P8_13_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P8_13_pwm_pin>;
            };

            P8_19_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P8_19_pwm_pin>;
            };

            P9_14_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P9_14_pwm_pin>;
            };

            P9_16_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P9_16_pwm_pin>;
            };

            P9_21_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P9_21_pwm_pin>;
            };

            P9_22_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&P9_22_pwm_pin>;
            };
        };
    };

    fragment@20 {
        target = <&epwmss0>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@21 {
        target = <&ehrpwm0>;
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <>;
        };
    };

    fragment@23 {
        target = <&epwmss1>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@24 {
        target = <&ehrpwm1>;
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <>;
        };
    };

    fragment@25 {
        target = <&epwmss2>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@26 {
        target = <&ehrpwm2>;
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <>;
        };
    };
};


On Wed, Jul 27, 2016 at 4:40 AM, <[email protected]> wrote:

> Hello,
>
> thanks very much for your quick reply.
>
>    - *Concerning the Kernel:* If I enter the command uname -a I get the
>    following output: Linux beaglebone 4.4.9-ti-r25 #1 SMP Thu May 5 23:08:13
>    UTC 2016 armv7l GNU/Linux. Therefore I assume I am using Kernel 4.4.9
>    - *Concerning the Code:*   Well there is no code yet. I assumed that
>    the PWM could be controlled over files, therefore just as I control GPIOS
>    by writing the desired outputs in the appropriate files. I tried to control
>    the PWM by writing the desired duty_cycle in the file. So I hoped that I
>    could access the PWM from my c++ code by simple file access. However as I
>    mentioned, writing the setting duty_cycle=5000, period=10000 and
>    enable=1 in the files I described in my original post, I could not
>    produce any outputs.
>
>    - I also tried to use a custom device tree overlay. I generated it
>    using this Website:
>    
> http://kilobaser.com/blog/2014-07-28-beaglebone-black-devicetreeoverlay-generator#dtogenerator
>
>    with the parameters: P8_36, fastslew, output, pulldown, mode2.
>    This gave me the overlay code:
>
>    /*
>    * Copyright (C) 2013 CircuitCo
>    À * This program is free software; you can redistribute it and/or
>    modify
>    * it under the terms of the GNU General Public License version 2 as
>    * published by the Free Software Foundation.
>    *
>    * This is a template-generated file from BoneScript
>    */
>    /dts-v1/;
>    /plugin/;
>
>    / {
>    compatible = "ti,beaglebone", "ti,beaglebone-black";
>
>    /* identification */
>    part-number = "BS_PWM_P8_36_0x2";
>
>    /* state the resources this cape uses */
>    exclusive-use =
>    /* the pin header uses */
>    "P8.36",
>    /* the hardware IP uses */
>    "ehrpwm1A";
>
>    fragment@0 {
>    target = <&am33xx_pinmux>;
>    __overlay__ {
>    bs_pwm_P8_36_0x2: pinmux_bs_pwm_P8_36_0x2 {
>    pinctrl-single,pins = <0x0c8 0x2>;
>    };
>    };
>    };
>
>    fragment@1 {
>    target = <&ocp>;
>    __overlay__ {
>    bs_pwm_test_P8_36 {
>    compatible = "pwm_test";
>    pwms = <&ehrpwm1 0 500000 0>;
>    pwm-names = "PWM_P8_36";
>
>    pinctrl-names = "default";
>    pinctrl-0 = <&bs_pwm_P8_36_0x2>;
>
>    enabled = <1>;
>    duty = <0>;
>    status = "okay";
>    };
>    };
>    };
>    };
>
>    which I copied in /lib/firmware/bspwm_P8_36_2-00A0.dts
>    and compiled with dtc -O dtb -o /lib/firmware/bspwm_P8_36_2-00A0.dtbo
>    -b 0 -@ /lib/firmware/bspwm_P8_36_2-00A0.dts
>    After that I loaded the am33xx_pwm as well as the compiled overlay but
>    again I was unable to produce any output by writing the already mentioned
>    values into the files.
>    Loading the overlay also generated read only files which I was unable
>    to write any values into, even after running chmod a+w and writing as root.
>
>
> Therefore the Question remains: How can I use the PWM Outputs of the
> Beaglebone black with C++ code?
>
> Thanks again for your help and best regards,
> Phil
> T
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/3be86866-0420-446e-abd3-c6b65131da24%40googlegroups.com
> <https://groups.google.com/d/msgid/beagleboard/3be86866-0420-446e-abd3-c6b65131da24%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CALHSORpwu2f208HFY43a-k8wPicYRuaROfPRKMFKQ1CvB6pWmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to