pwm not present in BB blue

Hello together,

at the moment, I have some trouble getting the PWM to work at the BB blue. I have a sd card with the debian 11.5 minimal image. when the bb black boots from this sd card, it seems like the pwm chips are just fine

debian@BeagleBone:/sys/class/pwm$ ls -lah
total 0
drwxr-xr-x  2 root root 0 Jan  1  2000 .
drwxr-xr-x 67 root root 0 Jan  1  2000 ..
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip0 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48300000.target-module/48300000.epwmss/48300100.pwm/pwm/pwmchip0
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip1 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48302000.target-module/48302000.epwmss/48302100.pwm/pwm/pwmchip1
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip2 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48304000.target-module/48304000.epwmss/48304100.pwm/pwm/pwmchip2
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip3 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48300000.target-module/48300000.epwmss/48300200.pwm/pwm/pwmchip3
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip5 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48302000.target-module/48302000.epwmss/48302200.pwm/pwm/pwmchip5
lrwxrwxrwx  1 root root 0 Jan  1  2000 pwmchip7 -> ../../devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48304000.target-module/48304000.epwmss/48304200.pwm/pwm/pwmchip7
debian@BeagleBone:/sys/class/pwm$ cd /dev/bone/pwm/
debian@BeagleBone:/dev/bone/pwm$ ls -lah
total 0
drwxr-xr-x 5 root root 100 May 29 06:12 .
drwxr-xr-x 8 root root 160 May 29 06:12 ..
drwxr-xr-x 2 root root  80 May 29 06:12 0
drwxr-xr-x 2 root root  80 May 29 06:12 1
drwxr-xr-x 2 root root  80 May 29 06:12 2

but the same image on the bb blue results in

debian@BeagleBone:/sys/class/pwm$ ls -lah
total 0
drwxr-xr-x  2 root root 0 Jan  1  2000 .
drwxr-xr-x 67 root root 0 Jan  1  2000 ..
debian@BeagleBone:/sys/class/pwm$ cd /dev/bone/pwm/
debian@BeagleBone:/dev/bone/pwm$ ls -lah
total 0
drwxr-xr-x 2 root root  40 May 29 06:12 .
drwxr-xr-x 6 root root 120 May 29 06:12 ..

Does anyone have an idea about that?

thanks and best regards

I don’t have a blue, however, check your device tree overlays and look for one that is related to PWM. Add it to your boot file then reboot.

Since you don’t have a “virtual” file for PWM in sys/class it means the device is not turned on or the blue does not support PWM. Pretty sure it does so it is your device tree. BB has a good list of device tree files preconfigured.

thanks for your answer. i haven’t heard of device tree overlays yet. sounds a bit strange to me. anyway, i will read some stuff about that.

thanks for the link. anyway, i tried

apt install bb-cape-overlays

according to GitHub - beagleboard/bb.org-overlays: Device Tree Overlays for bb.org boards but it is already in the newest version.

here it says there is some pwm dtbo

root@BeagleBone:/home/debian# ls -lah /lib/firmware/ | grep -i pwm
-rw-r–r-- 1 root root 1.2K Aug 21 2021 BB-PWM-TIMER-P8.07.dtbo
-rw-r–r-- 1 root root 1.2K Aug 21 2021 BB-PWM-TIMER-P8.08.dtbo
-rw-r–r-- 1 root root 1.2K Aug 21 2021 BB-PWM-TIMER-P8.09.dtbo
-rw-r–r-- 1 root root 1.2K Aug 21 2021 BB-PWM-TIMER-P8.10.dtbo
-rw-r–r-- 1 root root 1.4K Aug 21 2021 BB-PWM0-00A0.dtbo
-rw-r–r-- 1 root root 1.4K Aug 21 2021 BB-PWM1-00A0.dtbo
-rw-r–r-- 1 root root 1.4K Aug 21 2021 BB-PWM2-00A0.dtbo
-rw-r–r-- 1 root root 917 Aug 21 2021 PB-PWM-RGB-TECHLAB-CAPE.dtbo
-rw-r–r-- 1 root root 994 Aug 21 2021 PB-PWM-TIMER-P1.20.dtbo
-rw-r–r-- 1 root root 994 Aug 21 2021 PB-PWM-TIMER-P1.26.dtbo
-rw-r–r-- 1 root root 994 Aug 21 2021 PB-PWM-TIMER-P1.28.dtbo
-rw-r–r-- 1 root root 994 Aug 21 2021 PB-PWM-TIMER-P2.27.dtbo
-rw-r–r-- 1 root root 994 Aug 21 2021 PB-PWM-TIMER-P2.31.dtbo
-rw-r–r-- 1 root root 1.2K Aug 21 2021 am33xx_pwm-00A0.dtbo

then i cloned this repo and followed the readme GitHub - beagleboard/BeagleBoard-DeviceTrees: mirror of: https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees. sadly it still does not work

root@BeagleBone:/home/debian# ls -lah /sys/class/pwm/
total 0
drwxr-xr-x 2 root root 0 Jun 3 12:31 .
drwxr-xr-x 67 root root 0 Jun 3 12:31 …
root@BeagleBone:/home/debian# config-pin P9.21 pwm
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_21_pinmux/state failed, No such file or directory
root@BeagleBone:/home/debian# config-pin P8.13 pwm
ERROR: open() for /sys/devices/platform/ocp/ocp:P8_13_pinmux/state failed, No such file or directory

As the BB Blue does not have cape headers, I don’t believe you need any overlays, unless you really need to change the pin muxing.

Looking at the Blue dts file the 3 PWM channels are enabled by default.

So have you got a serial interface cable ?
What is the output from u-boot ?

Hi benedict, thanks for you answer. Unfortunately, I dont have a serial interface cable. This is the output from beagle-version.

i switched to the IoT image hoping that this works. but still not :frowning:

root@BeagleBone:/home/debian# beagle-version 
eeprom:[A335BNLTBLA21717EL003259]
model:[TI_AM335x_BeagleBone_Blue]
dogtag:[BeagleBoard.org Debian Bullseye IoT Image 2023-05-03]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2022.04-gd0771d53 (Jul 21 2022 - 02:13:23 +0000)]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblue.dts]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
kernel:[5.10.168-ti-r61]
nodejs:[v12.22.12]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~bullseye+20210821]
pkg:[bb-customizations]:[1.20221108.0-0~bullseye+20221108]
pkg:[bb-usb-gadgets]:[1.20230414.0-0~bullseye+20230414]
pkg:[bb-wl18xx-firmware]:[1.20230414.0-0~bullseye+20230414]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20210315-3]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render bluetooth netdev i2c gpio admin tisdk weston-launch cloud9ide]
cmdline:[console=ttyS0,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
[    4.081636] remoteproc remoteproc0: wkup_m3 is available
[   25.449213] remoteproc remoteproc0: powering up wkup_m3
[   25.449249] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   25.449541] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   30.760594] Bluetooth: hci0: change remote baud rate command in firmware
[   33.865981] remoteproc remoteproc1: 4a334000.pru is available
[   33.894301] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   33.865981] remoteproc remoteproc1: 4a334000.pru is available
[   33.894301] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pinctrl-single
[    3.933509] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
[   36.057047] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[   36.069912] wlcore: WARNING Detected unconfigured mac address in nvs, derive from fuse instead.
[   36.069937] wlcore: WARNING This default nvs file can be removed from the file system
[   36.087002] wlcore: loaded
[   37.173164] wlcore: PHY firmware version: Rev 8.2.0.0.243
[   37.262367] wlcore: firmware booted (Rev 8.9.0.0.83)
[  812.190735] wlcore: Association completed.
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

edit: well, maybe this is the reason

WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]

editedit:
well, now i did the following

git clone https://github.com/beagleboard/librobotcontrol
cd librobocontrol
make
root@BeagleBone:/home/debian/librobotcontrol# make install
PRU Firmware Install Complete
Library Install Complete
Examples Install complete
rc_battery_monitor Service Install Complete
robotcontrol Service Install Complete

sadly beagle-version still says it is missing.

OK at least it is loading the correct dts file at boot.

I assume you are trying to use the pwms for the motor controllers M1-M4 ?

Ok checking the dts file again and maybe you do need to include a pwm overlay. While the module itself is enabled the capture/pwm parts are disabled.

You are not loading any pwm overlays, you need to edit uEnv.txt and add the pwm overlays for them to be loaded.

Also I believe if you want to use the servo connectors you need to have librobotcontrol installed as the signals are generated by the PRU’s

thanks again for your answer.

I assume you are trying to use the pwms for the motor controllers M1-M4 ?

ahm, actually i just need the 8 servo motor outputs.

i edited my last comment regarding the librobotcontrol. maybe i find some docs how i can install it the right way.

edit: nvm, found it https://beagleboard.org/librobotcontrol/installation.html

i will gonna give it a try. thanks a lot. at least now i know what to do and what the problem is :slight_smile:

well, it looks like the librobotcontrol is not available for debian 11. only older kernels are supported. installing kernel 4.14

root@BeagleBone:/home/debian/librobotcontrol/device_tree# uname -a
Linux BeagleBone 4.14.108-ti-r144 #1bullseye SMP PREEMPT Fri Dec 24 00:57:52 UTC 2021 armv7l GNU/Linux

didn’t make it work, too. looks like there is much tinkering to do.

oot@BeagleBone:/home/debian/librobotcontrol/device_tree# ./install_dt_manually.sh 
enter 1 to install for 4.9 kernel
enter 2 to install for 4.14 kernel
anything else to exit
2
cp: target '/opt/source/dtb-4.14-ti/src/arm/' is not a directory
./install_dt_manually.sh: line 24: cd: /opt/source/dtb-4.14-ti: No such file or directory
make: *** No rule to make target 'src/arm/am335x-boneblack-roboticscape.dtb'.  Stop.
make: *** No rule to make target 'src/arm/am335x-boneblack-wireless-roboticscape.dtb'.  Stop.
make: *** No rule to make target 'src/arm/am335x-boneblue.dtb'.  Stop.
make: *** No rule to make target 'src/arm/'.  Stop.
make: *** No rule to make target 'install'.  Stop.
DONE

so i gave debian 10.3 console image a try.

root@beaglebone:~# /opt/scripts/tools/version.sh 
eeprom:[A335BNLTBLA21717EL003259]
model:[TI_AM335x_BeagleBone_Blue]
dogtag:[BeagleBoard.org Debian Buster Console Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblue.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
kernel:[4.19.94-ti-r42]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/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>]
pkg:[bb-cape-overlays]:[4.14.20200403.0-0rcnee0~buster+20200403]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev gpio pwm eqep remoteproc admin spi iio i2c docker tisdk weston-launch xenomai cloud9ide]
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
[   38.117878] remoteproc remoteproc0: wkup_m3 is available
[   38.292105] remoteproc remoteproc0: powering up wkup_m3
[   38.292139] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   38.292427] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   41.020182] remoteproc remoteproc1: 4a334000.pru is available
[   41.045115] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   41.020182] remoteproc remoteproc1: 4a334000.pru is available
[   41.020402] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   41.045115] remoteproc remoteproc2: 4a338000.pru is available
[   41.045304] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.884650] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.090076] pinctrl-single 44e10800.pinmux: pin PIN102 already requested by 48300180.eqep; cannot claim for ocp:P9_30_pinmux
[    1.101476] pinctrl-single 44e10800.pinmux: pin-102 (ocp:P9_30_pinmux) status -22
[    1.109067] pinctrl-single 44e10800.pinmux: could not request pin 102 (PIN102) from group pinmux_P9_30_spi_pin  on device pinctrl-single
dmesg | grep gpio-of-helper
END

the good thing is, on debian 10 it is in the repo, so installable with

apt install librobotcontrol

and here we go

