This commit is contained in:
PhatenIoT-yan
2026-05-16 17:24:34 +08:00
parent fd63e5e4ec
commit 70e26b1827
18 changed files with 1880 additions and 2102 deletions

View File

@@ -225,6 +225,8 @@ sequenceDiagram
| 0x24 | XU316 send playback volume | XU316→MCU |
| 0x25 | Send recording volume | XU316→MCU |
| 0x26 | Switch MCLK | MCU→XU316 |
| 0x27 | Set unmute | MCU→XU316 |
| 0x28 | Send audio format time delay | MCU→XU316 |
| 0x29 | Report USB connection status | XU316→MCU |
=== "HID-MCU Passthrough Commands (0xEE-0xEF)"
@@ -237,6 +239,7 @@ sequenceDiagram
| Command | Command Description | Direction |
|:--------:|:---------------------------------------------|:----------:|
| 0xF0 | DAC configuration selection command | MCU→XU316 |
| 0xF1 | Get firmware version command | MCU→XU316 |
!!! note "Command Usage Instructions"
1. All commands must follow basic frame format specification
@@ -307,6 +310,24 @@ sequenceDiagram
* Restart reason field can be used by MCU to identify specific reason for XU316 restart for different handling
* When multiple info items need updating, MCU can combine multiple options through bit operations
=== "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 |
#### 3.2.2 Read Product Info (0x01)
=== "Command Format"
@@ -348,6 +369,31 @@ sequenceDiagram
CRC: 4 bytes (32-bit CRC checksum)
```
=== "MCU Return Example"
**Command Example**
```
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 12 34 56 78 D9
```
**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 |
| CRC | 4 bytes | `12 34 56 78` | 32-bit CRC for product basic info (example only) |
| Checksum | 1 byte | `D9` | Sum of all bytes from `55` to `78`, modulo 256 |
#### 3.2.3 Read Power-On Config Info (0x02)
=== "Command Format"
@@ -387,6 +433,29 @@ sequenceDiagram
CRC: 4 bytes (32-bit CRC checksum)
```
=== "MCU Return Example"
**Command Example**
```
55 AA 03 02 0E 01 00 00 00 00 01 2C 20 30 30 11 22 33 44 6A
```
**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 |
| CRC | 4 bytes | `11 22 33 44` | 32-bit CRC for power-on config (example only) |
| Checksum | 1 byte | `6A` | Sum of all bytes from `55` to `44`, modulo 256 |
#### 3.2.4 Get Current Input/Output Mode (0x03)
=== "Command Format"
@@ -415,6 +484,24 @@ sequenceDiagram
- XU316 will load corresponding application firmware based on returned mode
- This command is used for mode matching and confirmation during device startup
=== "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 |
#### 3.2.5 Get Current User Configuration (0x04)
=== "Command Format"
@@ -443,6 +530,29 @@ sequenceDiagram
- Executed after application firmware loaded, before application startup
- Application will initialize corresponding parameters based on returned info
=== "MCU Return Example"
**Command Example**
```
55 AA 03 04 0E 02 00 00 00 00 00 C8 18 28 28 55 66 77 88 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 |
| CRC | 4 bytes | `55 66 77 88` | 32-bit CRC for user configuration (example only) |
| Checksum | 1 byte | `00` | Sum of all bytes from `55` to `88`, modulo 256 |
#### 3.2.6 Startup Complete Command (0x05)
=== "Command Format"
@@ -473,6 +583,23 @@ sequenceDiagram
- 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
=== "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 |
### 3.3 Business Control Command Details
!!! warning "Usage Prerequisites"
@@ -506,6 +633,23 @@ sequenceDiagram
- 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
=== "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 |
#### 3.3.2 Media Control (0x21)
=== "Command Format"
@@ -582,6 +726,23 @@ sequenceDiagram
- Typically sent when playback starts or format changes
- MCU can update display based on this info, such as showing PCM/DSD/MQA/DOP status
=== "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 |
#### 3.3.4 Set Input/Output Mode (0x23)
=== "Command Format"
@@ -638,6 +799,23 @@ sequenceDiagram
=== "Function Description"
- This command is used by XU316 to report current playback volume to MCU
=== "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 |
#### 3.3.6 Send Recording Volume (0x25)
@@ -666,6 +844,23 @@ sequenceDiagram
- This command is used by XU316 to report current microphone recording volume to MCU
- Reserved command, currently not used
=== "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 |
#### 3.3.7 Switch MCLK (0x26)
=== "Command Format"
@@ -776,6 +971,23 @@ sequenceDiagram
- 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
=== "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 |
#### 3.3.11 Get Firmware Version Command (0xF1)
=== "Command Format"