-
Notifications
You must be signed in to change notification settings - Fork 65
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
Exception using PWM #445
Comments
@DieterHolz I set up my Pi5 using your Pi5 branch. I can go to the Application package BuzzerApp and run your app. As I don't have a buzzer just watching a connected LED and I see the program functions. This is working ok. Is there a different manner I should us to run the application ? |
@taartspi I've just added dtoverlay=pwm-2chan to the config.txt. Is there anything else to do? |
pi@rasp5Dev:/sys/class/pwm/pwmchip2 $ ls Of significance, the channel has been enabled, so pwm.off() can function. This is my bug. If the first thing attempted is off, I do not enable channel. So, while I fix this, If your team wants to make progress on this test, in the Buzzer class, after creating the configBuilder, comment out the off(). I am busy much of Monday and Tuesday and may find it difficult to fix this that soon. Tom... So the other night when I could not duplicate you error, I first used a pwm tests of my own and it enabled the channel, so than your tests would function for me. |
Take your time. Avoiding an initial pwm.off() is an easy, good enough workaround. |
The bug Dieter hit is specific to my provider so this case in pigpio needs separate attention |
@taartspi thanks, deleted, will make separate ticket |
I tried to get the PWM example "BuzzerApp" from "pi4j-example-components" working according to blogpost https://www.pi4j.com/blog/2024/20240423_pwm_rpi5/
Code is on branch "Pi5"
As far as I remember it worked sometimes, but now it throws this exception when calling pwm.off().
The rest seems to work (the buzzer makes the expected noise)
[main] ERROR com.pi4j.plugin.linuxfs.provider.pwm.LinuxFsPwm - Invalid argument
java.io.IOException: Invalid argument
at java.base/sun.nio.ch.UnixFileDispatcherImpl.write0(Native Method)
at java.base/sun.nio.ch.UnixFileDispatcherImpl.write(UnixFileDispatcherImpl.java:65)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:137)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:102)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:72)
at java.base/sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:300)
at java.base/sun.nio.ch.ChannelOutputStream.writeFully(ChannelOutputStream.java:68)
at java.base/sun.nio.ch.ChannelOutputStream.write(ChannelOutputStream.java:105)
at java.base/java.nio.file.Files.write(Files.java:3510)
at java.base/java.nio.file.Files.writeString(Files.java:3727)
at java.base/java.nio.file.Files.writeString(Files.java:3667)
at com.pi4j.plugin.linuxfs.internal.LinuxPwm.setEnabled(LinuxPwm.java:244)
at com.pi4j.plugin.linuxfs.internal.LinuxPwm.disable(LinuxPwm.java:221)
at com.pi4j.plugin.linuxfs.provider.pwm.LinuxFsPwm.off(LinuxFsPwm.java:161)
at com.pi4j.catalog.components.Buzzer.off(Buzzer.java:77)
at com.pi4j.catalog.components.Buzzer.(Buzzer.java:44)
at com.pi4j.catalog.applications.BuzzerApp.main(BuzzerApp.java:56)
Exception in thread “main” com.pi4j.io.exception.IOException: Unable to disable (OFF) PWM [2] @ </sys/class/pwm/pwmchip2/pwm2>; Invalid argument
at com.pi4j.plugin.linuxfs.provider.pwm.LinuxFsPwm.off(LinuxFsPwm.java:168)
at com.pi4j.catalog.components.Buzzer.off(Buzzer.java:77)
at com.pi4j.catalog.components.Buzzer.(Buzzer.java:44)
at com.pi4j.catalog.applications.BuzzerApp.main(BuzzerApp.java:56)
pi4j.com
PWM Hardware Support on RPi5 - Pi4J
Java IO Library for the Raspberry Pi
5:11
The text was updated successfully, but these errors were encountered: