Cape Manager Problem when using Adafruit_BBIO.PWM - Pocketbeagle

Peace!

I’m attempting use the PWM output from a Pocketbeagle. My test code is below:

`

pwm test script

import Adafruit_BBIO.PWM as PWM

out = “P1_36”

PWM.start(out, 0,frequency=50)

while(1):
PWM.set_duty_cycle(out, 100)
`

However, upon running this code, I get the following error message:

Traceback (most recent call last): File "/var/lib/cloud9/pwm_test.py", line 6, in <module> PWM.start(out, 0,frequency=50) RuntimeError: Problem with the cape manager

I already looked at https://github.com/adafruit/adafruit-beaglebone-io-python/issues/262, which did not work for me, and https://github.com/adafruit/adafruit-beaglebone-io-python/issues/286, which I couldn’t implement because I’m having difficulties connecting the Pocketbeagle to the internet.

Any help would be appreciated. I also ran /opt/scripts/tools/version.sh, the output of which is below.

`
debian@beaglebone:/var/lib/cloud9$ sudo /opt/scripts/tools/version.sh

git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335PBGL00A21741GPB42758]
model:[TI_AM335x_PocketBeagle]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[microSD]:[/dev/mmcblk0]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-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.4.20180928.0-0rcnee0~stretch+20180928]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.103354] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.111563] gpio-of-helper ocp:cape-universal: ready
END
`

On Mon, 26 Aug 2019 10:57:36 -0700 (PDT), Marius Strom
<brmariustor@gmail.com> declaimed the
following:

# pwm test script
import Adafruit_BBIO.PWM as PWM

out = "P1_36"

PWM.start(out, 0,frequency=50)

while(1):
   PWM.set_duty_cycle(out, 100)

However, upon running this code, I get the following error message:

  NOTE: even ignoring the error problem the above code is rather, uhm,
futile...

  You start with the PWM set to full OFF, then, in a fast running loop
you repeatedly set it to full ON. You'd get the same result setting the pin
to GPIO mode:

GPIO.setup(out, GPIO.OUT)
GPIO.output(out, GPIO.LOW)
while True:
  GPIO.output(out, GPIO.HIGH)

  Additionally,

    while(1):

appears to be a C-ism, the Pythonic/preferred form is

    while True:

and as you can see, you likely wont notice anything on the output pin --
the program sets up the pin at 0 and immediately sets it to 1, 1, 1, 1, 1.

Traceback (most recent call last):
File "/var/lib/cloud9/pwm_test.py", line 6, in <module>
   PWM.start(out, 0,frequency=50)
RuntimeError: Problem with the cape manager

  Have you attempted to set the pin from the command line using the
config-pin utility? (See the readme at
GitHub - adafruit/adafruit-beaglebone-io-python: Adafruit's BeagleBone IO Python Library ). If that fails
you may need to update the OS device trees etc. since adafruit internally
uses that to set the pin modes. Otherwise, an update of the adafruit
libraries might be needed (there was a PocketBeagle PWM fix in 1.1.0 "fix
pwm on pocketbeagle and beaglebone blue #286" . OR a bug report filed with
AdaFruit.

I already looked at
Usage of PWM fails with "Problem with the cape manager" · Issue #262 · adafruit/adafruit-beaglebone-io-python · GitHub, which
did not work for me, and
PWM Fails on PocketBeagle - "RuntimeError: Problem with the cape manager" · Issue #286 · adafruit/adafruit-beaglebone-io-python · GitHub, which
I couldn't implement because I'm having difficulties connecting the
Pocketbeagle to the internet.

  Okay -- so you have seen the report of the problem, and the solution...

  Unfortunately -- since all potential solutions tend to require updates
you'll have to figure out some way to get internet access (I would not
recommend trying to hand install the Adafruit libraries).

  Or /maybe/ download and flash a new SD card with either

http://debian.beagleboard.org/images/bone-debian-9.9-iot-armhf-2019-08-03-4gb.img.xz

or

http://debian.beagleboard.org/images/bone-debian-9.9-lxqt-armhf-2019-08-03-4gb.img.xz

and hope that those images include the Adafruit updates. (I'll admit, I'm
still running the 2018-10-07 images myself, on a BBB, but I have no
problems running apt-get and pip to install patches).

Found a solution – turns out that I already have the dependencies satisfied, so the update to Adafruit_BBIO is relatively painless to install without the internet. Thanks, though!