Skip to content

Commit 4d1dbdb

Browse files
authored
Merge pull request #84 from Pi4J/PWM_chip2
web pages update to alert users to PWM exception after kernel update
2 parents 5c6b88e + 28f09a1 commit 4d1dbdb

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
```

content/documentation/io-examples/pwm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ These two values can be controlled via the Pi4J library and are also used intern
173173
- [Choosing an I/O Provider](../providers/_index.md)
174174
- [Wikipedia on PWM](https://en.wikipedia.org/wiki/Pulse-width_modulation)
175175
- [Wikipedia with audio frequencies](https://en.wikipedia.org/wiki/Piano_key_frequencies)
176+
- [Possible exception](../../blog/2025/20250811-Pi5-PWM-not-working--NoSuchFileException)
176177

177178
### Code example
178179

0 commit comments

Comments
 (0)