OAK4 SoM Development Guide
Luxonis OAK 4 SoM device supports flexible peripheral configuration, allowing users to enable or disable I2C, SPI, and UART functionality on a variety of pins.By default, most pins are configured as general-purpose I/O (GPIO). However, users can reconfigure supported pins to function as peripheral interfaces. It's important to note that not all pins support all peripherals. The table below outlines which QUPv3 and I2CHUB engines are available and how each can be configured.If your use case requires a configuration not listed in the table or if the pins are marked as "Not currently exposed", please contact Luxonis technical support to help with creating a custom configuration with different exposed options.QUPv3 engine | Mode | Pins | Note |
QUPv3_SE0 | I2C |
| |
QUPv3_SE1 | SPI |
| |
QUPv3_SE2 | SPI |
| |
QUPv3_SE3 | / | / | Not currently exposed |
QUPv3_SE4 | I2C |
| Enabled by default |
QUPv3_SE5 | I2C |
| |
QUPv3_SE6 | / | / | Not currently exposed |
QUPv3_SE7 | UART |
| |
QUPv3_SE8 | I2C |
| |
QUPv3_SE9 | I3C |
| |
QUPv3_SE10 | SPI |
| |
QUPv3_SE11 | SPI |
| |
QUPv3_SE12 | I2C |
| Enabled by default |
QUPv3_SE13 | / | / | Not currently exposed |
QUPv3_SE14 | UART |
| High-speed UART, hardware flow control |
QUPv3_SE15 | / | / | Not currently exposed |
I2CHUB_SE0 | / | / | Not currently exposed |
I2CHUB_SE1 | / | / | Not currently exposed |
I2CHUB_SE2 | I2C |
| Enabled by default |
I2CHUB_SE3 | I2C |
| |
I2CHUB_SE4 | I2C |
| |
I2CHUB_SE5 | / | / | Not currently exposed |
I2CHUB_SE6 | / | / | Not currently exposed |
I2CHUB_SE7 | / | / | Not currently exposed |
I2CHUB_SE8 | / | / | Not currently exposed |
I2CHUB_SE9 | / | / | Not currently exposed |
Device Tree Overlay Configuration
Peripheral configuration is achieved through Device Tree Overlays (DTOs), which are applied at boot time. Overlays must be placed in the/persist/custom/dtbo
directory on the device. During boot, the system applies all overlays found in this directory to achieve the desired pin configuration. Files in this folder also survive OTA update and do not get deleted.I2C Configuration Example
Connecting a BME280 Sensor via I2C
Suppose you want to connect a Bosch BME280 pressure sensor using GPIO52 (SDA) and GPIO53 (SCL). According to the table above, these pins are managed by the QUPv3 SE5 engine.To enable this interface, create a device tree overlay (e.g.bme280.dts
) in your working directory:Dts
1/dts-v1/;
2/plugin/;
3
4/ {
5 fragment@0 {
6 target = <&qupv3_se5_i2c>;
7 __overlay__ {
8 status = "ok";
9 #address-cells = <1>;
10 #size-cells = <0>;
11
12 bme280@76 {
13 compatible = "bosch,bme280";
14 reg = <0x76>;
15 };
16 };
17 };
18};
status = "ok";
which actually enables the selected I2C engine. Without it, the peripheral remains disabled.Note: Fortarget
, use&qupv3_seX_i2c
for QUP engines, and&qupv3_hub_i2cX
for HUB engines, whereX
is the engine index.
Compiling the Overlay
Use the SDK Docker container to compile the source. Run the following inside your working directory:Command Line
1docker run --rm \
2 -v /etc/passwd:/etc/passwd:ro \
3 -v /etc/shadow:/etc/shadow:ro \
4 -v "$PWD":"$PWD" \
5 -w "$PWD" \
6 --user=$(id -u):$(id -g) --group-add 27 \
7 luxonis/luxonis-os-rvc4:<SDK_version>-public \
8 /bin/bash -c "dtc -@ -I dts -O dtb -o bme280.dtbo bme280.dts"
Note:Transfer the compiled<SDK_version>
must match the version of OS with which the target device was flashed (eg.1.8.0
). You can also uselatest
if you are using the latest OS release.
.dtbo
file to the target device:Command Line
1scp /app/test-overlay/bme280.dtbo user@<device-ip>:/persist/custom/dtbo/
/sys/bus/i2c/devices/
.SPI Configuration Example
Enabling an SPI interface follows the same approach. Here's an example DTO for enabling SPI on QUPv3 SE1:Dts
1/dts-v1/;
2/plugin/;
3
4/ {
5 fragment@0 {
6 target = <&qupv3_se1_spi>;
7 __overlay__ {
8 status = "ok";
9 };
10 };
11};
Command Line
1docker run --rm \
2 -v /etc/passwd:/etc/passwd:ro \
3 -v /etc/shadow:/etc/shadow:ro \
4 -v "$PWD":"$PWD" \
5 -w "$PWD" \
6 --user=$(id -u):$(id -g) --group-add 27 \
7 luxonis/luxonis-os-rvc4:latest-public \
8 /bin/bash -c "dtc -@ -I dts -O dtb -o spi-overlay.dtbo spi-overlay.dts"
Command Line
1scp spi_se1.dtbo user@<device-ip>:/persist/custom/dtbo/
Troubleshooting
If an unsupported peripheral configuration is attempted—e.g., assigning a peripheral to an incompatible QUPv3 engine—the device may fail to boot. In such cases, the TrustZone engine is preventing the system from proceeding.To recover:- Enter Emergency Download Mode (EDL).
- Re-flash the device with a known-good image.
dmesg
:Command Line
1dmesg | less
Command Line
1journalctl -u apply-overlays.service