1

我在BeagleBone Black板上安装了 Ubuntu (14.04.2 LTS) 的新映像。我发现不再支持 cape manager,所以

echo bone_eqep2b > /sys/devices/bone_capemgr.*/slots

不起作用。据我了解加载设备树覆盖我需要以下内容:

  1. 安装 RSCM
  2. 修复am335x-boneblack.dts文件
  3. 运行 build.sh
  4. 重新启动板

所以,我怀疑第2项。如何正确bone_eqep2b.dts合并am335x-boneblack.dts

我想,要启用 eqep2b,我只需要更改这段代码:

epwmss@48304000 {
        compatible = "ti,am33xx-pwmss";
        reg = <0x48304000 0x10>;
        ti,hwmods = "epwmss2";
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        status = "disabled";
        ranges = <0x48304100 0x48304100 0x80 0x48304180 0x48304180 0x80 0x48304200 0x4
8304200 0x80>;

        ecap@48304100 {
                compatible = "ti,am33xx-ecap";
                #pwm-cells = <0x3>;
                reg = <0x48304100 0x80>;
                ti,hwmods = "ecap2";
                status = "disabled";
        };

        ehrpwm@48304200 {
                compatible = "ti,am33xx-ehrpwm";
                #pwm-cells = <0x3>;
                reg = <0x48304200 0x80>;
                ti,hwmods = "ehrpwm2";
                status = "disabled";
        };
};

通过类似的东西

epwmss@48304000 {
        compatible = "ti,am33xx-pwmss";
        reg = <0x48304000 0x10>;
        ti,hwmods = "epwmss2";
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        status = "okay";

        count_mode = <0>;  /* 0 - Quadrature mode, normal 90 phase offset cha & chb.  1 - Direction mode.  cha input = clock, chb input = direction */
        swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */
        invert_qa = <1>;   /* Should we invert the channel A input?  */
        invert_qb = <1>;   /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */
        invert_qi = <0>;   /* Should we invert the index input? */
        invert_qs = <0>;   /* Should we invert the strobe input? */

        status = "okay";


        ranges = <0x48304100 0x48304100 0x80 0x48304180 0x48304180 0x80 0x48304200 0x4
8304200 0x80>;

        ecap@48304100 {
                compatible = "ti,am33xx-ecap";
                #pwm-cells = <0x3>;
                reg = <0x48304100 0x80>;
                ti,hwmods = "ecap2";
                status = "okay";
        };

        ehrpwm@48304200 {
                compatible = "ti,am33xx-ehrpwm";
                #pwm-cells = <0x3>;
                reg = <0x48304200 0x80>;
                ti,hwmods = "ehrpwm2";
                status = "okay";
        };
};

正确的?

我找不到现成的版本,如果有人已经修复并可以分享它,那就太好了。

4

2 回答 2

1

在内核 v3.14 中,您可以通过在 Robert C Nelson 的 dtb-rebuilder 项目中的 am33xx.dtsi 下将 epwmssx、ecapx 和 ehrpwmx 的状态设置为“okay”来启用 PWM。但是,这只会使能子系统,不会复用管脚或使能 PWMXTBCLK 寄存器。

要复用 PWM 的引脚,请使用 GitHub 上 cdsteinkuehler 的 Universal IO 项目中的“config-pin”

要启用 PWMXTBCLK 寄存器,您需要编写一个简单的内核模块。(我还不知道如何在设备树中执行此操作)

编辑:更新过时的引用:在内核模块中,您需要写入以下寄存器:0x44E10664 该寄存器也称为名称CONTROL_MODULE.pwmss_ctrl

如 SPRUH73H 的第 796 页- 2011 年 10 月 - AM335X 技术参考手册的 2013 年 4 月修订版,写入 0x01 启用 pwm 子系统 1,写入 0x02 启用子系统 2,写入 0x04 启用子系统 3,以及三者的任意组合(例如 0x07 启用所有这些:0x01 | 0x02 | 0x04 = 0x07)。

于 2015-05-05T22:07:21.560 回答
1

我使用的是内核 3.18 并且能够使用 eqep 模块,我已将这些模块添加到我的 am335x-bone-common-pinmux.dtsi 文件中以正确设置 pinmux。

