OK, 3 of 4 PWM pins are working, but still no luck with P8_13. I can see that Adafruit_BBIO is writing values into /sys/class/pwm/pwm-7:1/duty_cycle but no output is being generated.
debian@beaglebone:/sys/class/pwm/pwm-7:1$ cat duty_cycle 200000 debian@beaglebone:/sys/class/pwm/pwm-7:1$ cat period 500000 Pin 8_13 can still be used for GPIO. I have not dug further into the device files. Does this seem like a hardware or software issue? Should I reinstall the base image, accept that the board is flaky, or is there some other possible solution? Also, the PWM frequency is fixed at 2000 Hz (period = 500000 ns). Is this intended? I can work with 2000, so this is more out of curiosity. Python returns the following errors: >>> PWM.start(pin3,50,1000) Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: Problem with a sysfs file >>> PWM.set_frequency(pin3,1000) Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: Could not write to the frequency file Attempting to write into the period file directly returns the following: debian@beaglebone:/sys/class/pwm/pwm-7:1$ sudo echo 400000 > period [sudo] password for debian: echo: write error: Invalid argument The arguments 2000 (from Python) and 500000 (echo) are accepted without no error. Any other values are not accepted. Thanks again, -Steve > On Jan 15, 2021, at 9:33 AM, randy cooper <[email protected]> wrote: > > P8_13 is working for me as a PWM output, and I am using the Adafruit BBIO > library. I’m using the latest image with LXQT (Debian 9.9 I believe). > Randy > > On Thursday, January 14, 2021 at 8:28:34 PM UTC-6 [email protected] wrote: > OK, I rechecked and only Pin 8_13 is not working; the other three PWM pins > are good using Adafruit.PWM. Pin 8_13 does respond to GPIO.HIGH and > GPIO.LOW, so I don’t think I’ve damaged the hardware. Who knows what I have > managed to do to the /sys/class files. If it doesn’t clear up on restart, I > will reinstall the image. Of course 8_13 is the one I was planning to use, > but I can just as well wire something to 8_19 for now. > > Thanks for the help. > > -Steve > > >> On Jan 14, 2021, at 8:00 PM, jonnymo <[email protected]> wrote: >> >> The SpreadSheet at the following link will show you which pins on the BB >> Black can be set for PWM. >> >> https://docs.google.com/spreadsheets/d/1fE-AsDZvJ-bBwzNBj1_sPDrutvEvsmARqFwvbw_HkrE/edit#gid=1518010293 >> >> As far as the Adafruit BBIO libs, have you gone through the example at the >> Adafruit site? >> https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/pwm >> >> If this is not working, could you provide any errors or output of the issue >> you are seeing? >> >> The output of the following might be helpful: >> /opt/scripts/tools/version.sh >> >> Cheers, >> >> Jon >> >> >> On Thu, Jan 14, 2021 at 4:42 PM Steve Lentz <[email protected]> wrote: >> Black. BeagleBoard.org Debian Buster IoT Image 2020-04-06. >> >> FWIW, the Adafruit libraries let me control the pins as GPIO. >> >> >> TY, >> -Steve >> >>> On Jan 14, 2021, at 7:02 PM, jonnymo <[email protected]> wrote: >>> >>> Which BeagleBoard are you using? >>> >>> Jon >>> >>> On Thu, Jan 14, 2021 at 2:51 PM [email protected] <[email protected]> wrote: >>> OK, I want to generate a PWM signal to send to a motor controller. This is >>> simply to communicate the desired speed, the motor controller will do all >>> the heavy lifting. >>> >>> Unfortunately, the Adafruit_BBIO libraries appear broken and bonescript >>> doesn't seem any better. >>> >>> After digging through Google results I found myself in /sys/class/pwm/ >>> using echo to write values into various files and through pure dumb luck >>> was able to get a 2 Khz square wave up on a scope and change its duty >>> cycle. So at least my set up seems to be working at some level. >>> >>> However, I feel I am missing a bunch of information. Which pwmchip exports >>> to which pwm-X:X and corresponds to which pin? "duty_cycle" is not really >>> duty cycle, it is nanoseconds high. I can't change the period, even to >>> sensible values like 250000 or 1000000. Some of the information on Stack >>> Exchange is worrying, will pwm-4:0 always correspond to P9_14 or can this >>> change on boot? >>> >>> Is there a way to restore the functionality of the Adafruit BBIO libraries, >>> short of waiting for an update? I did pip3 install -U. Requirement >>> already satisfied: Adafruit_BBIO in /usr/local/lib/python3.7/dist-packages >>> (1.2.0) >>> >>> If that's not possible, is there any documentation on how the >>> /sys/class/pwm is intended to function? >>> >>> Thank you, >>> -Steve Lentz >>> >>> -- >>> 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/08130fba-0f75-464a-9041-d66a1c3a8cacn%40googlegroups.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/CAG99bkoUYXmrUU%2BwtoQnXTYAd3Uq6SAXsTFskbZ-75%2ByvAX3eQ%40mail.gmail.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/44AF4518-7FEA-4331-9E61-5D442D484D20%40gmail.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/CAG99bkr3Uo18Mx57p-m2ec2bfi0A%2BKjYMJYNb-bd5sMfKNpRzg%40mail.gmail.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/8d4b5048-1469-4557-bafa-1c8680aa39b1n%40googlegroups.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/FC8E1B51-54FF-4416-9F6C-F407A0E89022%40gmail.com.
