# OAK4 M8 Interface Guide

OAK4 M8 provides a variety of interfaces for connecting to external devices. Below is a summary of each interface, presented in
table format for clarity.

| Pin | M12 pin | M8 pin | M8 functionality |
| --- | --- | --- | --- |
| 1 | Eth MX0+ | GPIO_20/5V_RX | Either a 5V GPIO, or UART RX |
| 2 | Eth MX0- | FSYNC/STROBE_5V | FSYNC is the default, STROBE can be enabled |
| 3 | Eth MX1+ | USB D+ | USB 2.0 Host interface (Can't be used alongside USB-C interface) |
| 4 | Eth MX1- | USB D- | USB 2.0 Host interface (Can't be used alongside USB-C interface) |
| 5 | Eth MX3+ | 5V | This pin is used for sourcing 5V power (max 5W) to accessory devices connected to the M8 connector. |
| 6 | Eth MX3- | GPIO_21/5V_TX | Either a 5V GPIO, or UART TX |
| 7 | Eth MX2+ | DET_PIN | Used to detect what device is connected, can't be used for any other purpose |
| 8 | Eth MX2- | GND | Ground |

> **Voltage levels**
> All interfaces (except USB) on the OAK4 M8 are designed to operate at 5V logic levels. These are level-shifted to 1.8V
internally.

| **Feature** | **Details** |
| --- | --- |
| Pins (M8 connector) | SDA → GPIO20SCL → GPIO21 |
| Selector GPIOs | OAK4-D: GPIO 162 (I2C_SEL_0)OAK4-D: GPIO 163 (I2C_SEL_1)OAK4-S: GPIO 124 (I2C_SEL_0)OAK4-S: GPIO 79 (I2C_SEL_1)
|
| Default State | OAK4-D: GPIO 162 = HIGHOAK4-D: GPIO 163 = HIGHOAK4-S: GPIO 124 = HIGHOAK4-S: GPIO 79 = HIGHUART active (I²C
disabled) |
| Activating I²C | OAK4-D: Set GPIO 162 = LOWOAK4-D: Set GPIO 163 = LOWOAK4-S: Set GPIO 124 = LOWOAK4-S: Set GPIO 79 = LOWMUX
routes pins 20/21 to I²C SDA/SCL |

After activating I²C, you can use the standard Linux I²C subsystem to communicate with connected devices. Bus number is 0, and you
can use tools like i2cdetect to scan for devices:

```bash
i2cdetect -y 0
```

More in-depth info is available in the [OAK4 SOM Development
Guide](https://docs.luxonis.com/hardware/platform/deploy/oak4-som-development-guide.md).

| **Feature** | **Details** |
| --- | --- |
| Pins (M8 connector) | TX → Pin 6 (GPIO 26)RX → Pin 1 (GPIO 27) |
| Default State | OAK4-D: GPIO 162 = HIGHOAK4-D: GPIO 163 = HIGHOAK4-S: GPIO 124 = HIGHOAK4-S: GPIO 79 = HIGHUART active on pins
1/6 |

Since the UART is active by default, you can use it for debugging immediately after powering on the OAK4.

To communicate with the UART, you can use a terminal program like picocom or screen:

```bash
picocom -b 115200 /dev/tty.usbserial-A50285BI
```

After bootup is complete, you can login and use it as a regular serial console.

GPIO pins are on the same address as the I2C interface, so you can use the same pins for GPIO functionality. You need to enable
the I2C MUX first (set the selector GPIOs in the I2C section above).

| **Feature** | **Details** |
| --- | --- |
| Available Pins | Two general-purpose GPIO pins exposed on the M8 connector (GPIO 20 and GPIO 21) |
| Configuration | Inside Script Node, you can set GPIOs like this:`import time import gpiod from gpiod.line import Direction,
Value MX_CHIP = 0 LINES = [20, 21] chip_path = f"/dev/gpiochip{MX_CHIP}" # LineSettings lives on the top-level gpiod module in
v2.x settings = gpiod.LineSettings( direction=Direction.OUTPUT, output_value=Value.INACTIVE ) req = gpiod.request_lines(
chip_path, consumer="depthai-script", config={line: settings for line in LINES} ) toggle = False while True: toggle = not toggle v
= Value.ACTIVE if toggle else Value.INACTIVE node.warn(f"GPIO toggle (gpiod v2): {toggle}") req.set_values({line: v for line in
LINES}) time.sleep(5) ` |

| **Feature** | **Details** |
| --- | --- |
| Functionality | Outputs fsync or strobe pulses from attached cameras. |
| Pin (M8 connector) | 2 |
| To enable | Check the [FSYNC Y-Adapter page](https://docs.luxonis.com/hardware/products/FSYNC%2520Y-Adapter.md) to see how to
enable. |

| **Feature** | **Details** |
| --- | --- |
| Pins (M8 connector) | USB P → Pin 3USB N → Pin 4 |
| Mux Select GPIO | GPIO 12 (USB_MUX_SEL)1 → Route USB lines to M8 connector0 → Route USB lines to onboard USB port |
