# 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. Can also carry combined FSYNC and strobe: the rising edge marks FSYNC
(end of exposure) and the low level marks the strobe duration (active low) |
| 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. On boards that support it (eg. OAK4 Lite R1, OAK4 FFC R2), also a
separate strobe output with either polarity |
| 7 | Eth MX2+ | DET_PIN | Used to detect supported accessories. For custom AUX USB peripherals, pull this pin low to GND through
a 33R resistor to enable automatic USB host switching. |
| 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.

> **Board-specific M8 configuration**
> The select lines that route each M8 pin differ between OAK4 boards and revisions, including OAK4 Lite and OAK4 FFC. Until the M8 kernel driver ships in Luxonis OS, see [OAK4 M8 Manual Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md) for the per-board pinout tables and `gpioset` commands.

| Feature | Details |
| --- | --- |
| Pins (M8 connector) | * SDA → Pin 1 * SCL → Pin 6 |
| Select lines (pin 1, pin 6) | * OAK4-S: GPIO 79, GPIO 124 * OAK4-D: GPIO 163, GPIO 162 * DEV-KIT: `SWITCH2`, `SWITCH1` * OAK4
Lite R0: GPIO 81, GPIO 106 |
| Activating I²C | * OAK4-S, OAK4-D, DEV-KIT: set both select lines to 0 * OAK4 Lite R0: set both select lines to 1 * Pins 1 and 6
switch between UART and I²C together |
| Not available | * OAK4 Lite R1, OAK4 FFC R0, OAK4 FFC R1, OAK4 FFC R2: no I²C on the M8 connector |

To find your board and the `gpioset` commands, see [OAK4 M8 Manual
Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md).

After activating I²C, you can use the standard Linux I²C subsystem to communicate with connected devices. The M8 I²C bus is
`988000.i2c`, and its bus number differs between boards. This command looks up the bus number and scans the bus with `i2cdetect`:

```bash
i2cdetect -y -r $(basename $(ls -d /sys/bus/platform/devices/988000.i2c/i2c-*) | cut -d- -f2)
```

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 * RX → Pin 1 |
| Activating UART | * OAK4-S: GPIO 79 = 1, GPIO 124 = 1 * OAK4-D: GPIO 163 = 1, GPIO 162 = 1 * DEV-KIT: `SWITCH2` = 1, `SWITCH1` =
1 * OAK4 Lite R0: GPIO 81 = 0, GPIO 106 = 0 * OAK4 FFC R0: fixed to UART, no select lines * OAK4 FFC R1: GPIO 55 = 0, GPIO 54 = 0
* OAK4 Lite R1 and OAK4 FFC R2: pins 1 and 6 have separate select lines and direction lines |
| Supported configurations | * Baud rates: 9600, 19200, 38400, 57600, and 115200 bps * Parity: none, even, odd * Software Flow
control: XON/XOFF is currently not supported |

To find your board and the full per-board steps, including OAK4 Lite R1 and OAK4 FFC R2, see [OAK4 M8 Manual
Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md).

There are two ways to use UART:

 * User UART is intended for applications that need full control over traffic through `/dev/ttyHS0`. This mode is set by default.
   Can be enabled with `oakctl device uart disable`.
 * Debug UART provides console access and development debugging, with system-generated traffic. Here no `/dev/ttyHS0` is
   available, instead there is `/dev/ttyMSM0`, which is controlled by the kernel. This mode can be set with `oakctl device uart
   enable`.

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 share the M8 connector with the I2C and UART interfaces. By default, M8 pins 1 and 6 are routed to UART. On OAK4-S, to
use GPIO20 and GPIO21 on these pins, set both M8 selector GPIOs (GPIO124 `I2C_SEL_0` and GPIO79 `I2C_SEL_1`) to LOW and keep them
LOW while using the GPIOs. When the selector GPIOs are released or set HIGH, pins 1 and 6 return to the UART path.

> **No GPIO mode on OAK4-D**
> OAK4-D does not support GPIO mode on M8 pins 1 and 6. These pins share a bus with on-board I²C devices, such as the USB PD controller, and switching them to GPIO would break those devices. On OAK4-D, use pins 1 and 6 only for UART or I²C.

For GPIO on other OAK4 boards, such as OAK4 Lite and OAK4 FFC, see [OAK4 M8 Manual
Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md).