...
/* eHRPWM0 module */
pinctrl_ehrpwm0: pinctrl_ehrpwm0 {
    pinctrl-single,pins = <
        0x150 0x23  /* P9_22 = GPIO0_2 = eHRPWM0A, MODE3 */
        0x190 0x21  /* P9_31 = GPIO3_14 = eHRPWM0A, MODE1 */
        0x154 0x23  /* P9_21 = GPIO0_3 = eHRPWM0B, MODE3 */
        /*0x0a4 0x23     This is not OK P8_46 = GPIO2_7 = eHRPWM0B, MODE3 */
    >;
};

/* eCAP0 module ?????*/
pinctrl_ecap0: pinctrl_ecap0 {
    pinctrl-single,pins = <
        0x164 0x20  /* P9_42A (?) = GPIO0_7 = eCAP0, MODE0 */
    >;
};

/* eQEP0 module */
pinctrl_eqep0: pinctrl_eqep0 {
    pinctrl-single,pins = <
        0x1a8 0x21  /* P9_41B = GPIO3_20 = eQEP0_index, MODE1 */
        0x1ac 0x21  /* P9_25 = GPIO3_21 = eQEP0_strobe, MODE1 */
        0x1a4 0x31  /* P9_27 = GPIO3_19 = eQEP0B_in, MODE1 */
        0x1a0 0x31  /* P9_42B = GPIO3_18 = eQEP0A_in, MODE1 */
    >;
};


/* eHRPWM1 module */
pinctrl_ehrpwm1: pinctrl_ehrpwm1 {
    pinctrl-single,pins = <
        0x048 0x26  /* P9_14 = GPIO1_18 = eHRPWM1A, MODE6 */
        0x0c8 0x22  /* P8_36 = GPIO2_16 = eHRPWM1A, MODE2 */
        0x04c 0x26  /* P9_16 = GPIO1_19 = eHRPWM1B, MODE6 */
        0x0cc 0x22  /* P8_34 = GPIO2_17 = eHRPWM1B, MODE2 */
    >;
};

/* eQEP1 module */
pinctrl_eqep1: pinctrl_eqep1 {
    pinctrl-single,pins = <
        /*0x0d8 0x22     P8_31 = GPIO0_10 = eQEP1_index, MODE2, USED FOR PHOTOCELLS */
        /*0x0dc 0x22     P8_32 = GPIO0_11 = eQEP1_strobe, MODE2 USED FOR PHOTOCELLS */
        0x0d4 0x32  /* P8_33 = GPIO0_09 = eQEP1B_in, MODE2 */
        0x0d0 0x32  /* P8_35 = GPIO0_08 = eQEP1A_in, MODE2 */
    >;
};


/* eHRPWM2 module */
pinctrl_ehrpwm2: pinctrl_ehrpwm2 {
    pinctrl-single,pins = <
        0x020 0x24  /* P8_19 = GPIO0_22 = eHRPWM2A, MODE4*/
        0x0a0 0x23  /* P8_45 = GPIO2_6 = eHRPWM2A, MODE3 */
        0x024 0x24  /* P8_13 = GPIO0_23 = eHRPWM2B, MODE4 */
        0x0a4 0x23  /* P8_46 = GPIO2_7 = eHRPWM2B, MODE3 */
    >;
};

/* eCAP2 module */
pinctrl_ecap2: pinctrl_ecap2 {
    pinctrl-single,pins = <
        0x19c 0x24  /* P9_28 = GPIO3_17 = eCAP2, MODE4 */
    >;
};

/* eQEP2 module */
pinctrl_eqep2: pinctrl_eqep2 {
    pinctrl-single,pins = <
        0x038 0x0F  /* P8_16 = GPIO1_14 = eQEP2_index, MODE4 --- STOLEN FOR MOTOR DIRECTION, ORIGINAL HEX value was 0x24*/
        0x03c 0x0F  /* P8_15 = GPIO1_15 = eQEP2_strobe, MODE4 --- STOLEN FOR MOTOR DIRECTION, ORIGINAL HEX value was 0x24*/
        0x034 0x34  /* P8_11 = GPIO1_13 = eQEP2B_in, MODE4 */
        0x030 0x34  /* P8_12 = GPIO1_12 = eQEP2A_in, MODE4 */
    >;
};
...

