I'm trying to enable PWM and some GPIOs on the Beaglebone and I'm running into various problems.
Originally I tried to start PWM using the /sys/class/pwm/pwmchip1/export interface, but ran into a bunch of race conditions. I then tried using the Adafruit_BBIO.PWM library, which works around most of the race conditions (but still sometimes fails nonrepeatably). (I also tried writing the PWM registers directly, but there are a lot of them and I couldn't find documentation on which ones are needed, so I figure I'm better off using the device drivers.)
But the Adafruit_BBIO library depends on using cape_universal, which configures some pins in ways that conflict with what I want in my dts file.
So my questions are:
a) Is there a simple, reliable way of enabling PWM?
b) Is there a way of overriding some cape_universal pin assignments? Or getting cape_universal to assign them the way I want? Or configuring the ocp:Px_xx_pinmux/state files that the Adafruit library needs without using cape_universal?
I can post my dts files and so forth, but I suspect that I need to change my approach entirely.
Thanks,
Ken
P.S. By "race conditions", I mean that if I write to /sys/class/pwm/pwmchip1/export, and then try to write to /sys/class/pwm/pwm-1:0, sometimes the latter file isn't there and I need to wait. But even sleeping a bit isn't always enough. The Adafruit library has
code to deal with this as well as various other situations, but even that code fails randomly about 20% of the time.