-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Pi5 HW PWM not working #154
Comments
Hi @johansmitsnl. Getting a Permission Denied error from |
Hi @golemparts. the user is part of the group:
I noticed with the current udev rules the permissions are wrong:
But when I chown them with
But even when I use |
I had some time to look into the hardware PWM code some more. My earlier mention of the creation of I checked the permissions on my Pi 5, which are different from yours:
I don't actually recall having to edit |
Without the udev rules the permissions are not of the GPIO group:
I don't run as root but as a normal user so this can't work since the permission is I changes the udev rule to this:
This makes sure the permission is correct on the export path. But this is also not sufficient due to permission lacking write permission on the new created
By manually adding
|
If this is happening with a fresh install of a recent Raspberry Pi OS release, I think at this point it's better if you ask about this on the official Raspberry Pi forum, as this does not appear to be an RPPAL issue but a linux one, and I'm not familiar enough with how best to solve permission issues like this. I'd appreciate it if you can let me know when you've found a solution, as it may be useful to people who run into the same problem. |
Yes this is a fresh install of 1 week ago. I'll let you know the outcome but I'm on holiday for the next 3 weeks so it might take some time for me to reply. |
Created a question on the pi forum |
No response on the forum but I did a reinstall on the pi. Now the permissions are the same as yours but I have an issue with the Now my output of the directory is like this:
Full firmware config: # /boot/firmware/config.txt
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Additional overlays and parameters are documented
# /boot/firmware/overlays/README
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Automatically load initramfs files, if found
auto_initramfs=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1
# Run in 64-bit mode
arm_64bit=1
# Disable compensation for displays with overscan
disable_overscan=1
# Run as fast as firmware / board allows
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[cm5]
dtoverlay=dwc2,dr_mode=host
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
[all] Maybe a suggestion where to look as all permissions seem correct? |
Glad to hear a fresh install fixed the initial problem. I'm not sure what would cause an issue with PWM1 when PWM0 is working. Your configuration looks correct. What error are you getting? |
The code I use is: let servo_2 = Pwm::with_period(
Channel::Pwm1,
Duration::from_millis(SERVO_PWM_PERIOD_MS),
Duration::from_micros(SERVO_PWM_PULSE_MAX_US),
Polarity::Normal,
true,
)
.expect("Should be able to connect to PWM 2 pin"); And the error running the code:
|
@golemparts do you have ideas what can cause this or where you able to test/verify it on a pi5? |
I haven't had a chance to test this myself, but if the error message is accurate, I would suspect some other process is using that PWM channel. Another possibility is RPPAL is trying to access the wrong PWM channel, but I would expect a Permission denied error in that case. On the Pi 5, RPPAL will use I should have some time this upcoming weekend to test the second PWM channel myself and see if I get the same error. |
@golemparts thanks for the feedback and your time to test. How can I check it on the command line? |
Check out this answer for some example command line commands. You'll want to use |
@johansmitsnl I just ran some tests on my Pi 5, and both PWM channels worked fine. However, while recreating your setup I did notice an issue in your |
Closing this due to inactivity. If you're still encountering this issue and the above-mentioned didn't resolve it, please let me know. |
An issue was discovered specifically related to PWM on GPIO12/13 on a Pi 5, which was fixed in release 0.22.0. If you're still encountering this issue, try that release. |
I did some testing but could not get it to work so I didn't provide a update of nothing to report. But with the Thanks for the effort! |
I'm on version
0.19.0
and this includes the commit 6bbc5ef.This code works on a Pi4 but on my Pi5 I'm getting errors and don't know why.
I have set
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
in the config. Also with the permission udev rules:WHen I wanto to initialize the PWM pin:
When check the output of
DeviceInfo
It does read correctly:I'm getting the error
Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })
.What am I'm missing here or is there still a bug somewhere?
The text was updated successfully, but these errors were encountered: