Trouble enabling PWM pins on Beaglebone Black

This forum is for supported devices using an ARMv7 Texas Instruments (TI) SoC.

Trouble enabling PWM pins on Beaglebone Black

Postby yusefkarim » Thu May 02, 2019 3:00 am

Hi, I am running the latest version of Arch Linux on my beaglebone black and have noticed many things have changed since my last time using it a year ago.

Following a few other posts on this forum I have added the following line to /boot/boot.txt
$this->bbcode_second_pass_code('', '
...
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
load ${devtype} ${devnum}:${bootpart} 0x88060000 /lib/firmware/BB-PWM0-00A0.dtbo
fdt resize ${filesize}
fdt apply 0x88060000
...
')

After running ./mkscr successfully and rebooting I can actually see /sys/class/pwm/pwmchip0/
and export pwm-0:0/ but when I echo things into the duty_cycle and period files, then execute
$this->bbcode_second_pass_code('', '
[root /sys/class/pwm/pwmchip0/pwm-0\:0/]# echo 1 > enable
')

Nothing happens, I have also noticed in the file /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins
the pins for 14 and 16 are:
$this->bbcode_second_pass_code('', '
pin 14 (PIN14) 44e10838 00000027 pinctrl-single
pin 16 (PIN16) 44e10840 00000027 pinctrl-single
')

But from what I recall shouldn't the 00000027 values be 00000006 for PWM mode?

I would appreciate any help very much, thanks!
yusefkarim
 
Posts: 2
Joined: Thu May 02, 2019 2:48 am

Re: Trouble enabling PWM pins on Beaglebone Black

Postby yusefkarim » Thu May 02, 2019 12:03 pm

Oopsies, I figured it out. The correct overlay is BB-PWM1-00A0.dtbo. I will post the steps I took below, just for reference.

I am enabling EHRPWM1A (P9_14) and EHRPWM1B (P9_16), first edit your boot.txt (snippet below):
$this->bbcode_second_pass_code('', '
...
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
load ${devtype} ${devnum}:${bootpart} 0x88060000 /lib/firmware/BB-PWM1-00A0.dtbo
fdt resize ${filesize}
fdt apply 0x88060000
...
')
Then, run ./mkscr and reboot.

To actually play around with the pin you can:
$this->bbcode_second_pass_code('', '
cd /sys/class/pwm/pwmchip0
echo 0 > export
cd pwm-0\:0/
echo 20000000 > period
echo 570000 > duty_cycle
echo 1 > enable
')
The will setup EHRPWM1A and give the the specified duty cycle and period above, enabling it will turn it on. You should also probably disable it after to save power.

BONUS: If you want to take a look at the DTS for BB-PWM1-00A0.dtbo you can run:
$this->bbcode_second_pass_code('', '
dtc -I dtb -O dts /lib/firmware/BB-PWM1-00A0.dtbo -o PWM1.dts
vim PWM1.dts
')
yusefkarim
 
Posts: 2
Joined: Thu May 02, 2019 2:48 am


Return to Texas Instruments (TI)

Who is online

Users browsing this forum: No registered users and 2 guests