1

我们正在使用基于 beaglebone black 的定制板,我们正在为我们的板移植 linux 3.12,我们有三个使用 pwm 控制的 LED。那些 LED 连接到下面的球,

1. E18 --> Pinmux mode 0 --> eCAP0_in_PWM0_out
2. B19 --> Pinmux mode 3 --> eCAP1_in_PWM1_out
3. C18 --> Pinmux mode 3 --> eCAP2_in_PWM2_out

我们修改了 device-tree 如下以启用 leds-pwm 支持,

 am33xx_pinmux: pinmux@44e10800 {
            pinctrl-names = "default";
            backlight_pin_0: pinmux_backlight_pin_0 {
                    pinctrl-single,pins = <
                            0x164 0x00  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
            backlight_pin_1: pinmux_backlight_pin_1 {
                    pinctrl-single,pins = <
                            0x18C 0x03  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
            backlight_pin_2: pinmux_backlight_pin_2 {
                    pinctrl-single,pins = <
                            0x188 0x03  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
};


ocp {

                    epwmss0: epwmss@48300000 {
                    status = "okay";
                    /*ecap0: ecap@48300100 {*/
                    ehrpwm0: ehrpwm@48300200 {
                            status = "okay";
                            pinctrl-names = "default";
                            pinctrl-0 = <&backlight_pin_0>;
                    };
            };
            epwmss1: epwmss@48302000 {
                    status = "okay";
                    /*ecap0: ecap@48300100 {*/
                    ehrpwm1: ehrpwm@48302200 {
                            status = "okay";
                            pinctrl-names = "default";
                            pinctrl-0 = <&backlight_pin_1>;
                    };
            };

};


        pwm_led {
            compatible = "pwm-leds";
            led0 {
                    pwms = <&ehrpwm0 0 50 1>;
                    max-brightness = <255>;
                    linux,default-trigger = "default-on";
                    brightness = <127>;
                    status = "okay";
            };
            led1 {
                    pwms = <&ehrpwm1 1 50 1>;
                    max-brightness = <255>;
                    linux,default-trigger = "default-on";
                    brightness = <127>;
            };

    };

通过上述更改,我们在“/sys/class/pwm/”和“/sys/class/leds/”中看到了条目。但问题是我们无法控制 LED,LED 无法开启,

# ls /sys/class/leds/
led0  led1
# ls /sys/class/leds/led0/
brightness      max_brightness  subsystem       uevent
device          power           trigger
# cat /sys/class/leds/led0/trigger
none nand-disk timer oneshot heartbeat backlight gpio cpu0 [default-on]
# cat /sys/class/leds/led0/brightness
255
# cat /sys/class/leds/led0/max_brightness
255
# ls /sys/class/pwm/
pwmchip0  pwmchip2
# ls /sys/class/pwm/pwmchip0
device     export     npwm       power      subsystem  uevent     unexport
# cat /sys/class/pwm/pwmchip0/device/modalias
platform:48300200.ehrpwm

我们尝试改变 LED 下的亮度和触发器,但没有帮助,有什么建议吗?你看到什么东西不见了吗?

谢谢,

问候, 安库尔

4

1 回答 1

0

最后我们发现我们应该使用ecap而不是ehrpwm使 pwm 工作。
有关详细答案,请参阅以下链接
http://e2e.ti.com/support/embedded/linux/f/354/t/366635.aspx

于 2014-09-10T05:18:53.937 回答