Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2018 00:03:27 +0900 (JST)
From:      SAITOU Toshihide <toshi@ruby.ocn.ne.jp>
To:        freebsd-arm@freebsd.org
Subject:   Re: PWM of BeagleBone Black on 11.1-RELEASE
Message-ID:  <20180315.000327.244671182493000373.toshi@ruby.ocn.ne.jp>
In-Reply-To: <20180308.220228.985768279546235038.toshi@ruby.ocn.ne.jp>
References:  <20180308.220228.985768279546235038.toshi@ruby.ocn.ne.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 08 Mar 2018 22:02:28 +0900 (JST), SAITOU Toshihide 
<toshi@ruby.ocn.ne.jp> wrote:
>
> How can I setup the PWM of BeagleBone Black?
> The driver attached but no signal observed with the
> followings.
>
> $ sysctl dev.am335x_ehrpwm.1.dutyB=50
> $ sysctl dev.am335x_ehrpwm.1.dutyA=50
> $ sysctl dev.am335x_ehrpwm.1.period=100
>
> (nothing was observed)
>
> $ uname -a
> FreeBSD beaglebone 11.1-RELEASE FreeBSD 11.1-RELEASE #0
> r321309: Fri Jul 21 10:22:32 UTC 2017
> root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE
> arm
>
> # dtc -I dts -O dtb pwm.dts -o pwm.dtb
> # cp pwm.dtb /boot/dtb/
>
> # cat /boot/loader.conf
>
> fdt_overlays="pwm.dtb"
>
> # cat pwm.dts
>
> /dts-v1/;
> /plugin/;
>
> / {
>     compatible = "ti,beaglebone", "ti,beaglebone-black",
>     "ti,beaglebone-green";
>
>     fragment@4 {
>         target = <&am33xx_pinmux>;
>         __overlay__ {
>                     pinctrl-single,pins = < 0x048 0xe >; /* P9.21, 
> gpio0_3 */
>         };
>     };
>
>     fragment@5 {
>         target = <&epwmss1>;
>         __overlay__ {
>             status = "okay";
>         };
>     };
>
>     fragment@6 {
>         target = <&ehrpwm1>;
>         __overlay__ {
>             status = "okay";
>         };
>     };
>
>     fragment@7 {
>         target = <&ecap1>;
>         __overlay__ {
>             status = "okay";
>         };
>     };
> };

It worked with this settings (althought I don't understand yet):

Edit the beaglebone-black.dts as follows:

   add followings to the &am33xx_pinmux entry:

     ehrpwm0_pins: pinmux_ehrpwm0_AB { };
     ehrpwm1_pins: pinmux_ehrpwm1_AB { };

   append the followings:

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


And pwm.dts is :

/dts-v1/;
/plugin/;

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


     fragment@0 {
         target = <&am33xx_pinmux>;
         __overlay__ {
             ehrpwm0_pins: pinmux_ehrpwm0_AB {
                 pinctrl-single,pins = <
                     0x150 0x03 /* P9.21, 0x150, gpio0.2, mode3 */
                     0x154 0x03 /* P9.22, 0x154, gpio0.3, mode3 */
                 >;
             };
         };
     };

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

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

     fragment@3 {
         target = <&am33xx_pinmux>;
         __overlay__ {
             ehrpwm1_pins: pinmux_ehrpwm1_AB {
                 pinctrl-single,pins = <
                     0x48 0x06 /* P9.14, 0x48, gpio1.18, mode6 */
                     0x4c 0x06 /* P9.16, 0x4c, gpio1.19, mode6 */
                 >;
             };
         };
     };

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

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

};

I'm sorry for the noise.

--
SAITOU Toshihide



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180315.000327.244671182493000373.toshi>