On Tue, Jan 1, 2019 at 7:02 PM Ken Shirriff <[email protected]> wrote: > > 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.
There was a recent change in the "bb-customizations" package to change the udev rule to automatically export the channels on bootup: https://github.com/rcn-ee/repos/commit/5e66a1f215c41157072b989f03004b661f50ab40 Might be something useful in that to borrow. ;) Regards, -- Robert Nelson https://rcn-ee.com/ -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAOCHtYi6-O8Zxdex2mu0gBbd_0qG1W%2BGqPg5BmD26cmGb6SvXg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