> **M8 interface selection**
> This configuration is specific to OAK4 and selects GPIO for M8 pins 1 and 6; do not use these pins for UART or I2C at the same time. If you update the device OS, verify the selector GPIO mapping in the documentation for that release before deploying an application that configures the mux directly.

| Feature | Details |
| --- | --- |
| Available Pins | * Two general-purpose GPIO pins exposed on the M8 connector (GPIO 20 and GPIO 21) |
| Configuration | Inside a Script node, configure the selector GPIOs together with GPIO20 and GPIO21. Keep the Script node running
for the duration of GPIO use so the M8 mux remains selected: ```python import time import GPIO GPIO_LINES = [20, 21] # OAK4-S
selector GPIOs MUX_LINES = [124, 79] for line in MUX_LINES: GPIO.setup(line, GPIO.OUT, GPIO.PULL_DOWN) GPIO.write(line, GPIO.LOW)
for line in GPIO_LINES: GPIO.setup(line, GPIO.OUT, GPIO.PULL_DOWN) toggle = False while True: toggle = not toggle value =
GPIO.HIGH if toggle else GPIO.LOW for line in GPIO_LINES: GPIO.write(line, value) time.sleep(2) ``` |

| Feature | Details |
| --- | --- |
| Functionality | * Outputs fsync or strobe pulses from attached cameras. * Pin 2 carries FSYNC, or FSYNC and strobe combined: the
rising edge marks FSYNC (end of exposure), and the low level marks the strobe duration (strobe is active low). * On boards that
support it, such as OAK4 Lite R1 and OAK4 FFC R2, pin 6 is a separate strobe-only output that supports both polarities. |
| Pin (M8 connector) | * 2 (FSYNC, or combined FSYNC and strobe) * 6 (separate strobe, on supported boards) |
| To enable | Check the [FSYNC Y-Adapter page](hw-catalog://FSYNC Y-Adapter) to see how to enable. |

| Feature | Details |
| --- | --- |
| Pins (M8 connector) | * USB P → Pin 3 * USB N → Pin 4 |
| Mux Select GPIO | * OAK4-D: GPIO 12 (USB_MUX_SEL) * 1 → Route USB lines to M8 connector * 0 → Route USB lines to onboard USB
port The select line and its polarity differ between boards and hardware revisions. For other boards, see the USB2 route tables in
[OAK4 M8 Manual Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md). |
| Behavior note | USB-C and the M8 connector are only mutually exclusive for USB data when the connected M8 peripheral requires
USB connectivity, such as the M8 Controller Box or M8 WiFi Adapter. Accessories such as the M8 FSYNC Splitter, M8 FSYNC cabling,
and the M8 Debugging Adapter (OAK4) do not take over the USB data path, so USB-C can still be used for data with those connected.
|
| Troubleshooting note | USB troubleshooting details can change across OS and hardware revisions. Treat the guidance below,
especially the manual host-switching commands, as bring-up references and verify them against the documentation for your current
release. |

If a USB peripheral works over USB-C but does not enumerate through the AUX harness, the most common cause is that the
accessory-detect line is not wired for automatic host switching.

> **Automatic AUX USB host switching**
> For custom AUX USB peripherals, pull DET_PIN (pin 7) low to GND through a 33R resistor. This enables the camera to detect the accessory and automatically switch USB data to the M8 connector.

> **AUX USB power budget**
> The AUX 5V pin can source up to 5W total. If the connected peripheral, cable, or any inline conversion hardware exceeds that budget, USB enumeration may fail or become unstable.

### Troubleshooting AUX USB peripherals

 * Confirm the peripheral enumerates when connected directly to the camera's USB-C port.
 * Verify that USB D+, USB D-, 5V, GND, and DET_PIN are all wired correctly through the harness.
 * Pull DET_PIN low through a 33R resistor to GND for automatic USB host switching.
 * Keep the accessory within the AUX 5V / 5W power budget.

If you already have SSH or ADB access to the camera, you can also route USB2 to the M8 connector manually for testing. The select
line and its polarity differ between boards and hardware revisions (for example, OAK4-S R0–R2 and OAK4-S R5 or later use opposite
levels), so follow the per-board steps in [OAK4 M8 Manual
Control](https://docs.luxonis.com/hardware/platform/deploy/oak4-m8-interface/oak4-m8-manual-control.md).
