-
Notifications
You must be signed in to change notification settings - Fork 218
Problems with Adafruit_BBIO.PWM (reference issue #169) #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've tried the image suggested to me, and it DID fix the BoneScript PWM issue. #169 (comment) Python PWM still gives the same error |
@bmcilw1 I have just merged several fixes ( #183 and #184 ) so please install the latest version of Adafruit_BBIO from this repo:
|
@bmcilw1 wrote:
Yes, Python needs to be run as root to control the PWM outputs on kernels older than Linux 4.14 For Linux 4.14 kernel, the PWM paths in /sys are now correctly setup by udev for non-root access. @RobertCNelson has added support for this in c_pwm.c |
@bmcilw1 The Linux 4.14 kernel should resolve the issue of non-root access to the PWM outputs. Please try installing 4.14 kernel build by @RobertCNelson with:
|
Hey...are we using the 4.14.x kernel now? I am trying to stay up-to-date and have each of my "items" working w/ updated ideas and software. Seth |
@silver2row It is not the default yet. However, @RobertCNelson and I have been testing 4.14 kernel and it seems to be working ok. One advantage of 4.14 kernel is that non-root users can now control PWM outputs as udev now assigns correct ownership and permission for relevant /sys files. If you'd like, please give it a try with the instructions above. |
Nope. @pdp7 I've installed the new kernel, but still sudo is required.
Here's the state of my board
|
@bmcilw1 as a quick test just run this ass "debian" user, if you have an led on P9.14 it should blink..
We want to make sure this line:
is root:pwm... |
Haha @RobertCNelson I do believe you have a typo ^^ :) |
Just a few. ;) |
@bmcilw1 @RobertCNelson I believe there is a race condition with udev setting the permissions correctly. I'm adding some debugging output to investigate further. After reboot, the PWM path in
I believe |
@RobertCNelson I've lit up an LED, however it does not noticeably blink. Here's my output. Most noticeably was that 0 was busy...
|
@pdp7 I'm correct in assuming that you can reproduce this issue on your end? |
@bmcilw1 From your output:
It appears that As for the other errors, please check |
Regarding the udev race condition, I had a bash loop logging Initial: |
sleep 100 ms after export to avoid race condition as udev needs the opportunity to set group ownership and permission Test instructions: ================== reboot, log back in, wait for udev to set group ownership and permission: $ ls -la /sys/devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip6/export -rw-rw---- 1 root pwm 4096 Nov 2 04:02 /sys/devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip6/export run test program: python ~/issue185.py contents of test program: import Adafruit_BBIO.PWM as PWM PWM.start("P8_13", 50, 1000, 0) PWM.stop("P8_13") PWM.cleanup()
@bmcilw1 I have pushed commit b65cbf8. Please build and install the |
@bmcilw1 I tested the program from the top of this issue and it does run OK after the fix in b65cbf8 Here is screenshot: https://photos.app.goo.gl/aA9ToTL5cAwgwuw83 |
shortlog of release 1.0.6: Drew Fustini (39): Add -Wno-unit_address_vs_reg to avoid dtc warning check if board is BeagleBone Blue or PocketBeagle check if BeagleBone Blue before accessing non-standard LEDs Add test for GPIO regression #178 change syslog mask level to DEBUG add "Adafruit_BBIO" to syslog() update test for issue #178 remove polarity "hack" for PWM #170 move pwm_set_polarity() after period is set add test for issue #170 only check kernel overlays if u-boot overlays are not being used Attempt to use udev ecap path for pwm path add test script for all BeagleBone PWM outputs update PWM test for 4.14 kernel udev paths minor change to pwm debug logging sleep to avoid udev race condition #185 Mark A. Yoder (1): Added BAT25, BAT50, BAT75, BAT100 and WIFI LEDs Peter Lawler (1): Missing CR/LF Robert Nelson (10): source/common.c: add initial PocketBeagle values source/common.c: PocketBeagle, no slots file, everything built-in source/common.c: PocketBeagle, no slots file disable here too source/c_pwm.c: HACK: U-Boot pre-setup everything, dont search for specific overlay source/c_pwm.c: HACK: PocketBeagle: v4.14.x source/c_pwm.c: debug pwm_path/pwm_path_udev source/c_pwm.c: pwm: add support for pwmchipX/pwm-X:Y syntax source/c_pwm.c: disable pwm_set_polarity (broken in v4.9.x/v4.14.x) source/common.c: Blue Fix GP0_3 id source/common.c: PocketBeagle Fix P2.24
@bmcilw1 I've published release 1.0.6 which should resolve this issue when using the Debian Stretch image with the 4.14.x kernel. |
@bmcilw1 have you had a chance to try release 1.0.6? It should resolve this issue when using the Debian Stretch image with the 4.14.x kernel. |
@bmcilw1 please re-open if you are still having this issue |
I've had severe problems with PWM on my BBB. I've just re-flashed my board with the latest image, then ran apt-get update. My python code gets the same output stated above. Here's the code:
The output is
I next tried to test PWM using the BoneScript library with the following code. The first time I run the BoneScript version, it does work. However, if I re-run the code with no change or by changing frequency, duty cycle, or port PWM does not output again, and the running PWM stops. It does not work again until I restart the board. UPDATE - It will output again after I run the pin PWM config given above (and pasted below)
I've been reading through this thread and to help out here's additional stuff I've run.
Next, I ran the suggested code above. I found that this will restore PWM to the bonescript code, but I still get the same
Problem with a sysfs file
error from the Python code.The text was updated successfully, but these errors were encountered: