gpt4 book ai didi

linux - 在 linux 内核 3.12 中使用 leds-pwm susbsystem 控制 LED

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:31:58 26 4
gpt4 key购买 nike

我们正在使用基于 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

我们如下修改设备树以启用 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 下的亮度和触发器,但没有用,有什么建议么?你看到什么东西不见了吗?

谢谢,

问候,安库尔

最佳答案

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

关于linux - 在 linux 内核 3.12 中使用 leds-pwm susbsystem 控制 LED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25721969/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com