File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
documentation/io-examples Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title: "Pi5 PWM Fails with NoSuchFileException"
3
+ date: 2025-08-11
4
+ tags: ["PWM", "LinuxFS"]
5
+ ---
6
+
7
+ 2025-08-11, by Tom Aarts
8
+
9
+ On the Pi5, Pi kernel updates result in the PWM failing. The
10
+ exception details will state /sys/class/pwm/pwmchip2/npwm was not found.
11
+
12
+ A kernel code update (6.12) resulted in the objects within /sys/class/pwm
13
+ being numbered differently. It is most likely the PWM is using
14
+ /sys/class/pwm/pwmchip0.
15
+
16
+ Until a proper fix is available the following change to your application
17
+ should resolve this error.
18
+
19
+ ```
20
+
21
+ Added imports
22
+ import com.pi4j.plugin.linuxfs.provider.pwm.LinuxFsPwmProvider;
23
+ import com.pi4j.plugin.linuxfs.provider.pwm.LinuxFsPwmProviderImpl;
24
+
25
+ Replace newAutoContext
26
+ // Context pi4j = Pi4J.newAutoContext();
27
+
28
+ Context pi4j = Pi4J.newContextBuilder()
29
+ .add(new LinuxFsPwmProviderImpl("/sys/class/pwm/",0) )
30
+ .build();
31
+
32
+ ```
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ These two values can be controlled via the Pi4J library and are also used intern
173
173
- [ Choosing an I/O Provider] ( ../providers/_index.md )
174
174
- [ Wikipedia on PWM] ( https://en.wikipedia.org/wiki/Pulse-width_modulation )
175
175
- [ Wikipedia with audio frequencies] ( https://en.wikipedia.org/wiki/Piano_key_frequencies )
176
+ - [ Possible exception] ( ../../blog/2025/20250811-Pi5-PWM-not-working--NoSuchFileException )
176
177
177
178
### Code example
178
179
You can’t perform that action at this time.
0 commit comments