The first 3 PWM overlays’s for this spec : Beagleboard:BeagleBone cape interface spec - eLinux.org
v5.10.x-ti-arm64/src/arm64/overlays
Linux kernel device trees and device tree overlays for BeagleBoard.org open hardware single board computers and add-on boards. - BeagleBoard-DeviceTrees/src/arm64/overlays at v5.10.x-ti-arm64 · bea...
Are now enabled, they will be built by default in ‘r55’ of our 5.10.x kernel…
You can manually update via:
debian@BeagleBone:~$ cd /opt/source/dtb-5.10-ti-arm64/
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ git pull
Already up to date.
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ make
DTC src/arm64/k3-j721e-sk-rpi-exp-header.dtb
DTC src/arm64/k3-j721e-sk.dtb
DTC src/arm64/k3-j721e-cpb-csi2-ov5640.dtb
<snip>
DTC src/arm64/overlays/BONE-PWM0.dtbo
DTC src/arm64/overlays/BONE-PWM1.dtbo
DTC src/arm64/overlays/BONE-PWM2.dtbo
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ sudo make install
# install Device Tree
mkdir -p /boot/dtbs/5.10.120-ti-arm64-r53.1/ti/
cp src/arm64/*.dtb /boot/dtbs/5.10.120-ti-arm64-r53.1/ti/
cp src/arm64/overlays/*.dtbo /boot/dtbs/5.10.120-ti-arm64-r53.1/ti/overlays/
cp /boot/dtbs/5.10.120-ti-arm64-r53.1/ti/k3-j721e-*.dtb /boot/firmware/
cp /boot/dtbs/5.10.120-ti-arm64-r53.1/ti/overlays/*.dtbo /boot/firmware/overlays
debian@BeagleBone:/opt/source/dtb-5.10-ti-arm64$ sudo reboot
Add Overlay to extlinux:
debian@BeagleBone:~$ cat /boot/firmware/extlinux/extlinux.conf
label Linux microSD
kernel /Image
append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
fdtdir /
fdtoverlays /overlays/BONE-PWM0.dtbo /overlays/BONE-PWM1.dtbo /overlays/BONE-PWM2.dtbo
initrd /initrd.img
fdtoverlays command supports single or multiple overlays listed…
Verify:
debian@BeagleBone:~$ sudo beagle-version | grep UBOOT
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
UBOOT: Loaded Overlay:[BONE-PWM0.kernel]
UBOOT: Loaded Overlay:[BONE-PWM1.kernel]
UBOOT: Loaded Overlay:[BONE-PWM2.kernel]
There are two more pwm’s available on the header that don’t follow the /dev/bone/pwm/* spec consider them extra for the bb ai-64…
Two other BB AI-64 only pwm’s:
/overlays/BBAI64-P8_37-ehrpwm5_a.dtbo
/overlays/BBAI64-P9_25-ehrpwm4_b.dtbo
Regards,
2 Likes
Hello Sir,
@RobertCNelson , sir, Seth here.
Um…has it already been decided what pins are what on the BONE-PWM0 - BONE-PWM2.kernel .DTBOs?
I am asking. I tried /overlays/BBAI64-P9_25-ehrpwm4_b.dtbo. For whatever reason, I had a LED shatter. Good power or lack of mechanical accessible moves. Either way, I am trying BONE-PWM0 - 2.kernel now.
Seth
P.S. I looked for the Compatible layer spec. recently and could not find the exact pin muxing for the BONE-PWM0 - 2.kernel pins…
I will keep testing. Oh. I also noticed, if anyone wants to jump in here:
I can echo 50000 > period
and then echo 10000 > duty_cycle
.
Then, I can echo 1 > enable
.
The issue remains, when I try to use say in pwmchip0
the pwm1, I get an error when trying to use the pwm0 section of the same pwmchip0
.
Here is the error in case anyone cares to comment:
-bash: echo: write error: Invalid argument
That’s stated in the first url I posted above…
pwm0 and pwm1 have a shared clock, so if you enable one, then the other needs to be a variation of them other…
If you want a better response then post exactly what you typed instead of just the error message.
Regards,
1 Like
Hello @RobertCNelson ,
Sir, gotcha. I just saw the link to the specification. /dev/bone/pwm/*
.
I was looking at /sys/class/pwm/
instead and looking at pwmchip*
.
Seth
P.S. Off to try that miracle of functionality! Thank you for the tip.
To answer though…
cd /sys/class/pwmchip0
cd pwm1
echo 50000 > period
echo 10000 > duty_cycle
echo 1 > enable
This is what I tried so far. I will get w/ the program sooner or later. Thank you!
Hello Sir,
@RobertCNelson , me again…
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
UBOOT: Loaded Overlay:[BONE-PWM0.kernel]
UBOOT: Loaded Overlay:[BONE-PWM1.kernel]
UBOOT: Loaded Overlay:[BONE-PWM2.kernel]
That is what I have loaded via the command, sudo beagle-version | grep UBOOT
, and in /dev/bone/*
there is only uart.
Seth
P.S. Here is the uart connection…
ls -l 0
lrwxrwxrwx 1 root root 11 Mar 20 19:55 0 -> ../../ttyS2
silver2row:
/dev/bone/pwm/*
Use this location, as they are symlinks set to the actual pin…
That by itself won’t show the error. The values you set in pwm0 are important.
‘period’ is shared by channel a and b, once you set period for a, it’s now fixed for b… only duty cycle can be changed for shared pwm
1 Like
Hello Sir,
@RobertCNelson , you are correct. I am sorry for only showing the first half of my actual commands.
cd /sys/class/pwmchip0
cd pwm1
echo 50000 > period
echo 10000 > duty_cycle
echo 1 > enable
echo 0 > enable
cd ../pwm0
echo 50000 > period
echo 10000 > duty_cycle
echo 1 > enable
That is how I came upon that error. I see what you typed recently about a and b channels.
Did I make a gaff or some huge mistake for the community who likes shared PWM channels?
Seth
P.S.
Sir, I cannot as my board set up only reveals the /dev/bone/uart/0
and not /dev/bone/pwm/*
in that directory. I will keep trying to configure things correctly.
That’s right i explained in another forum, this would be fixed on the 1st…
So run:
sudo apt update
sudo apt install --only-upgrade bb-customizations
sudo systemctl enable bb-symlinks.service
sudo reboot
and /dev/bone/pwm/* will now show up…
debian@BeagleBone:~$ cat /boot/firmware/extlinux/extlinux.conf | grep fdtoverlays
fdtoverlays /overlays/BONE-PWM0.dtbo /overlays/BONE-PWM1.dtbo /overlays/BONE-PWM2.dtbo
debian@BeagleBone:~$ tree /dev/bone/pwm/
/dev/bone/pwm/
├── 0
│ ├── a -> /sys/class/pwm/pwmchip2/pwm0/
│ └── b -> /sys/class/pwm/pwmchip2/pwm1/
├── 1
│ ├── a -> /sys/class/pwm/pwmchip4/pwm0/
│ └── b -> /sys/class/pwm/pwmchip4/pwm1/
└── 2
├── a -> /sys/class/pwm/pwmchip0/pwm0/
└── b -> /sys/class/pwm/pwmchip0/pwm1/
9 directories, 0 files
debian@BeagleBone:~$ cd /dev/bone/pwm/0/a/
debian@BeagleBone:/dev/bone/pwm/0/a$ echo 50000 > period
debian@BeagleBone:/dev/bone/pwm/0/a$ echo 10000 > duty_cycle
debian@BeagleBone:/dev/bone/pwm/0/a$ echo 1 > enable
debian@BeagleBone:/dev/bone/pwm/0/a$ cd ../b/
debian@BeagleBone:/dev/bone/pwm/0/b$ cat period duty_cycle enable
0
0
0
debian@BeagleBone:/dev/bone/pwm/0/b$ echo 50000 > period
debian@BeagleBone:/dev/bone/pwm/0/b$ echo 10000 > duty_cycle
debian@BeagleBone:/dev/bone/pwm/0/b$ cat period duty_cycle enable
50000
10000
0
debian@BeagleBone:/dev/bone/pwm/0/b$ echo 1 > enable
debian@BeagleBone:/dev/bone/pwm/0/b$ cat period duty_cycle enable
50000
10000
1
Regards,
3 Likes
Hello Sir,
I am sorry. I got excited and did not see where you stated this would not be working until the first. I am one day early.
Seth
P.S. Explanation well received. Thank you, sir.
Hello Sir,
@RobertCNelson , thank you. The trick was w/ your knowledge and the lack thereof in mine.
Seth
P.S. /dev/bone/*
now has pwm
and uart
.
jy46
November 12, 2022, 9:13pm
12
Is there an updated process on how to do PWM for the BeagleBone AI-64? I believe I followed the steps and get the devices to appear under /dev/bone, and I can change the period, duty cycle, and enable. However, I cannot seem to get the output to change in the pins themselves. My current test is an LED. I would expect it to get brighter for higher duty cycle but I don’t see any changes (it’s off for most PWM pins I’ve tried).
Did you load the overlays?
sudo beagle-version
Regards
Tron
November 13, 2022, 6:54am
14
Is there a table or something somewhere in the documentation that tells which pins on the BBAI 64 expention headers are capable of PWM. Also I am looking for more info about the pins that that are connected to the Arm R5 and have PWM capability. I want to drive 6 servos
The R5 cores can access any of the pins. If you do a search with tag bbai64 and spreadsheet you should find a post by me with the header pins and the various pin mux alternatives
1 Like
jy46
November 13, 2022, 1:35pm
16
@RobertCNelson I checked and they were loaded. My issue ended up being that I didn’t realize there were 4 extra pins on P9 before normal indexing starts, and it seems both a and b need to be enabled for a given pwmchip. Thank you so much for your help!
@Tron I believe the PWM table here (given earlier by @RobertCNelson ) is correct: Beagleboard:BeagleBone cape interface spec - eLinux.org
1 Like
I am using Kernel version 5.10.153-ti-arm64-r84
I exectued all the steps above but failed the verification step.
I get the following
debian@BeagleBone:~$ sudo beagle-version | grep UBOOT
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
No BONE-PWM0, BONE-PWM1, and BONE-PWM2 was loaded
@klindsayjr please post the output of:
cat /boot/firmware/extlinux/extlinux.conf
Regards,
label Linux microSD
kernel /Image
append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
fdtdir /
fdtoverlays /overlays/BONE-PWM0.dtbo /overlays/BONE-PWM1.dtbo /overlays/BONE-PWM2.dtbo
initrd /initrd.img
debian@BeagleBone:~/$ cat /boot/firmware/extlinux/extlinux.conf | grep fdtoverlays
#fdtoverlays /overlays/<file>.dtbo
fdtoverlays /overlays/BONE-PWM0.dtbo /overlays/BONE-PWM1.dtbo /overlays/BONE-PWM2.dtbo
debian@BeagleBone:~/$ sudo beagle-version
eeprom:[BBONEAI-64-B0-B0007801B0000164WW22BBBBBBSSSS]
model:[BeagleBoard.org_BeagleBone_AI-64]
dogtag:[BeagleBoard.org Debian Bullseye Xfce Image 2023-01-02]
bootloader:[/dev/mmcblk0boot0]:[tiboot3.bin]:[U-Boot SPL 2021.01-gc21ddbdf (Nov 28 2022 - 15:42:44 +0000)]
bootloader:[/dev/mmcblk0]:[/boot/firmware/tiboot3.bin]:[U-Boot SPL 2021.01-gc21ddbdf (Nov 28 2022 - 15:42:44 +0000)]
bootloader:[/dev/mmcblk0]:[/boot/firmware/tispl.bin]:[U-Boot SPL 2021.01-gc21ddbdf (Nov 28 2022 - 15:42:44 +0000)]
bootloader:[/dev/mmcblk0]:[/boot/firmware/u-boot.img]:[U-Boot 2021.01-gc21ddbdf (Nov 28 2022 - 15:42:44 +0000)]
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
UBOOT: Loaded Overlay:[BONE-PWM0.kernel]
UBOOT: Loaded Overlay:[BONE-PWM1.kernel]
UBOOT: Loaded Overlay:[BONE-PWM2.kernel]
kernel:[5.10.153-ti-arm64-r86]
nodejs:[v12.22.12]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-customizations]:[1.20221230.0-0~bullseye+20221230]
pkg:[bb-usb-gadgets]:[1.20220816.0-0~bullseye+20220816]
cmdline:[root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait net.ifnames=0 quiet]
dmesg | grep remote
[ 5.657798] remoteproc remoteproc0: b034000.pru is available
[ 5.657999] remoteproc remoteproc1: b004000.rtu is available
[ 5.658144] remoteproc remoteproc2: b00a000.txpru is available
[ 5.658269] remoteproc remoteproc3: b038000.pru is available
[ 5.658775] remoteproc remoteproc4: b006000.rtu is available
[ 5.658946] remoteproc remoteproc5: b00c000.txpru is available
[ 5.659101] remoteproc remoteproc6: b134000.pru is available
[ 5.659250] remoteproc remoteproc7: b104000.rtu is available
[ 5.659394] remoteproc remoteproc8: b10a000.txpru is available
[ 5.659528] remoteproc remoteproc9: b138000.pru is available
[ 5.659676] remoteproc remoteproc10: b106000.rtu is available
[ 5.659800] remoteproc remoteproc11: b10c000.txpru is available
[ 7.992454] k3-dsp-rproc 4d80800000.dsp: configured DSP for remoteproc mode
[ 8.053416] remoteproc remoteproc12: 4d80800000.dsp is available
[ 8.054972] k3-dsp-rproc 4d81800000.dsp: configured DSP for remoteproc mode
[ 8.070326] remoteproc remoteproc13: 4d81800000.dsp is available
[ 8.074953] remoteproc remoteproc12: powering up 4d80800000.dsp
[ 8.074964] remoteproc remoteproc12: Booting fw image vision_apps_eaik/vx_app_rtos_linux_c6x_1.out, size 1461044
[ 8.077183] k3-dsp-rproc 64800000.dsp: configured DSP for remoteproc mode
[ 8.084124] remoteproc remoteproc14: 64800000.dsp is available
[ 8.095784] remoteproc remoteproc13: powering up 4d81800000.dsp
[ 8.095804] remoteproc remoteproc13: Booting fw image vision_apps_eaik/vx_app_rtos_linux_c6x_2.out, size 1461012
[ 8.114731] remoteproc12#vdev0buffer: assigned reserved memory node vision-apps-c66-dma-memory@a9000000
[ 8.114805] remoteproc12#vdev0buffer: registered virtio0 (type 7)
[ 8.114809] remoteproc remoteproc12: remote processor 4d80800000.dsp is now up
[ 8.115447] remoteproc13#vdev0buffer: assigned reserved memory node vision-apps-c66-dma-memory@a8000000
[ 8.115566] remoteproc13#vdev0buffer: registered virtio1 (type 7)
[ 8.115571] remoteproc remoteproc13: remote processor 4d81800000.dsp is now up
[ 8.182898] remoteproc remoteproc14: powering up 64800000.dsp
[ 8.182910] remoteproc remoteproc14: Booting fw image vision_apps_eaik/vx_app_rtos_linux_c7x_1.out, size 13242432
[ 8.182984] remoteproc remoteproc14: unsupported resource 65538
[ 8.213311] remoteproc14#vdev0buffer: assigned reserved memory node vision-apps-c71-dma-memory@aa000000
[ 8.213411] remoteproc14#vdev0buffer: registered virtio2 (type 7)
[ 8.213416] remoteproc remoteproc14: remote processor 64800000.dsp is now up
[ 8.996516] remoteproc remoteproc15: 41000000.r5f is available
[ 8.996575] remoteproc remoteproc15: attaching to 41000000.r5f
[ 9.004911] remoteproc15#vdev0buffer: assigned reserved memory node vision-apps-r5f-dma-memory@a0000000
[ 9.005024] remoteproc15#vdev0buffer: registered virtio3 (type 7)
[ 9.005028] remoteproc remoteproc15: remote processor 41000000.r5f is now attached
[ 9.054773] platform 5c00000.r5f: configured R5F for remoteproc mode
[ 9.077594] remoteproc remoteproc16: 5c00000.r5f is available
[ 9.077801] remoteproc remoteproc16: Direct firmware load for vision_apps_eaik/vx_app_rtos_linux_mcu2_0.dontload failed with error -2
[ 9.077810] remoteproc remoteproc16: powering up 5c00000.r5f
[ 9.077833] remoteproc remoteproc16: Direct firmware load for vision_apps_eaik/vx_app_rtos_linux_mcu2_0.dontload failed with error -2
[ 9.077838] remoteproc remoteproc16: request_firmware failed: -2
[ 9.078698] platform 5d00000.r5f: configured R5F for remoteproc mode
[ 9.123022] remoteproc remoteproc17: 5d00000.r5f is available
[ 9.123211] remoteproc remoteproc17: Direct firmware load for vision_apps_eaik/vx_app_rtos_linux_mcu2_1.dontload failed with error -2
[ 9.123221] remoteproc remoteproc17: powering up 5d00000.r5f
[ 9.123238] remoteproc remoteproc17: Direct firmware load for vision_apps_eaik/vx_app_rtos_linux_mcu2_1.dontload failed with error -2
[ 9.123243] remoteproc remoteproc17: request_firmware failed: -2
[ 9.134927] platform 5e00000.r5f: configured R5F for remoteproc mode
[ 9.150078] remoteproc remoteproc18: 5e00000.r5f is available
[ 9.150280] remoteproc remoteproc18: Direct firmware load for j7-main-r5f1_0-fw failed with error -2
[ 9.150292] remoteproc remoteproc18: powering up 5e00000.r5f
[ 9.150308] remoteproc remoteproc18: Direct firmware load for j7-main-r5f1_0-fw failed with error -2
[ 9.150313] remoteproc remoteproc18: request_firmware failed: -2
[ 9.159014] platform 5f00000.r5f: configured R5F for remoteproc mode
[ 9.176035] remoteproc remoteproc19: 5f00000.r5f is available
[ 9.176596] remoteproc remoteproc19: Direct firmware load for j7-main-r5f1_1-fw failed with error -2
[ 9.176608] remoteproc remoteproc19: powering up 5f00000.r5f
[ 9.176627] remoteproc remoteproc19: Direct firmware load for j7-main-r5f1_1-fw failed with error -2
[ 9.176632] remoteproc remoteproc19: request_firmware failed: -2
[ 9.353758] remoteproc remoteproc16: powering up 5c00000.r5f
[ 9.374163] remoteproc remoteproc16: Booting fw image vision_apps_eaik_8.2/vx_app_rtos_linux_mcu2_0.out, size 572788
[ 9.381002] remoteproc16#vdev0buffer: assigned reserved memory node vision-apps-r5f-dma-memory@a2000000
[ 9.381122] remoteproc16#vdev0buffer: registered virtio4 (type 7)
[ 9.381126] remoteproc remoteproc16: remote processor 5c00000.r5f is now up
[ 9.381563] remoteproc remoteproc17: powering up 5d00000.r5f
[ 9.384359] remoteproc remoteproc17: Booting fw image vision_apps_eaik_8.2/vx_app_rtos_linux_mcu2_1.out, size 297932
[ 9.387936] remoteproc17#vdev0buffer: assigned reserved memory node vision-apps-r5f-dma-memory@a4000000
[ 9.388039] remoteproc17#vdev0buffer: registered virtio5 (type 7)
[ 9.388043] remoteproc remoteproc17: remote processor 5d00000.r5f is now up
dmesg | grep pru
[ 5.657798] remoteproc remoteproc0: b034000.pru is available
[ 5.658144] remoteproc remoteproc2: b00a000.txpru is available
[ 5.658269] remoteproc remoteproc3: b038000.pru is available
[ 5.658946] remoteproc remoteproc5: b00c000.txpru is available
[ 5.659101] remoteproc remoteproc6: b134000.pru is available
[ 5.659394] remoteproc remoteproc8: b10a000.txpru is available
[ 5.659528] remoteproc remoteproc9: b138000.pru is available
[ 5.659800] remoteproc remoteproc11: b10c000.txpru is available
dmesg | grep pinctrl-single
[ 0.713963] pinctrl-single 4301c000.pinctrl: 94 pins, size 376
[ 0.714239] pinctrl-single 11c000.pinctrl: 173 pins, size 692
dmesg | grep gpio-of-helper
lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 005: ID 046d:c34b Logitech, Inc. USB Keyboard
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 004: ID 046d:082d Logitech, Inc. HD Pro Webcam C920
Bus 001 Device 002: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
lspci
00:00.0 PCI bridge: Texas Instruments Device b00d
END
I would guess your version of u-boot is too old…
Regards,