然后也在 am33x.dtsi 中:

    epwmss0: epwmss@48300000 {
        compatible = "ti,am33xx-pwmss";
        reg = <0x48300000 0x10>;
        ti,hwmods = "epwmss0";
        #address-cells = <1>;
        #size-cells = <1>;
        status = "disabled";
        ranges = <0x48300100 0x48300100 0x80   /* ECAP */
              0x48300180 0x48300180 0x80   /* EQEP */
              0x48300200 0x48300200 0x80>; /* EHRPWM */

        ecap0: ecap@48300100 {
            compatible = "ti,am33xx-ecap";
            #pwm-cells = <3>;
            reg = <0x48300100 0x80>;
            interrupts = <31>;
            interrupt-names = "ecap0";
            ti,hwmods = "ecap0";
            status = "disabled";
        };

        eqep0: eqep@48300180 {
            /* pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_eqep0>;*/
            compatible = "ti,am33xx-eqep";
            reg = <0x48300180 0x80>;
            ti,hwmods = "eqep0";
            interrupt-parent = <&intc>;
            interrupts = <79>;
            status = "disabled";
        };


        ehrpwm0: ehrpwm@48300200 {
            compatible = "ti,am33xx-ehrpwm";
            #pwm-cells = <3>;
            reg = <0x48300200 0x80>;
            ti,hwmods = "ehrpwm0";
            status = "disabled";
        };
    };

    epwmss1: epwmss@48302000 {
        compatible = "ti,am33xx-pwmss";
        reg = <0x48302000 0x10>;
        ti,hwmods = "epwmss1";
        #address-cells = <1>;
        #size-cells = <1>;
        status = "okay";
        ranges = <0x48302100 0x48302100 0x80   /* ECAP */
              0x48302180 0x48302180 0x80   /* EQEP */
              0x48302200 0x48302200 0x80>; /* EHRPWM */

        ecap1: ecap@48302100 {
            compatible = "ti,am33xx-ecap";
            #pwm-cells = <3>;
            reg = <0x48302100 0x80>;
            interrupts = <47>;
            interrupt-names = "ecap1";
            ti,hwmods = "ecap1";
            status = "disabled";
        };

        eqep1: eqep@48302180 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_eqep1>;
            compatible = "ti,am33xx-eqep";
            reg = <0x48302180 0x80>;
            ti,hwmods = "eqep1";
            interrupt-parent = <&intc>;
            interrupts = <88>;
            status = "okay";
        };


        ehrpwm1: ehrpwm@48302200 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_ehrpwm1>;
            compatible = "ti,am33xx-ehrpwm";
            #pwm-cells = <3>;
            reg = <0x48302200 0x80>;
            ti,hwmods = "ehrpwm1";
            status = "okay";
        };
    };

    epwmss2: epwmss@48304000 {
        compatible = "ti,am33xx-pwmss";
        reg = <0x48304000 0x10>;
        ti,hwmods = "epwmss2";
        #address-cells = <1>;
        #size-cells = <1>;
        status = "okay";
        ranges = <0x48304100 0x48304100 0x80   /* ECAP */
              0x48304180 0x48304180 0x80   /* EQEP */
              0x48304200 0x48304200 0x80>; /* EHRPWM */

        ecap2: ecap@48304100 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_ecap2>;
            compatible = "ti,am33xx-ecap";
            #pwm-cells = <3>;
            reg = <0x48304100 0x80>;
            interrupts = <61>;
            interrupt-names = "ecap2";
            ti,hwmods = "ecap2";
            status = "okay";
        };

        eqep2: eqep@48304180 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_eqep2>;
            compatible = "ti,am33xx-eqep";
            reg = <0x48304180 0x80>;
            ti,hwmods = "eqep2";
            interrupt-parent = <&intc>;
            interrupts = <89>;
            status = "okay";
        };

        ehrpwm2: ehrpwm@48304200 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_ehrpwm2>;
            compatible = "ti,am33xx-ehrpwm";
            #pwm-cells = <3>;
            reg = <0x48304200 0x80>;
            ti,hwmods = "ehrpwm2";
            status = "okay";
        };
    };

我重建了 am335x-boneblack.dtb 并复制到 BBB。在此之后,我从https://github.com/Teknoman117/beaglebot/tree/master/encoders加载了 eqep 内核模块 ,它工作正常。

于 2015-11-19T10:31:12.953 回答