Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ All changes: https://github.com/Pi4J/pi4j/compare/2.6.0...2.6.1

* New hardware PWM provider added to the GpioD plugin, see:
* [Blog: PWM Hardware Support on RPi5](https://pi4j.com/blog/2024/20240423_pwm_rpi5/).
* [Documentation: I/O Examples: Pulse Width Modulation (PWM)](https://pi4j.com/documentation/io-examples/pwm/).
* [Documentation: I/O Examples: Pulse Width Modulation (PWM)](https://pi4j.com/documentation/io-types/pwm/).
* Various improvements in the I2C implementation in both core and plugins, see:
* [Blog: Ongoing I2C Improvements](https://pi4j.com/blog/2024/20240418_i2c_improvements/).
* Dependency bumps in the pom file, see [pull request #337](https://github.com/Pi4J/pi4j/pull/337).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: 1-Wire
weight: 270
tags: ["1-Wire"]
aliases:
- /documentation/io-examples/1-wire/
---

## What is it?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: I/O Examples
title: I/O Types
weight: 120
aliases:
- /documentation/io-examples
---

Here you can find detailed examples for the different functionalities of Pi4J per I/O type.
Here you can find detailed info and examples for the different functionalities of Pi4J per I/O type.

{{% children %}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Digital Input (GPIO)
weight: 210
tags: ["Digital Input"]
aliases:
- /documentation/io-examples/digital-input/
---

Similar to a digital output pin, a digital input translates an input value of 0V or 3.3V to the value false/true. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Digital Output (GPIO)
weight: 200
tags: ["Digital Output"]
aliases:
- /documentation/io-examples/digital-output/
---

A digital output translates a false/true (or 0/1) to an output value of 0V or 3.3V. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Inter-Integrated Circuit (I²C)
weight: 230
tags: ["I2C"]
aliases:
- /documentation/io-examples/i2c/
---

## What is it?
Expand Down Expand Up @@ -64,6 +66,52 @@ root@rp5:~# i2cdetect -y 1
```
1 device found with address of 0x3f.

## Checking I2C Configuration

You can check the I2C configuration of your Raspberry Pi with the following command, using [JBang](/prepare/install-java/#install-sdkman-maven-and-jbang) and a checker tool available in the [GitHub Pi4J OS repository](https://github.com/pi4J/pi4j-os). One or more checks are performed depending on the IO type checked by the tool. You will get a result like this, indicating if the check passed or failed, with more info about the expected and found result:

```shell
$ jbang https://github.com/pi4j/pi4j-os/blob/main/iochecks/IOChecker.java i2c

Results from I2C Detection

Configuration check for I2C in config.txt
Status: PASS
Expected:
dtparam=i2c_arm=on
Result:
Found in /boot/firmware/config.txt: dtparam=i2c_arm=on

Search for I2C in /proc/device-tree
Status: PASS
Expected:
i2c device-tree entries with status=okay
Result:
✗ i2c@7d005600 (status: disabled)
✓ i2c@7d508200 (status: okay)
✓ i2c@7d508280 (status: okay)
✗ i2c3_m4_agpio0_pins (status: unknown)

i2cdetect -l
Status: PASS
Expected:
One or more devices, e.g. 'i2c-1' (I2C bus adapters detected by 'i2cdetect -l')
Result:
1: Synopsys, DesignWare I2C adapter I2C adapter
13: 107d508200.i2c, I2C adapter
14: 107d508280.i2c, I2C adapter

i2cdetect -y 1
Status: PASS
Expected:
One or more I2C used addresses detected on bus 1
Result:
Found 3 used addres(ses) on bus 1: 0x21, 0x5C, 0x70

i2cdetect -y 13
... # Truncated for brevity
```

## Transfer rates

| Mode | Max. transfer rate | Direction |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: I²C Clock Stretching
weight: 231
tags: ["I2C"]
aliases:
- /documentation/io-examples/i2c/clock-stretching/
---

## Clock Stretching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Pulse Width Modulation (PWM)
weight: 220
tags: ["PWM", "CrowPi"]
aliases:
- /documentation/io-examples/pwm/
---

## What is it?
Expand Down Expand Up @@ -69,6 +71,38 @@ If you need more than 2 PWM pins, use the software PWM functionality, it may be
fine for your application. If they are not good enough, then you will probably need a
PWM expander board/chip (controlled by I2C/SPI) to provide additional PWM support.

## Checking PWM Configuration

You can check the PWM configuration of your Raspberry Pi with the following command, using [JBang](/prepare/install-java/#install-sdkman-maven-and-jbang) and a checker tool available in the [GitHub Pi4J OS repository](https://github.com/pi4J/pi4j-os). One or more checks are performed depending on the IO type checked by the tool. You will get a result like this, indicating if the check passed or failed, with more info about the expected and found result:

```shell
$ jbang https://github.com/pi4j/pi4j-os/blob/main/iochecks/IOChecker.java pwm

Results from PWM Detection

Configuration check for PWM in config.txt
Status: PASS
Expected:
dtoverlay=pwm (or dtoverlay=pwm-2chan for 2-channel PWM)
Result:
Found in /boot/firmware/config.txt: dtoverlay=pwm-2chan

ls -l /sys/class/pwm/
Status: PASS
Expected:
One or more pwmchipX (X = number)
Result:
pwmchip0

pinctrl | grep PWM
Status: PASS
Expected:
GPIO line(s) with PWM function (e.g., GPIO18 = PWM0_CHAN2)
Result:
18: a3 pd | lo // GPIO18 = PWM0_CHAN2
19: a3 pd | lo // GPIO19 = PWM0_CHAN3
45: op dh pd | hi // FAN_PWM/GPIO45 = output
```

## Linuxfs Provider (linuxfs-pwm)

Expand Down Expand Up @@ -198,7 +232,6 @@ a component to control a buzzer with PWM.
Of importance, this example executes on a Raspberry Pi4, the buildPwmConfig(Context pi4j, int address) example
code uses pigpio-pwm and the value passed for 'address' is the BCM pin number.


```java
public class BuzzerComponent extends Component {

Expand Down Expand Up @@ -312,6 +345,5 @@ public class BuzzerComponent extends Component {
.shutdown(0)
.build();
}

}
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Serial (UART/RS232)
weight: 250
tags: ["Serial"]
aliases:
- /documentation/io-examples/serial/
---

{{% notice warning %}}
Expand Down Expand Up @@ -69,6 +71,33 @@ See Pi command `raspi-gpio funcs`.
At the present time the PiGpio library supports only Parity *None* on any/all uarts. Any future additional UART
functionality within the PiGpio library will require changes within the Pi4J code base.

## Checking Serial Configuration

You can check the Serial configuration of your Raspberry Pi with the following command, using [JBang](/prepare/install-java/#install-sdkman-maven-and-jbang) and a checker tool available in the [GitHub Pi4J OS repository](https://github.com/pi4J/pi4j-os). One or more checks are performed depending on the IO type checked by the tool. You will get a result like this, indicating if the check passed or failed, with more info about the expected and found result:

```shell
$ jbang https://github.com/pi4j/pi4j-os/blob/main/iochecks/IOChecker.java serial
[jbang] Building jar for IOChecker.java...
Results from Serial Detection

Configuration check for UART in config.txt
Status: PASS
Expected:
dtparam=uart0=on
Result:
Found in /boot/firmware/config.txt: dtparam=uart0=on

Checking serial device availability
Status: PASS
Expected:
/dev/ttyS0 exists (readable, writable)
Result:
/dev/ttyS0 not available
/dev/ttyAMA0 exists (readable, writable)
/dev/ttyUSB0 exists (readable, writable)
/dev/ttyACM0 not available
```

## Code example

The following example demonstrates how you can connect to a GPS module to read the data. This example is based on an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Serial Peripheral Interface (SPI)
weight: 240
tags: ["SPI", "MAX7219"]
aliases:
- /documentation/io-examples/spi/
---

## What is it?
Expand Down Expand Up @@ -64,6 +66,40 @@ There is one interface that can be accessed in two ways:
/dev/spidev0.1 drives CE1 Low
```

## Checking SPI Configuration

You can check the SPI configuration of your Raspberry Pi with the following command, using [JBang](/prepare/install-java/#install-sdkman-maven-and-jbang) and a checker tool available in the [GitHub Pi4J OS repository](https://github.com/pi4J/pi4j-os). One or more checks are performed depending on the IO type checked by the tool. You will get a result like this, indicating if the check passed or failed, with more info about the expected and found result:

```shell
$ jbang https://github.com/pi4j/pi4j-os/blob/main/iochecks/IOChecker.java spi

Results from SPI Detection

Configuration check for SPI in config.txt
Status: PASS
Expected:
dtparam=spi=on
Result:
Found in /boot/firmware/config.txt: dtparam=spi=on

Search for SPI in /proc/device-tree
Status: PASS
Expected:
spi device-tree entries with status=okay
Result:
✗ spi10_cs_gpio1 (status: unknown)
✗ spi10_gpio2 (status: unknown)
✓ spi@7d004000 (status: okay)
✓ spidev@0 (status: okay)

ls -l /sys/bus/spi/devices
Status: PASS
Expected:
One or more spiX.Y (X and Y = numbers)
Result:
spi0.0 spi0.1 spi10.0
```

## Additional Information

- [Wikipedia SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface)
Expand Down
2 changes: 1 addition & 1 deletion content/documentation/providers/linuxfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ To use PWM with the LinuxFS provider, it's important to understand the config bu

For instance, on a Raspberry Pi 5 with the `dtoverlay=pwm-2chan` setting in `config.txt`, a PWM connection on BCM 19 must be configured as `channel=3`.

See the [Pulse Width Modulation (PWM)](/documentation/io-examples/pwm/#linuxfs-provider-linuxfs-pwm) page on how to configure hardware PWM and which channels are available per board.
See the [Pulse Width Modulation (PWM)](/documentation/io-types/pwm/#linuxfs-provider-linuxfs-pwm) page on how to configure hardware PWM and which channels are available per board.

Example on how to use PWM with LinuxFS:

Expand Down
Loading