debian@beaglebone:~$ ls -lah /sys/class/pwm
total 0
drwxr-xr-x  2 root root 0 Jun  4 09:27 .
drwxr-xr-x 65 root root 0 Jun  4 09:27 ..
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-0:0 -> ../../devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0/pwm-0:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-1:0 -> ../../devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1/pwm-1:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-1:1 -> ../../devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1/pwm-1:1
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-3:0 -> ../../devices/platform/ocp/48302000.epwmss/48302100.ecap/pwm/pwmchip3/pwm-3:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-4:0 -> ../../devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4/pwm-4:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-4:1 -> ../../devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4/pwm-4:1
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-6:0 -> ../../devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip6/pwm-6:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-7:0 -> ../../devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip7/pwm-7:0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwm-7:1 -> ../../devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip7/pwm-7:1
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip0 -> ../../devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip1 -> ../../devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip3 -> ../../devices/platform/ocp/48302000.epwmss/48302100.ecap/pwm/pwmchip3
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip4 -> ../../devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip6 -> ../../devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip6
lrwxrwxrwx  1 root root 0 Jun  4 09:27 pwmchip7 -> ../../devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip7

thank you benedict for your help. looks like i have to get my project to work under debian 10.

1 Like

Hello @freddy ,

So, w/ Debian Buster (10), librobotcontrol still works and this sounds awesome. I need to get testing.

I have some BBBlue boards that have been shelved due to my lack of understanding ardupilot source and their build instructions.

I am going to try to build the Buster image again or maybe get it via the forums, now that I know how to use the search button on here, to port arducopter or librobotcontrol.

W/ librobotcontrol, have you gotten the build you plan on building to successfully accept the PRU controlled Servo Headers?

And…what, if anything, has gotten in your way? Like, are there any tests that are not working so far?

Seth

P.S. I jumped a while back on librobotcontrol (as I always do) but I would still like to be a learner in this field of flying robotics and maneuvering, four wheeled bots…

Any info. you are willing to part w/ currently may help me and others. So far, I am trying to build w/ the L293D chip w/ the BBB. I know the BBBlue has a drop-in replacement for ideas like this one.

Anyway, any ideas are welcomed.

Hi @silver2row,

So, w/ Debian Buster (10), librobotcontrol still works and this sounds awesome. I need to get testing.

as far as i can tell, yes. At least i managed the servo outputs to work with the shipped c software (rc_test_servos).

I have some BBBlue boards that have been shelved due to my lack of understanding ardupilot source and their build instructions.

yeah, i looked at ardupilot, too and i hardly understood anything. So i decided to make my own software. so far, it works with the rpi and a few i2c boards. but i want to get rid of the rpi and switch to the beaglebone family, and the bb blue specs are perfect. The stuff i made with the rpi runs python, but since librobotcontrol has the best documentation i have ever seen, i try switching to c and i hope i will get something that works :wink:

I am going to try to build the Buster image again or maybe get it via the forums, now that I know how to use the search button on here, to port arducopter or librobotcontrol.

lol, i didnt know that you have to build the image by yourself.

W/ librobotcontrol, have you gotten the build you plan on building to successfully accept the PRU controlled Servo Headers?

looks like. i followed this

cp -r /usr/share/robotcontrol/rc_project_template ~/new_project_name
cd new_project_name

[https://beagleboard.org/librobotcontrol/project_template.html] and then just copied the text from https://beagleboard.org/librobotcontrol/rc_test_servos_8c-example.html to rc_project_template.c. then i run

make
sudo ./rc_project_template -c 2 -p 0.4

and the servo moved. So the Makefile works and i dont change there anything.

And…what, if anything, has gotten in your way? Like, are there any tests that are not working so far?

i didnt test anything so far, but the stuff i made and i dont have any issues.

P.S. I jumped a while back on librobotcontrol (as I always do) but I would still like to be a learner in this field of flying robotics and maneuvering, four wheeled bots…

me too, even at the moment i more more focused on ground vehicles.

Any info. you are willing to part w/ currently may help me and others. So far, I am trying to build w/ the L293D chip w/ the BBB. I know the BBBlue has a drop-in replacement for ideas like this one.

I dont know what the L293D chip is. quick lookup: motor driver. doesnt the BBblue have a burshed dc motor output?

cheers,
freddy

1 Like

Hello,

Thank you. I am glad you replied.

Seth

P.S. I think I was performing too little when the BBBlue was made and the books available were dedicated to BBB or BBBW or Pocket Beagle. Anyway, thank you again.