# 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 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.

| Feature | Details |
| --- | --- |
| Pins (M8 connector) | * SDA → GPIO20 * SCL → 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 = HIGH * OAK4-D: GPIO 163 = HIGH * OAK4-S: GPIO 124 = HIGH * OAK4-S: GPIO 79 = HIGH * UART
active (I²C disabled) |
| Activating I²C | * OAK4-D: Set GPIO 162 = LOW * OAK4-D: Set GPIO 163 = LOW * OAK4-S: Set GPIO 124 = LOW * OAK4-S: Set GPIO 79 =
LOW * MUX 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 = HIGH * OAK4-D: GPIO 163 = HIGH * OAK4-S: GPIO 124 = HIGH * OAK4-S: GPIO 79 = HIGH * UART
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 share the M8 connector with the I2C and UART interfaces. By default, M8 pins 1 and 6 are routed to UART. To use GPIO20
and GPIO21 on these pins, set both M8 selector GPIOs to LOW and keep them LOW while using the GPIOs:

 * OAK4-D: GPIO162 (`I2C_SEL_0`) and GPIO163 (`I2C_SEL_1`)
 * OAK4-S: GPIO124 (`I2C_SEL_0`) and GPIO79 (`I2C_SEL_1`)

When the selector GPIOs are released or set HIGH, pins 1 and 6 return to the UART path.

> **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-D. On
OAK4-S, use [124, 79]. MUX_LINES = [162, 163] 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 (M8 connector) | * 2 |
| 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 | * GPIO 12 (USB_MUX_SEL) * 1 → Route USB lines to M8 connector * 0 → Route USB lines to onboard USB port |
| 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 force AUX USB host mode manually for testing. These commands are
intended for bring-up only and may change across OS or hardware revisions.

```bash
# OAK4-D
gpioset 0 12=1 && echo host > /sys/class/usb_role/a600000.ssusb-role-switch/role

# OAK4-S
gpioset 0 32=0 # mux usb to m8 && echo host > /sys/class/usb_role/a600000.ssusb-role-switch/role
```

*This information may change as we continue to refine the process, particularly the manual terminal commands.
