can't get pwm to work in kernel 4.1, please help!

514 views
Skip to first unread message

M@ Dunlap

unread,
Aug 23, 2015, 5:06:40 PM8/23/15
to BeagleBoard
Hello all, I'm trying with increasing desperation to get my BBB (that is running 4.1.4-1-ARCH) to use a PWM.  It used to work, but then I updated from 3.8 to 4.1 and now it's back to SNAFU.  I'm trying to get device trees to work, but I really, really don't get device tree overlays, I've read all the guides/docs and am still clueless.

My current best guess is to first load https://github.com/ProjectHexapod/bbbStuff/blob/master/overlays/am33xx_pwm-00A0.dts to activate pwm, and then load https://github.com/ProjectHexapod/bbbStuff/blob/master/overlays/thigh_bone-00A0.dts to configure all the pins.  Unfortunately when I do that and then try to echo something into pwmFolder/duty it tells me that the permission is denied.  I also don't understand why those need to be separate device tree overlays.

In attempting to isolate the problem I also came up with the following, but it gives the same permission denied errors.  I'm out of ideas, please send help!  Also, even if you don't know how to solve the problem, I'd also be interested to hear if there are style or high-level problems with my approach....

/dts-v1/;
/plugin/;

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

  /* identification */
  part-number = "test1";
  version = "00A0";
  exclusive-use =
    /* the pin header uses */
    "P8.13",
    /* the hardware IP uses */
    "ehrpwm2B";

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

  fragment@1 {
    target = <&ehrpwm0>;
    __overlay__ {
      status = "okay";
    };
  };

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

  fragment@3 {
    target = <&ehrpwm1>;
    __overlay__ {
      status = "okay";
    };
  };

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

  fragment@5 {
    target = <&ehrpwm2>;
    __overlay__ {
      status = "okay";
    };
  };

fragment@6 {
    target = <&am33xx_pinmux>;
    __overlay__ {
      bs_pwm_P8_13_0x14: pinmux_bs_pwm_P8_13_0x14 {
        pinctrl-single,pins = <0x024 0x14>;
      };
    };
  };

  fragment@7 {
    target = <&ocp>;
    __overlay__ {
      bs_pwm_test_P8_13 {
        compatible  = "pwm_test";
        pwms    = <&ehrpwm2 1 500000 1>;
        pwm-names   = "PWM_P8_13";

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

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

William Hermans

unread,
Aug 23, 2015, 6:34:07 PM8/23/15
to beagl...@googlegroups.com
What version dtc are you using ? it must be 1.4.1 or greater.

--
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 beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

M@

unread,
Aug 23, 2015, 6:37:35 PM8/23/15
to beagl...@googlegroups.com
Yes, and 1.4.1 respectively:

[root@stompyCentralControl sys]# zcat /proc/config.gz | grep CONFIG_BONE
CONFIG_BONE_CAPEMGR=y
[root@stompyCentralControl sys]# dtc -v
Version: DTC 1.4.1
[root@stompyCentralControl sys]# 

You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/hsyqGGqAQsI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

William Hermans

unread,
Aug 23, 2015, 6:39:33 PM8/23/15
to beagl...@googlegroups.com
hmm are there no PWM overlays already in that git ?

William Hermans

unread,
Aug 23, 2015, 6:41:20 PM8/23/15
to beagl...@googlegroups.com
Ah, PWM may be one of those things that still needs work in kernel 4.x . . . Robert would probably know.

Robert Nelson

unread,
Aug 23, 2015, 8:53:33 PM8/23/15
to Beagle Board
On Sun, Aug 23, 2015 at 4:06 PM, M@ Dunlap <matthew...@gmail.com> wrote:
> Hello all, I'm trying with increasing desperation to get my BBB (that is
> running 4.1.4-1-ARCH) to use a PWM. It used to work, but then I updated
> from 3.8 to 4.1 and now it's back to SNAFU. I'm trying to get device trees
> to work, but I really, really don't get device tree overlays, I've read all
> the guides/docs and am still clueless.
>
> My current best guess is to first load
> https://github.com/ProjectHexapod/bbbStuff/blob/master/overlays/am33xx_pwm-00A0.dts
> to activate pwm, and then load
> https://github.com/ProjectHexapod/bbbStuff/blob/master/overlays/thigh_bone-00A0.dts
> to configure all the pins. Unfortunately when I do that and then try to
> echo something into pwmFolder/duty it tells me that the permission is
> denied. I also don't understand why those need to be separate device tree
> overlays.
>
> In attempting to isolate the problem I also came up with the following, but
> it gives the same permission denied errors. I'm out of ideas, please send
> help! Also, even if you don't know how to solve the problem, I'd also be
> interested to hear if there are style or high-level problems with my
> approach....

pwm works fine, take a look at the bacon cape example we have for 4.1:

cape:
https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-BONE-BACONE-00A0.dts

and the script i used to test the pwm's

https://github.com/beagleboard/bb.org-overlays/blob/master/examples/BB-BONE-BACONE/example.sh

Regards,

--
Robert Nelson
https://rcn-ee.com/

M@

unread,
Aug 30, 2015, 12:35:35 PM8/30/15
to beagl...@googlegroups.com
Thanks for those links!

I have two problems 1) /sys/class/pwm is empty, so I can't echo anything into a /export.  Could this be due to running Arch instead of Angstrom?

2) dtc is complaning that "#include" doesn't parse, saying "Error: BB-BONE-BACONE.dts:11.1-9 syntax error
FATAL ERROR: Unable to parse input tree"  Any ideas?

--M@

M@

unread,
Aug 31, 2015, 10:19:38 PM8/31/15
to beagl...@googlegroups.com
Nevermind, I was just being an idiot, I think I've got it now thanks to those links, thanks for your help!!
Reply all
Reply to author
Forward
0 new messages