What image are you using, need a link to it, if its out of the box I will boot it up and have a look at it.
See the output of version.sh below.
Youāll notice this line
uboot_overlay_options:[uboot_overlay_addr4=/sys/firmware/BB-PWM2-00A0.dtbo] Blockquote
I have booted without this and with the line for PWM0 and PWM1 and it makes no difference.
I have confirmed that P8_19 works for PWM by using a scope to see the output waveform. I cannot get P8_13 configured. I am not a device tree overlay guru by any stretch. I do good to spell it and have been standing on the shoulders of giants in this area! So I do appreciate your help!
debian@beaglebone:/sys$ sudo /opt/scripts/tools/version.sh
[sudo] password for debian:
git:/opt/scripts/:[e4e4854ef8ff9ada5c85553376043ee7679167ca]
eeprom:[A335BNLT00C02411SBB01663]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2021-02-15]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-gc9b3922522]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0.kernel]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.kernel]
kernel:[4.19.94-ti-r68]
nodejs:[v10.23.1]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/sys/firmware/BB-PWM2-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.14.20210809.0-0~buster+20210816]
pkg:[bb-customizations]:[1.20210810.1-0~buster+20210810]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input bluetooth netdev i2c gpio admin spi iio docker tisdk weston-launch xenomai cloud9ide pwm eqep remoteproc]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 77.112194] remoteproc remoteproc0: wkup_m3 is available
[ 77.207814] remoteproc remoteproc0: powering up wkup_m3
[ 77.207847] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 77.208133] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 79.622993] remoteproc remoteproc1: 4a334000.pru is available
[ 79.633722] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 79.622993] remoteproc remoteproc1: 4a334000.pru is available
[ 79.623191] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[ 79.633722] remoteproc remoteproc2: 4a338000.pru is available
[ 79.633872] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[ 1.026916] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 1.040546] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
Are you able to light any of them up from cli?
# Step 1: Export PWM channel 0
echo 0 > /sys/class/pwm/pwmchip0/export
# Step 2: Set period to 1 ms (1 kHz frequency)
echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/period
# Step 3: Set duty cycle to 50% (500 Āµs)
echo 500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
# Step 4: Enable the PWM output
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
update:
Just found an image that is close to yours and it does not have 5. It is also missing the overlays you have.
debian@beaglebone:/sys/class/pwm$ ls
pwm-0:0 pwm-1:1 pwm-4:0 pwm-6:0 pwm-7:1 pwmchip1 pwmchip4 pwmchip7
pwm-1:0 pwm-3:0 pwm-4:1 pwm-7:0 pwmchip0 pwmchip3 pwmchip6
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r42
Maybe just try to light up all the ones that are exposed and see if your pin gets a signal.
I donāt understand why P8-13 is so important, but I got it to work on pwmchip7ā¦
debian@bbb21:/sys/class/pwm/pwmchip7/pwm-7:1$ uname -r
4.14.71-ti-r80
debian@bbb21:/sys/class/pwm/pwmchip7/pwm-7:1$
306 config-pin -i p8.13
307 config-pin -q p8.13
308 config-pin -a p8.13 pwm
309 config-pin -q p8.13
310 cd /sys/class/pwm
311 ls
312 ls -l
313 cd pwmchip7
314 ls
315 ls -l
316 echo 1 > export
317 ls
318 cd pwm-7:1/
319 ls
320 l s-l
321 ls -l
322 cat enable
323 cat *
324 sudo sh -c āecho 1000000000 > periodā
325 sudo sh -c āecho 100000000 > duty_cycleā
326 sudo sh -c āecho 1 > enableā
327 sudo sh -c āecho 10000000 > duty_cycleā
328 sudo sh -c āecho 1 > enableā
329 sudo sh -c āecho 100000000 > periodā
330 uname -r
Does that image have the shadow registers and some other stuff exposed under /pwm?
Thanks. I had to move forward. We have to get these units running to start an experiment on time so I just shifted over to using P8_19. But I am not giving up on P8_13 completely! P8_19 works fine and we can use P8_13 to turn the motor on and off but canāt control the speed with PWM since that wonāt configure.
P8_13 was important because our custom PCB was designed to use it. But I punted for now and hacked over to use P8_19 which works fine.
When I boot I only see pwm-7:0 and can access that using C. Itās P8_19. I donāt see a pwm-7:1 and donāt know why.
Where can I find a mapping between the pwmchip#s and the actual pins on the Black?
I wish I knewā¦
As I noted much earlier in this topic, I must have just tried each pwmchip? in turnā¦
it is not too cumbersome, if you have your LED or scope set up.
can I ask what image you are using??? this seems to be critical to this issue (which I was ignorant of for a long time).
The closest documentation that I have found to how Iāve been doing it is the same as you have posted: Molloy EBB second edition chapter 6.ā¦ his example is also specific to the image that he is using.
This is just one of a set of issues where Iāve been unable to run down a deterministic method of answering questions like this ā¦ but Iām still trying. For now Iām just more aware that the details can change image to imageā¦ What confuses me most is that no matter how I study the device tree ( decompiled dtb is easier, and SHOULD have all the data, I think )
Iām happy to contribute to the limit of my abilityā¦
good luck
gomer
Thanks for any and all help! I couldnāt do this without this community!