2025-05-14 15:25:41 +08:00
---
2025-10-10 10:09:04 +08:00
title: XU316 USB HiFi Decoder Zero-Code Product Configuration Protocol
2025-05-14 15:25:41 +08:00
status: new
2025-10-10 10:09:04 +08:00
description: XU316 USB HiFi Decoder Zero-Code Product Configuration Protocol Documentation
2025-05-14 15:25:41 +08:00
authors:
- admin
tags:
2025-07-28 15:13:49 +08:00
- Protocol
2025-05-14 15:25:41 +08:00
- XU316
2025-07-28 15:13:49 +08:00
- USB Audio
2025-05-14 15:25:41 +08:00
- UART
search:
boost: 2
---
2025-10-10 10:09:04 +08:00
# XU316 USB HiFi Decoder Zero-Code Product Configuration Protocol
2025-05-14 15:25:41 +08:00
--8<-- "common/phaten_xmos_support_img.md"
2025-07-28 15:13:49 +08:00
## Protocol Overview :material-file-document-outline:
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
!!! abstract "Functional Scope and Purpose"
This document provides detailed specifications for the UART-based configuration protocol between XU316 USB HiFi Decoder zero-code products and MCU. The protocol offers a complete feature set for audio device configuration, status monitoring, and media control.
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
## 1. Protocol Foundation Specification :material-connection:
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 1.1 Underlying Communication Protocol
2025-10-10 10:09:04 +08:00
2025-07-28 15:13:49 +08:00
**Based on UART (Universal Asynchronous Receiver/Transmitter) Protocol**
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
| Parameter | Value |
2025-05-14 15:25:41 +08:00
|:---------------:|:--------------------:|
2025-07-28 15:13:49 +08:00
| Baud Rate | 115200 bps |
| Data Bits | 8 |
| Parity | None |
| Stop Bits | 1 |
| Flow Control | None |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 1.2 Frame Format and Data Transmission
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
!!! example "General Frame Format"
2025-10-10 10:09:04 +08:00
All commands and responses follow this frame format:
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
| Field | Byte Count | Description |
2025-05-14 15:25:41 +08:00
|:----------:|:--------:|:-----------------------------------------:|
2025-07-28 15:13:49 +08:00
| Frame Header | 2 | Fixed as 0x55aa |
| Version | 1 | Protocol version number |
2025-10-10 10:09:04 +08:00
| Command | 1 | Indicates frame function |
| Data Length | 1 | Length N of subsequent data, excluding final checksum byte |
2025-12-31 18:12:27 +08:00
| Data | N | Specific data content |
| Checksum | 1 | Sum of all bytes from frame header, modulo 256 |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
!!! warning "Data Transmission Notes"
2025-12-31 18:12:27 +08:00
All multi-byte data is transmitted in **Big Endian ** mode. All example data in the protocol is shown in hexadecimal format.
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 1.3 Communication Mechanism
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
#### 1.3.1 Acknowledgment Mechanism
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
!!! tip "Acknowledgment and Timeout Handling"
2025-12-31 18:12:27 +08:00
- All commands require response acknowledgment from the recipient
- Default command timeout is 300ms, timeout indicates communication failure
2025-10-10 10:09:04 +08:00
- Special commands may have different timeout values, specified in respective command descriptions
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
#### 1.3.2 Retry and Fault Tolerance Mechanism
2025-05-14 15:25:41 +08:00
```mermaid
flowchart TD
2025-07-28 15:13:49 +08:00
A[Send Command] --> B{Wait for Response}
2025-10-10 10:09:04 +08:00
B -->|Timeout| C[Resend Command]
C --> D{Retry Count<4?}
2025-07-28 15:13:49 +08:00
D -->|Yes| B
D -->|No| E[Use Default Configuration]
B -->|Response Received| F[Process Response]
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
## 2. Device Startup and Initialization :material-power-plug:
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 2.1 Startup Interaction Flow
2025-05-14 15:25:41 +08:00
```mermaid
sequenceDiagram
participant XU316
participant MCU
participant Flash
2025-10-10 10:09:04 +08:00
2025-05-14 15:25:41 +08:00
rect
2025-07-28 15:13:49 +08:00
Note over XU316,Flash: System Loader Firmware
2025-10-10 10:09:04 +08:00
rect
Note over XU316,MCU: Power-On Startup Phase
2025-12-31 18:12:27 +08:00
XU316->>MCU: Send start-up command (0x00)
2025-10-10 10:09:04 +08:00
Note over XU316:
2025-12-31 18:12:27 +08:00
alt Timeout with no response (max 4 attempts, if all fail enter USB->I2S mode directly)
XU316->>MCU: Resend start-up command (0x00)
2025-05-14 15:25:41 +08:00
end
2025-12-31 18:12:27 +08:00
MCU-->>XU316: Return startup options
Note over XU316: Parse startup options
2025-05-14 15:25:41 +08:00
end
2025-10-10 10:09:04 +08:00
rect
2025-07-28 15:13:49 +08:00
Note over XU316,Flash: Basic Information Update Phase
2025-12-31 18:12:27 +08:00
alt Startup option does not include 0x01 (do not update basic product info)
XU316->>Flash: Read basic product info
Flash-->>XU316: Return basic product info
2025-10-10 10:09:04 +08:00
else Startup option includes 0x01 (update basic product info) or Flash data incomplete
2025-12-31 18:12:27 +08:00
XU316->>MCU: Send read basic product info command (0x01)
MCU-->>XU316: Return new basic product info
XU316->>Flash: Save configuration
2025-05-14 15:25:41 +08:00
end
end
2025-10-10 10:09:04 +08:00
rect
2025-12-31 18:12:27 +08:00
Note over XU316,Flash: Power-On Configuration Retrieval Phase
alt Startup option does not include 0x02 (do not update power-on config)
XU316->>Flash: Read power-on configuration
Flash-->>XU316: Return power-on configuration data
2025-10-10 10:09:04 +08:00
else Startup option includes 0x02 (update power-on config) or Flash data incomplete
2025-12-31 18:12:27 +08:00
XU316->>MCU: Send get power-on config command (0x02)
MCU-->>XU316: Return new power-on config
XU316->>Flash: Save new power-on config
2025-10-10 10:09:04 +08:00
end
2025-05-14 15:25:41 +08:00
end
2025-10-10 10:09:04 +08:00
rect
2025-07-28 15:13:49 +08:00
Note over XU316: Loading Application Mode Phase
2025-12-31 18:12:27 +08:00
XU316->>MCU: Send get current mode command (0x03)
MCU-->>XU316: Return current mode
2025-07-28 15:13:49 +08:00
Note over XU316: Load corresponding mode based on current mode
2025-05-14 15:25:41 +08:00
end
end
2025-10-10 10:09:04 +08:00
rect
2025-07-28 15:13:49 +08:00
Note over XU316,MCU: APP Running Phase
2025-12-31 18:12:27 +08:00
XU316->>MCU: Get current user config command (0x04)
MCU-->>XU316: Return current user config
2025-10-10 10:09:04 +08:00
Note over XU316: Initialize APP and apply current user config
2025-12-31 18:12:27 +08:00
XU316->>MCU: Send startup complete command (0x05)
MCU-->>XU316: Return completion command response
2025-07-28 15:13:49 +08:00
par Parallel Processing
loop Status Reporting
2025-12-31 18:12:27 +08:00
XU316->>MCU: Status change or 15s timer send
2025-05-14 15:25:41 +08:00
end
2025-07-28 15:13:49 +08:00
loop Business Processing
2025-10-10 10:09:04 +08:00
MCU->>XU316: Send business commands
XU316-->>MCU: Respond to business commands
2025-05-14 15:25:41 +08:00
end
end
end
```
2025-07-28 15:13:49 +08:00
### 2.2 Detailed Startup Flow Description
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
=== "Power-On Startup and Options Phase"
1. XU316 sends start-up command (command 0x00) to MCU at startup, including:
2025-05-14 15:25:41 +08:00
- UAC1.0 VID/PID
- UAC2.0 VID/PID
2025-10-10 10:09:04 +08:00
- Basic info CRC
- Power-on config info CRC
2025-12-31 18:12:27 +08:00
2. MCU receives startup command, checks if info needs updating, and sends corresponding reply
2025-07-28 15:13:49 +08:00
3. XU316 waits for MCU response
2025-12-31 18:12:27 +08:00
4. If timeout with no response, XU316 resends startup command up to 4 times
5. If still no response, directly loads default USB configuration and enumerates USB
2025-07-28 15:13:49 +08:00
6. If normal response received, XU316 parses startup options
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Basic Information Update Phase"
2025-12-31 18:12:27 +08:00
**Execution Condition ** : Startup options include 0x01 (update basic product info)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**Steps ** :
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
1. XU316 sends 0x01 command to request reading basic product info
2025-10-10 10:09:04 +08:00
2. MCU returns new basic product info to XU316
2025-12-31 18:12:27 +08:00
3. XU316 updates and saves configuration to internal storage
2025-10-10 10:09:04 +08:00
2025-12-31 18:12:27 +08:00
=== "Power-On Configuration Retrieval Phase"
**Execution Condition ** : Startup options include 0x02 (update power-on config) or Flash data is incomplete
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**Steps ** :
2025-10-10 10:09:04 +08:00
2025-12-31 18:12:27 +08:00
1. XU316 sends 0x02 command to request getting power-on configuration
2. MCU returns new power-on configuration to XU316
3. XU316 updates and saves configuration to internal storage
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Application Firmware Loading Phase"
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**Steps ** :
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
1. XU316 sends 0x03 command to get current input/output mode
2025-10-10 10:09:04 +08:00
2. MCU returns current mode info to XU316
2025-07-28 15:13:49 +08:00
3. XU316 loads corresponding input/output mode based on returned mode
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Application Initialization Phase"
**Steps ** :
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
1. XU316 sends 0x04 command to get current user configuration
2. MCU returns current user configuration to XU316
3. XU316 initializes application and applies related configuration
2025-10-10 10:09:04 +08:00
4. XU316 sends 0x05 command to indicate startup complete
2025-12-31 18:12:27 +08:00
5. MCU returns confirmation response
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
## 3. Protocol Command Set :material-console:
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 3.1 Command Classification Overview
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Startup and Basic Commands (0x00-0x0F)"
2025-10-10 10:09:04 +08:00
| Command | Command Description | Direction |
2025-05-14 15:25:41 +08:00
|:--------:|:---------------------------------------------|:----------:|
2025-12-31 18:12:27 +08:00
| 0x00 | Start-up | XU316→MCU |
| 0x01 | Read product info | XU316→MCU |
| 0x02 | Read power-on config info | XU316→MCU |
| 0x03 | Get current input/output mode | XU316→MCU |
| 0x04 | Get current user configuration | XU316→MCU |
| 0x05 | Startup complete command | XU316→MCU |
2025-07-28 15:13:49 +08:00
=== "Business Control Commands (0x20-0x2F)"
2025-10-10 10:09:04 +08:00
| Command | Command Description | Direction |
2025-05-14 15:25:41 +08:00
|:--------:|:---------------------------------------------|:----------:|
2025-12-31 18:12:27 +08:00
| 0x20 | Report application status | XU316→MCU |
| 0x21 | Media control | MCU→XU316 |
| 0x22 | Report playback audio stream format and type | XU316→MCU |
| 0x23 | Set input/output mode | MCU→XU316 |
| 0x24 | XU316 send playback volume | XU316→MCU |
| 0x25 | Send recording volume | XU316→MCU |
2025-07-28 15:13:49 +08:00
| 0x26 | Switch MCLK | MCU→XU316 |
2026-05-16 17:24:34 +08:00
| 0x27 | Set unmute | MCU→XU316 |
| 0x28 | Send audio format time delay | MCU→XU316 |
2026-04-21 17:43:55 +08:00
| 0x29 | Report USB connection status | XU316→MCU |
2026-06-06 11:17:45 +08:00
| 0x30 | Set Mute pin inversion | MCU→XU316 |
2025-07-28 15:13:49 +08:00
2025-12-31 18:12:27 +08:00
=== "HID-MCU Passthrough Commands (0xEE-0xEF)"
2025-10-10 10:09:04 +08:00
| Command | Command Description | Direction |
2025-05-14 15:25:41 +08:00
|:--------:|:---------------------------------------------|:----------:|
2025-12-31 18:12:27 +08:00
| 0xEE | HID-initiated command passed through XU316 to MCU | XU316→MCU |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "DAC Control Commands (0xF0-0xFF)"
2025-10-10 10:09:04 +08:00
| Command | Command Description | Direction |
2025-05-14 15:25:41 +08:00
|:--------:|:---------------------------------------------|:----------:|
2025-12-31 18:12:27 +08:00
| 0xF0 | DAC configuration selection command | MCU→XU316 |
2026-05-16 17:24:34 +08:00
| 0xF1 | Get firmware version command | MCU→XU316 |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
!!! note "Command Usage Instructions"
2025-10-10 10:09:04 +08:00
1. All commands must follow basic frame format specification
2025-12-31 18:12:27 +08:00
2. Each command requires recipient acknowledgment for successful execution
3. Business control commands (0x20 and above) can only be used after device startup complete
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
### 3.2 Basic Function Command Details
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
#### 3.2.1 Start-up (0x00)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x00
Data Length: 1 byte - 17
Data: 17 bytes
B0: Restart reason (0x00 power-on restart, 0x01 mode switch restart, 0xFF other reason)
B1-2: USB Vendor ID (UAC1.0)
B3-4: USB Product ID (UAC1.0)
B5-6: USB Vendor ID (UAC2.0)
B7-8: USB Product ID (UAC2.0)
B9-12: Basic info 32-bit CRC
B13-16: Power-on config info 32-bit CRC
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x00
Data Length: 1 byte - 0x1
Data: 1 byte
B0: Startup options
0x00 Use all default info
0x01 Need to update basic product info
0x02 Need to update power-on config info
0x04 Need to update other config info
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
1. This command is sent first by XU316 after power-on or restart to notify MCU that device has started
2. XU316 sends currently stored product info CRC and config info CRC to MCU
3. MCU compares CRC to determine if XU316 config info needs updating
4. MCU notifies XU316 of subsequent operations to execute through startup options field in response
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Usage Flow"
2025-05-14 15:25:41 +08:00
```mermaid
flowchart TB
2025-07-28 15:13:49 +08:00
A[XU316 Startup] -->B[Send 0x00 Command]
B -->C{MCU Response}
2025-10-10 10:09:04 +08:00
C -->|Timeout| D[Resend Command]
D -->E{Retry Count<4?}
2025-07-28 15:13:49 +08:00
E -->|Yes| C
2025-12-31 18:12:27 +08:00
E -->|No| F[Use Default Configuration]
2025-07-28 15:13:49 +08:00
C -->|Normal Response| G[Parse Startup Options]
2025-10-10 10:09:04 +08:00
G -->|0x01| H[Update Basic Product Info]
2025-12-31 18:12:27 +08:00
G -->|0x02| I[Update Power-On Config Info]
G -->|0x04| J[Update Other Config Info]
2025-10-10 10:09:04 +08:00
G -->|0x00| K[Continue Startup Flow]
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Notes"
2025-12-31 18:12:27 +08:00
* If MCU has no response, XU316 will use stored default configuration to continue startup
2025-10-10 10:09:04 +08:00
* Restart reason field can be used by MCU to identify specific reason for XU316 restart for different handling
2025-12-31 18:12:27 +08:00
* When multiple info items need updating, MCU can combine multiple options through bit operations
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 00 01 03 06
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is returned by MCU to XU316 |
| Command | 1 byte | `00` | Current command is “Start-up” |
| Data Length | 1 byte | `01` | One data byte follows |
| Startup options | 1 byte | `03` | `0x01` + `0x02` are both set: update basic product info and power-on config info |
| Checksum | 1 byte | `06` | Sum of all bytes from `55` to `03` , modulo 256 |
2025-10-10 10:09:04 +08:00
#### 3.2.2 Read Product Info (0x01)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x01
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x01
Data Length: 1 byte - 0x3C (60 bytes)
Data: 60 bytes - Product basic info, see data field description
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by XU316 to get basic product info such as VID/PID, product name, etc.
- Execution condition: Startup options include 0x01 flag or product info CRC mismatch
- After receiving this info, XU316 will update internally stored product basic info
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Data Structure"
2025-10-10 10:09:04 +08:00
Product basic info data structure (60 bytes):
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
VID1 (UAC1.0): 2 bytes
PID1 (UAC1.0): 2 bytes
VID2 (UAC2.0): 2 bytes
PID2 (UAC2.0): 2 bytes
ManufactureName: 16 bytes (string)
ProductName: 16 bytes (string)
SerialNumber: 16 bytes (string)
2025-10-10 10:09:04 +08:00
CRC: 4 bytes (32-bit CRC checksum)
2025-05-14 15:25:41 +08:00
```
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
2026-06-06 11:17:45 +08:00
55 AA 03 01 3C 20 B1 00 17 20 B1 00 16 50 48 41 54 45 4E 00 00 00 00 00 00 00 00 00 00 58 55 33 31 36 20 44 41 43 00 00 00 00 00 00 00 53 4E 32 34 30 30 30 31 00 00 00 00 00 00 00 00 27 2B F6 44 51
2026-05-16 17:24:34 +08:00
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is returned by MCU to XU316 |
| Command | 1 byte | `01` | Current command is “Read Product Info” |
| Data Length | 1 byte | `3C` | 60 data bytes follow |
| VID1 | 2 bytes | `20 B1` | USB VID for UAC1.0 |
| PID1 | 2 bytes | `00 17` | USB PID for UAC1.0 |
| VID2 | 2 bytes | `20 B1` | USB VID for UAC2.0 |
| PID2 | 2 bytes | `00 16` | USB PID for UAC2.0 |
| ManufactureName | 16 bytes | `50 48 41 54 45 4E 00 00 00 00 00 00 00 00 00 00` | ASCII string `PHATEN` , padded with `00` to 16 bytes |
| ProductName | 16 bytes | `58 55 33 31 36 20 44 41 43 00 00 00 00 00 00 00` | ASCII string `XU316 DAC` , padded with `00` to 16 bytes |
| SerialNumber | 16 bytes | `53 4E 32 34 30 30 30 31 00 00 00 00 00 00 00 00` | ASCII string `SN240001` , padded with `00` to 16 bytes |
2026-06-06 11:17:45 +08:00
| CRC | 4 bytes | `27 2B F6 44` | 32-bit CRC for product basic info (little-endian, example only) |
| Checksum | 1 byte | `51` | Sum of all bytes from `55` to `44` , modulo 256 |
2026-05-16 17:24:34 +08:00
2025-12-31 18:12:27 +08:00
#### 3.2.3 Read Power-On Config Info (0x02)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x02
Data Length: 1 byte - 0x00
Data: 0 bytes - No data
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x02
Data Length: 1 byte - 0x0E (14 bytes)
Data: 14 bytes - Power-on config info, see section 4.1-Power-On Config Info
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by XU316 to get initial power-on configuration info
- Execution condition: Startup options include 0x02 flag or power-on config CRC mismatch
- XU316 will set default input/output mode, volume and other parameters based on this config info
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Data Structure"
2025-10-10 10:09:04 +08:00
Power-on config info data structure (14 bytes):
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Default input/output mode: 5 bytes
Mute time: 2 bytes (0-65535ms)
Microphone default volume: 1 byte
DAC left channel default volume: 1 byte
DAC right channel default volume:1 byte
CRC: 4 bytes (32-bit CRC checksum)
2025-05-14 15:25:41 +08:00
```
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
2026-06-06 11:17:45 +08:00
55 AA 03 02 0E 01 00 00 00 00 01 2C 20 30 30 C1 7A 1E 1A 33
2026-05-16 17:24:34 +08:00
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is returned by MCU to XU316 |
| Command | 1 byte | `02` | Current command is “Read Power-On Config Info” |
| Data Length | 1 byte | `0E` | 14 data bytes follow |
| Default input/output mode | 5 bytes | `01 00 00 00 00` | Example mode data; each byte definition depends on product specification |
| Mute time | 2 bytes | `01 2C` | `300ms` in big-endian encoding |
| Microphone default volume | 1 byte | `20` | Example default microphone volume |
| DAC left channel default volume | 1 byte | `30` | Example default left channel volume |
| DAC right channel default volume | 1 byte | `30` | Example default right channel volume |
2026-06-06 11:17:45 +08:00
| CRC | 4 bytes | `C1 7A 1E 1A` | 32-bit CRC for power-on config (little-endian, example only) |
| Checksum | 1 byte | `33` | Sum of all bytes from `55` to `1A` , modulo 256 |
2026-05-16 17:24:34 +08:00
2025-07-28 15:13:49 +08:00
#### 3.2.4 Get Current Input/Output Mode (0x03)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x03
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x03
Data Length: 1 byte - 0x05 (5 bytes)
Data: 5 bytes - Input/output mode, see data field section
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by XU316 at startup to query currently enabled input/output mode
- XU316 will load corresponding application firmware based on returned mode
2025-10-10 10:09:04 +08:00
- This command is used for mode matching and confirmation during device startup
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 03 05 01 00 00 00 00 0B
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is returned by MCU to XU316 |
| Command | 1 byte | `03` | Current command is “Get Current Input/Output Mode” |
| Data Length | 1 byte | `05` | 5 data bytes follow |
| Input/output mode | 5 bytes | `01 00 00 00 00` | Example mode data; definitions depend on product specification |
| Checksum | 1 byte | `0B` | Sum of all bytes from `55` to the last mode byte, modulo 256 |
2025-12-31 18:12:27 +08:00
#### 3.2.5 Get Current User Configuration (0x04)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x04
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x04
Data Length: 1 byte - 0xE (14 bytes)
Data: 14 bytes - User config parameters, see section 4.1-User Config Parameters
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by XU316 to get currently user-selected volume, mode and other configurations
- Executed after application firmware loaded, before application startup
- Application will initialize corresponding parameters based on returned info
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
2026-06-06 11:17:45 +08:00
55 AA 03 04 0E 02 00 00 00 00 00 C8 18 28 28 3A 8A 5B 2E 93
2026-05-16 17:24:34 +08:00
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is returned by MCU to XU316 |
| Command | 1 byte | `04` | Current command is “Get Current User Configuration” |
| Data Length | 1 byte | `0E` | 14 data bytes follow |
| Input/output mode | 5 bytes | `02 00 00 00 00` | Example current user-selected mode data; definitions depend on product specification |
| Mute time | 2 bytes | `00 C8` | `200ms` in big-endian encoding |
| Microphone volume | 1 byte | `18` | Example current microphone volume |
| DAC left channel volume | 1 byte | `28` | Example current left channel volume |
| DAC right channel volume | 1 byte | `28` | Example current right channel volume |
2026-06-06 11:17:45 +08:00
| CRC | 4 bytes | `3A 8A 5B 2E` | 32-bit CRC for user configuration (little-endian, example only) |
| Checksum | 1 byte | `93` | Sum of all bytes from `55` to `2E` , modulo 256 |
2026-05-16 17:24:34 +08:00
2025-12-31 18:12:27 +08:00
#### 3.2.6 Startup Complete Command (0x05)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x05
Data Length: 1 byte - N
Data: N bytes
B0: Startup status (0 startup success, 1 mode mismatch, other values startup failure)
B1-BN: Application runtime parameters, see section 4.1-Application Runtime Parameters
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x05
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command indicates XU316 startup flow has completed and can begin normal operation
- Contains startup status info to notify MCU if startup succeeded or encountered problems
- All subsequent business commands can only be used after this command is successfully sent
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 05 00 07
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `05` | Acknowledges “Startup Complete Command” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `07` | Sum of all bytes from `55` to `00` , modulo 256 |
2025-10-10 10:09:04 +08:00
### 3.3 Business Control Command Details
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
!!! warning "Usage Prerequisites"
2025-12-31 18:12:27 +08:00
The following commands can only be used after XU316 startup complete (after sending 0x05 command and receiving response)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
#### 3.3.1 Report Application Status (0x20)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x20
Data Length: 1 byte - N
Data: N bytes - Application runtime parameters, see section 4.1-Application Runtime Parameters
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x20
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
- This command is used by XU316 to report current application status to MCU
2025-10-10 10:09:04 +08:00
- Typically sent when status changes, such as volume change, mode switch, etc.
- MCU can update UI display or adjust related functions based on this info
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 20 00 22
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `20` | Acknowledges “Report Application Status” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `22` | Sum of all bytes from `55` to `00` , modulo 256 |
2025-07-28 15:13:49 +08:00
#### 3.3.2 Media Control (0x21)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**MCU Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x21
Data Length: 1 byte - 0x01 (1 byte)
Data: 1 byte - Media control command
0x00 Volume Up / Vol Up
0x01 Volume Down / Vol Down
0x02 Play/Pause / PLAY/PAUSE
0x03 Next Track / NEXT
0x04 Previous Track / PREV
0x05 Fast Forward / FORWARD
0x06 Rewind / REWIND
0x07 Mute / MUTE
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**XU316 Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x21
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-10-10 10:09:04 +08:00
- This command is used by MCU to send media control commands to XU316
2025-12-31 18:12:27 +08:00
- After receiving command, XU316 will convert to corresponding HID command and send to computer
- Suitable for implementing remote control or physical button control of media playback
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
=== "Control Button Mapping Table"
2025-07-28 15:13:49 +08:00
| Control Code | Function | USB HID Usage |
2025-05-14 15:25:41 +08:00
|:-----:|:------------------:|:------------------:|
2025-10-10 10:09:04 +08:00
| 0x00 | Volume Up | Increase system volume |
| 0x01 | Volume Down | Decrease system volume |
| 0x02 | Play/Pause | Control media playback state |
2025-12-31 18:12:27 +08:00
| 0x03 | Next Track | Switch to next song |
| 0x04 | Previous Track | Switch to previous song |
2025-07-28 15:13:49 +08:00
| 0x05 | Fast Forward | Fast forward in current track |
| 0x06 | Rewind | Rewind in current track |
2025-10-10 10:09:04 +08:00
| 0x07 | Mute | Toggle system mute state |
2025-05-14 15:25:41 +08:00
2026-06-06 11:17:45 +08:00
=== "MCU Sends Example"
**Command Example **
```
55 AA 03 21 01 02 26
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is a command sent by MCU to XU316 |
| Command | 1 byte | `21` | Current command is “Media Control” |
| Data Length | 1 byte | `01` | One data byte follows |
| Control code | 1 byte | `02` | Indicates “Play/Pause” |
| Checksum | 1 byte | `26` | Sum of all bytes from `55` to control code, modulo 256 |
2025-07-28 15:13:49 +08:00
#### 3.3.3 Report Playback Audio Stream Format and Type (0x22)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x22
Data Length: 1 byte - 0x02 (2 bytes)
Data: 2 bytes - Audio stream format and type, see audio stream format and type field
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x22
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-10-10 10:09:04 +08:00
- This command is used by XU316 to report current audio stream format and type to MCU
- Typically sent when playback starts or format changes
2025-12-31 18:12:27 +08:00
- MCU can update display based on this info, such as showing PCM/DSD/MQA/DOP status
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 22 00 24
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `22` | Acknowledges “Report Playback Audio Stream Format and Type” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `24` | Sum of all bytes from `55` to `00` , modulo 256 |
2025-07-28 15:13:49 +08:00
#### 3.3.4 Set Input/Output Mode (0x23)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**MCU Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x23
Data Length: 1 byte - 0x05 (5 bytes)
Data: 5 bytes - Input/output mode, see input/output mode field
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**XU316 Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x23
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by MCU to request XU316 switch to specific input/output mode
2025-10-10 10:09:04 +08:00
- Typically triggered by user operation, such as pressing mode selection button
- XU316 may need to restart to load new mode firmware
2025-05-14 15:25:41 +08:00
2026-06-06 11:17:45 +08:00
=== "MCU Sends Example"
**Command Example **
```
55 AA 03 23 05 02 00 00 00 00 2C
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is a command sent by MCU to XU316 |
| Command | 1 byte | `23` | Current command is “Set Input/Output Mode” |
| Data Length | 1 byte | `05` | 5 mode bytes follow |
| Input/output mode | 5 bytes | `02 00 00 00 00` | Example target mode data; definitions depend on product specification |
| Checksum | 1 byte | `2C` | Sum of all bytes from `55` to the last mode byte, modulo 256 |
2025-07-28 15:13:49 +08:00
#### 3.3.5 Send Playback Volume (0x24)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2026-06-06 11:17:45 +08:00
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
2026-06-06 11:17:45 +08:00
Version: 1 byte - 0x00
2025-12-31 18:12:27 +08:00
Command: 1 byte - 0x24
Data Length: 1 byte - 0x02 (2 bytes)
Data: 2 bytes
Byte 1: Left channel (0xFF Mute, 0-0dB, -127: -127dB)
Byte 2: Right channel (0xFF Mute, 0-0dB, -127: -127dB)
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2026-06-06 11:17:45 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
2026-06-06 11:17:45 +08:00
Version: 1 byte - 0x03
2025-12-31 18:12:27 +08:00
Command: 1 byte - 0x24
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-11-13 09:43:27 +08:00
- This command is used by XU316 to report current playback volume to MCU
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 24 00 26
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `24` | Acknowledges “Send Playback Volume” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `26` | Sum of all bytes from `55` to `00` , modulo 256 |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
#### 3.3.6 Send Recording Volume (0x25)
=== "Command Format"
2026-06-06 11:17:45 +08:00
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
2026-06-06 11:17:45 +08:00
Version: 1 byte - 0x00
2025-12-31 18:12:27 +08:00
Command: 1 byte - 0x25
Data Length: 1 byte - 0x01 (1 byte)
Data: 1 byte - 0xFF Mute, 0-0dB -127: -127dB
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2026-06-06 11:17:45 +08:00
**MCU Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
2026-06-06 11:17:45 +08:00
Version: 1 byte - 0x03
2025-12-31 18:12:27 +08:00
Command: 1 byte - 0x25
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-11-13 09:43:27 +08:00
- This command is used by XU316 to report current microphone recording volume to MCU
2025-12-31 18:12:27 +08:00
- Reserved command, currently not used
2025-05-14 15:25:41 +08:00
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 25 00 27
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `25` | Acknowledges “Send Recording Volume” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `27` | Sum of all bytes from `55` to `00` , modulo 256 |
2025-07-28 15:13:49 +08:00
#### 3.3.7 Switch MCLK (0x26)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
**MCU Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x26
Data Length: 1 byte - 1
Data: 1 byte - 0: Internal MCLK, 1: External MCLK
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**XU316 Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x26
Data Length: 1 byte - 0
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used by XU316 to control switching master clock source
- Can switch between using internal clock or external clock
- Important for certain audio application scenarios requiring precise synchronization
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
#### 3.3.8 Set Unmute (0x27)
2025-05-22 12:41:39 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2025-10-10 10:09:04 +08:00
**MCU Sends **
2025-07-28 15:13:49 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x27
Data Length: 1 byte - 2
Data: 2 bytes -
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-07-28 15:13:49 +08:00
```
2025-10-10 10:09:04 +08:00
**XU316 Returns **
2025-07-28 15:13:49 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x27
Data Length: 1 byte - 0
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-07-28 15:13:49 +08:00
```
2025-05-22 12:41:39 +08:00
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-10-10 10:09:04 +08:00
- DAC unmute time delay during mode switching, unit is milliseconds
2025-05-22 12:41:39 +08:00
2025-10-10 10:09:04 +08:00
#### 3.3.9 Send Audio Format Time Delay (0x28)
2025-05-22 12:41:39 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2025-10-10 10:09:04 +08:00
**MCU Sends **
2025-07-28 15:13:49 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x28
Data Length: 1 byte - 2
Data: 2 bytes -
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-07-28 15:13:49 +08:00
```
2025-05-22 12:41:39 +08:00
2025-10-10 10:09:04 +08:00
**XU316 Returns **
2025-07-28 15:13:49 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x28
Data Length: 1 byte - 0
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-07-28 15:13:49 +08:00
```
2025-05-22 12:41:39 +08:00
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-10-10 10:09:04 +08:00
- Send audio format time delay
2025-05-22 12:41:39 +08:00
2026-04-21 17:43:55 +08:00
#### 3.3.10 Report USB Connection Status (0x29)
=== "Command Format"
**XU316 Sends **
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x29
Data Length: 1 byte - 0x01 (1 byte)
Data: 1 byte - USB connection status
0x00 USB disconnected / not connected
0x01 USB connected
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
**MCU Returns **
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x29
Data Length: 1 byte - 0x00
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
=== "Function Description"
- This command is used by XU316 to report the current USB connection status to the MCU
- When the USB connection status changes (connect or disconnect), XU316 proactively sends this command
- The MCU can use this information to update the UI or adjust related functions
2026-05-16 17:24:34 +08:00
=== "MCU Return Example"
**Command Example **
```
55 AA 03 29 00 2B
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is an acknowledgment returned by MCU to XU316 |
| Command | 1 byte | `29` | Acknowledges “Report USB Connection Status” |
| Data Length | 1 byte | `00` | Pure acknowledgment frame with no data |
| Checksum | 1 byte | `2B` | Sum of all bytes from `55` to `00` , modulo 256 |
2026-06-06 11:17:45 +08:00
#### 3.3.11 Set Mute Pin Inversion (0x30)
=== "Command Format"
**MCU Sends **
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0x30
Data Length: 1 byte - 0x01
Data: 1 byte
B0: Inversion flag
0x00 = Normal logic (High level unmute, Low level mute)
0x01 = Inverted logic (Low level unmute, High level mute)
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
**XU316 Returns **
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0x30
Data Length: 1 byte - 0x01
Data: 1 byte
B0: Current inversion flag status
0x00 = Normal logic
0x01 = Inverted logic
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
=== "Function Description"
1. This command is used to set inversion logic for the Mute pin output
2. Use this command when certain hardware designs have opposite Mute polarity from default
3. The configuration is automatically saved to Flash and persists after power-off
4. Takes effect immediately and returns current status
=== "Use Cases"
- Mute pin polarity is opposite to default in hardware design
- Need to adapt different hardware revisions of devices
=== "MCU Example"
**Command Example **
```
55 AA 03 30 01 01 34
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header |
| Version | 1 byte | `03` | Sent by MCU to XU316 |
| Command | 1 byte | `30` | Set Mute pin inversion |
| Data Length | 1 byte | `01` | 1 data byte follows |
| Inversion flag | 1 byte | `01` | 0x01 = inverted logic |
| Checksum | 1 byte | `34` | Sum of all bytes from `55` to inversion flag, modulo 256 |
#### 3.3.12 Get Firmware Version Command (0xF1)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2025-10-10 10:09:04 +08:00
**MCU Sends **
2025-06-14 13:50:28 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0xF1
Data Length: 1 byte - 2
Data: 2 bytes -
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-06-14 13:50:28 +08:00
```
2025-10-10 10:09:04 +08:00
**XU316 Returns **
2025-06-14 13:50:28 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0xF1
Data Length: 1 byte - 0
2026-06-06 11:17:45 +08:00
Data: 3 bytes
2025-12-31 18:12:27 +08:00
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-06-14 13:50:28 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-10-10 10:09:04 +08:00
- Get firmware version
2026-06-06 11:17:45 +08:00
=== "MCU Sends Example"
**Command Example **
```
55 AA 03 F1 02 00 00 F5
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is a command sent by MCU to XU316 |
| Command | 1 byte | `F1` | Current command is “Get Firmware Version Command” |
| Data Length | 1 byte | `02` | Two data bytes follow |
| Data | 2 bytes | `00 00` | Reserved bytes, set to `00` as placeholder in this example |
| Checksum | 1 byte | `F5` | Sum of all bytes from `55` to the last data byte, modulo 256 |
2025-06-14 13:50:28 +08:00
2025-07-28 15:13:49 +08:00
### 3.4 DAC Configuration Selection (0xF0)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
**MCU Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0xF0
Data Length: 1 byte - 4
Data: 4 bytes
Byte 0: 0: Enable I2C DAC configuration 1: Disable I2C DAC configuration
Byte 1 - 3: reserved
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**XU316 Returns **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0xF0
Data Length: 1 byte - 0
Data: 0 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- Test command for MCU to set DAC configuration selection in XU316. Let XU316 configure DAC via DAC I2C or MCU configure DAC itself
- This command is product-specific and not supported by all products. Please refer to product specification for support details.
2025-05-14 15:25:41 +08:00
2026-06-06 11:17:45 +08:00
=== "MCU Sends Example"
**Command Example **
```
55 AA 03 F0 04 00 00 00 00 F6
```
**Field Breakdown **
| Byte Segment | Length | Example | Description |
|:-------|:-----|:-------|:-----|
| Frame Header | 2 bytes | `55 AA` | Fixed frame header indicating start of a protocol frame |
| Version | 1 byte | `03` | Indicates this frame is a command sent by MCU to XU316 |
| Command | 1 byte | `F0` | Current command is “DAC Configuration Selection Command” |
| Data Length | 1 byte | `04` | 4 data bytes follow |
| Byte 0 | 1 byte | `00` | Enable XU316 to configure DAC via I2C |
| Byte 1-3 | 3 bytes | `00 00 00` | Reserved bytes, all set to `00` in this example |
| Checksum | 1 byte | `F6` | Sum of all bytes from `55` to the last data byte, modulo 256 |
2025-12-31 18:12:27 +08:00
### 3.5 HID and MCU Data Passthrough Commands via XU316
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
#### 3.5.1 HID Passthrough Data to MCU via XU316 (0xEE)
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Command Format"
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**XU316 Sends **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Command: 1 byte - 0xEE
Data Length: 1 byte - 0x39 (57 bytes), due to HID protocol limitation, data length must be 57 bytes
Data: 57 bytes - Due to HID protocol limitation, must be 57 bytes passthrough data
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
**MCU Returns (can return multiple frames) **
2025-05-14 15:25:41 +08:00
```
2025-12-31 18:12:27 +08:00
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Command: 1 byte - 0xEE
Data Length: 1 byte - 0x39 (57 bytes), due to HID protocol limitation, data length must be 57 bytes
Data: 57 bytes - Due to HID protocol limitation, must be 57 bytes passthrough data
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
2025-05-14 15:25:41 +08:00
```
2025-07-28 15:13:49 +08:00
=== "Function Description"
2025-12-31 18:12:27 +08:00
- This command is used for HID-initiated passthrough data to MCU via XU316
- Generally passthrough data is MCU OTA data or MCU data reply to HID
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
## 4. Data Structure Definitions :material-database:
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
### 4.1 Product Configuration Data Structures
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
=== "1. Product Basic Info"
2025-12-31 18:12:27 +08:00
| Field | Byte Count | Description |
2025-05-14 15:25:41 +08:00
|--------------------|--------|---------------------------------------------------------|
| **VID1 ** | 2 | USB Vendor ID (UAC1.0) |
| **PID1 ** | 2 | USB Product ID (UAC1.0) |
| **VID2 ** | 2 | USB Vendor ID (UAC2.0) |
| **PID2 ** | 2 | USB Product ID (UAC2.0) |
2025-12-31 18:12:27 +08:00
| **ManufactureName ** | 16 | USB Manufacture Name (string, max 16 bytes) |
2025-07-28 15:13:49 +08:00
| **ProductName ** | 16 | USB Product Name (string, max 16 bytes) |
| **SerialNumber ** | 16 | Product Serial Number (string, max 16 bytes) |
2025-12-31 18:12:27 +08:00
| **CRC ** | 4 | 32-bit CRC checksum calculated for all fields |
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
!!! tip "CRC Usage Notes"
MCU can determine if product basic info needs updating based on CRC value returned by XU316. When CRC mismatch occurs, should send complete product basic info.
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
=== "2. Power-On Config Info"
2025-12-31 18:12:27 +08:00
| Field | Byte Count | Description |
2025-05-14 15:25:41 +08:00
|-------------------------|--------|-----------------------------------------------|
2025-12-31 18:12:27 +08:00
| **Default input/output mode ** | 5 | See input/output mode field description |
| **Mute time ** | 2 | 0-65535 (ms) |
| **Microphone default volume ** | 1 | See microphone volume field description |
| **DAC left channel default volume ** | 1 | See DAC volume field description |
| **DAC right channel default volume ** | 1 | See DAC volume field description |
| **CRC ** | 4 | 32-bit CRC checksum calculated for all fields |
2025-07-28 15:13:49 +08:00
=== "3. Application Runtime Parameters"
2025-12-31 18:12:27 +08:00
| Field | Byte Count | Description |
2025-05-14 15:25:41 +08:00
|-------------------------|--------|-----------------------------------------------|
2025-12-31 18:12:27 +08:00
| **Input/output mode ** | 5 | See input/output mode field description |
| **Mute time ** | 2 | 0-65535 (ms) |
| **Microphone volume ** | 1 | See microphone volume field description |
| **DAC left channel volume ** | 1 | See DAC volume field description |
| **DAC right channel volume ** | 1 | See DAC volume field description |
| **CRC ** | 4 | 32-bit CRC checksum calculated for all fields |
2025-07-28 15:13:49 +08:00
2025-10-10 10:09:04 +08:00
=== "4. User Config Parameters"
2025-12-31 18:12:27 +08:00
| Field | Byte Count | Description |
2025-05-14 15:25:41 +08:00
|-------------------------|--------|-----------------------------------------------|
2025-12-31 18:12:27 +08:00
| **Input/output mode ** | 5 | See input/output mode field description |
| **Mute time ** | 2 | 0-65535 (ms) |
| **Microphone volume ** | 1 | See microphone volume field description |
| **DAC left channel volume ** | 1 | See DAC volume field description |
| **DAC right channel volume ** | 1 | See DAC volume field description |
| **CRC ** | 4 | 32-bit CRC checksum calculated for all fields |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
### 4.2 Input/Output Mode Data Format
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
=== "Bit Field Definitions"
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
| Byte | Function Description |
2025-05-14 15:25:41 +08:00
|-----|-----------------------------------------------|
2025-12-31 18:12:27 +08:00
| BYTE 0-BYTE4 | Specific value definitions refer to product specification |
2025-05-14 15:25:41 +08:00
2025-12-31 18:12:27 +08:00
### 4.3 Control Parameter Data Formats
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Restart Reason"
| Value | Description |
2025-05-14 15:25:41 +08:00
|-------|-------------------------------|
2025-10-10 10:09:04 +08:00
| 0x00 | Power-on restart |
2025-07-28 15:13:49 +08:00
| 0x01 | Mode switch restart |
| 0xFF | Other reason restart |
2025-05-14 15:25:41 +08:00
2025-10-10 10:09:04 +08:00
=== "Power-On Mode"
2025-07-28 15:13:49 +08:00
| Value | Description |
2025-05-14 15:25:41 +08:00
|-------|------------------------------------------------------------|
2025-10-10 10:09:04 +08:00
| 0x00 | Default mode, use power-on config info parameters at startup |
| 0x01 | Power-off memory mode, use user config parameters from MCU at startup |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Volume Control Parameters"
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**Microphone Volume **
2025-10-10 10:09:04 +08:00
2025-07-28 15:13:49 +08:00
| Value | Description |
2025-05-14 15:25:41 +08:00
|-------|----------------------------------------|
2025-07-28 15:13:49 +08:00
| 0xFF | Mute |
| 0x00-0xFE | Volume value, specific mapping defined by application |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
**DAC Volume **
2025-10-10 10:09:04 +08:00
2025-07-28 15:13:49 +08:00
| Value | Description |
2025-05-14 15:25:41 +08:00
|-------|----------------------------------------|
2025-07-28 15:13:49 +08:00
| 0x00 | Mute |
| 0x01-0xFF | Volume value, specific mapping defined by application |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Audio Stream Format"
2026-03-09 16:50:37 +08:00
| Value | Format | Sample Rate |
2025-05-14 15:25:41 +08:00
|-------|-------------------|-----------------|
2026-03-09 16:50:37 +08:00
| 0x00 | AUDIO_44100 | 44.1kHz |
| 0x01 | AUDIO_48000 | 48kHz |
| 0x02 | AUDIO_88200 | 88.2kHz |
| 0x03 | AUDIO_96000 | 96kHz |
| 0x04 | AUDIO_176400 | 176.4kHz |
| 0x05 | AUDIO_192000 | 192kHz |
| 0x06 | AUDIO_352800 | 352.8kHz |
| 0x07 | AUDIO_384000 | 384kHz |
| 0x08 | AUDIO_705600 | 705.6kHz |
| 0x09 | AUDIO_768000 | 768kHz |
| 0x0A | AUDIO_1441200 | 1.4112MHz |
| 0x0B | AUDIO_1536000 | 1.536MHz |
| 0x0C | AUDIO_32000 | 32kHz |
| 0x0D | AUDIO_64000 | 64kHz |
| 0x0E | AUDIO_128000 | 128kHz |
| 0x0F | AUDIO_256000 | 256kHz |
| 0x10 | AUDIO_512000 | 512kHz |
2025-05-14 15:25:41 +08:00
| 0x11 | AUDIO_DSD_64 | DSD64 |
| 0x12 | AUDIO_DSD_128 | DSD128 |
| 0x13 | AUDIO_DSD_256 | DSD256 |
| 0x14 | AUDIO_DSD_512 | DSD512 |
| 0x15 | AUDIO_DSD_1024 | DSD1024 |
2025-07-28 15:13:49 +08:00
| 0xFF | AUDIO_NO_USED | Not used |
2025-05-14 15:25:41 +08:00
2025-07-28 15:13:49 +08:00
=== "Audio Type"
| Value | Type | Description |
2025-05-14 15:25:41 +08:00
|-------|-------------------|-----------------|
2025-07-28 15:13:49 +08:00
| 0x00 | PCM | Standard PCM audio |
| 0x01 | DoP | Reserved |
| 0x02 | MQA | MQA encoded audio |
| 0x03 | MQB | MQB encoded audio |
2025-12-31 18:12:27 +08:00
| 0x04 | MQA_Studio | MQA Studio encoding |
2025-07-28 15:13:49 +08:00
| 0x05 | DSD Native | DSD encoded audio |
2025-05-14 15:25:41 +08:00
2025-09-17 11:17:39 +08:00
2025-12-31 18:12:27 +08:00
## 5. Consultation and Feedback
2025-09-17 11:17:39 +08:00
<details>
2025-10-10 10:09:04 +08:00
<summary>Click to expand consultation and feedback form</summary>
2025-09-17 11:17:39 +08:00
--8<-- "common/customer_form.md"
</details>