1 year ago

#261394

test-img

savin poster

How to work with PWM in sysfs in BeagleBoneBlack correctly?

I want to control LED brightness with PWM with my beagleboneblack.

To enable PWM in my yocto build I've done following steps:

  1. Enabled PWM in kernel menuconfig (bitbake -c menuconfig virtual/kernel)
  2. Patched device tree with
diff --git a/am335x-boneblack.dts b/am335x-boneblack.dts index e2ee8b8..8d36bfb 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts @@ -167,3 +167,21 @@       "NC",       "NC";  };
+
+&ehrpwm2 {
+    status = "okay";
+};
+
+&epwmss2 {
+    status = "okay";
+};
+
+&ehrpwm1 {
+    status = "okay";
+};
+
+&epwmss1 {
+    status = "okay";
+};
  1. In /sys/class/pwm

cd pwmchip0

echo 0 > export

cd pwm0

echo 200000 > period

echo 100000 > duty_cycle

echo 1 > enable

After this I connected LED to P9_22 port and nothing works. Also changing duty_cycle doesn't affect at anything.

Image with debug output (cat /sys/kernel/debug/pwm)

Did I make something wrong or I've chosen wrong port ?

Thanks in Advance

Regards, Long

embedded-linux

yocto

beagleboneblack

pwm

0 Answers

Your Answer

Accepted video resources