Hello everyone, I’m working with beaglebone black kernel 4.19-ti (debian 10). I want a led controlled by pwm to light up at boot time. I first wrote a DTS, to practice, turning on the led from boot to mode 7 (gpio) and it worked well, I switched to mode 4 and there it’s more complicated can somebody look at just these few lines?
fragment@3 {
target-path="/";
__overlay__ {
leds {
pinctrl-names = "default";
pinctrl-0 = <&bb_pwm_led_pins>; /*not sure*/
compatible = "pwm-ehrpwm"; /*not sure*/
P8_13 {
label = "P8_13";
pwms = <&ehrpwm2 1 500000 0>; /*not sure*/
pwm-dutycycle = <500000>; /* 100% duty cycle */
default-state = "on"; /*not sure*/
status = "okay"; /*not sure*/
};
};
};
};
I can put the whole file if needed.
Thanks a lot in advance,
Jean
Maybe it’s better but I don’t really know what I’m doing, see following all the code :
/*EHRPWM2B, P8_13*/
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/board/am335x-bbw-bbb-base.h> /*???*/
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_pwm_led_pins: pinmux_bb_pwm_led_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* OR BONE_P8_13 (PIN_OUTPUT_PULLUP | MUX_MODE4) */
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
pwm_test_P8_13: pwm_test_P8_13 {
compatible = "pwm-ehrpwm"; /* For eHRPWM or maybe it is gpio-pwms ???? */
status = "okay"; /* Enable the PWM device */
pwms = <&ehrpwm2 1 500000 0>; /* PWM2B, period = 500000ns (2kHz), polarity = normal */
pwm-dutycycle = <250000>; /* 50% duty cycle */
pinctrl-names = "default";
pinctrl-0 = <&bb_pwm_led_pins>;
};
};
};
};
1 Like
Where do you think I can find documentation on this subject? What is the difference between:
AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
AND
BONE_P8_13 (PIN_OUTPUT_PULLUP | MUX_MODE4)
It is
compatible = "pwm-ehrpwm";
OR
compatible = "gpio-pwms";
or maybe gpio-pwm?
if you have an idea, even a link, I’d love to hear from you.
At a guess you need leds-pwm.
Check the kernel devictree documentation Documentation/devicetree/bindings/leds/leds-pwm.txt
Now how it all goes together I have no idea. I would start by searching the dts files for “pwm-leds” to see if they have been implemented for any other device and maybe get some idea from that what you need to set.
1 Like