更新免开发协议内容,加入0x30.修改其他错误
This commit is contained in:
PhatenIoT-yan
2026-06-06 11:17:45 +08:00
parent 1542d74792
commit 68212b418b
3 changed files with 223 additions and 29 deletions

View File

@@ -228,6 +228,7 @@ sequenceDiagram
| 0x27 | Set unmute | MCU→XU316 |
| 0x28 | Send audio format time delay | MCU→XU316 |
| 0x29 | Report USB connection status | XU316→MCU |
| 0x30 | Set Mute pin inversion | MCU→XU316 |
=== "HID-MCU Passthrough Commands (0xEE-0xEF)"
| Command | Command Description | Direction |
@@ -373,7 +374,7 @@ sequenceDiagram
**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
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
```
**Field Breakdown**
@@ -391,8 +392,8 @@ sequenceDiagram
| 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 |
| 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 |
#### 3.2.3 Read Power-On Config Info (0x02)
@@ -437,7 +438,7 @@ sequenceDiagram
**Command Example**
```
55 AA 03 02 0E 01 00 00 00 00 01 2C 20 30 30 11 22 33 44 6A
55 AA 03 02 0E 01 00 00 00 00 01 2C 20 30 30 C1 7A 1E 1A 33
```
**Field Breakdown**
@@ -453,8 +454,8 @@ sequenceDiagram
| 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 |
| 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 |
#### 3.2.4 Get Current Input/Output Mode (0x03)
@@ -534,7 +535,7 @@ sequenceDiagram
**Command Example**
```
55 AA 03 04 0E 02 00 00 00 00 00 C8 18 28 28 55 66 77 88 00
55 AA 03 04 0E 02 00 00 00 00 00 C8 18 28 28 3A 8A 5B 2E 93
```
**Field Breakdown**
@@ -550,8 +551,8 @@ sequenceDiagram
| 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 |
| 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 |
#### 3.2.6 Startup Complete Command (0x05)
@@ -698,6 +699,24 @@ sequenceDiagram
| 0x06 | Rewind | Rewind in current track |
| 0x07 | Mute | Toggle system mute state |
=== "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 |
#### 3.3.3 Report Playback Audio Stream Format and Type (0x22)
=== "Command Format"
@@ -771,13 +790,31 @@ sequenceDiagram
- Typically triggered by user operation, such as pressing mode selection button
- XU316 may need to restart to load new mode firmware
=== "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 |
#### 3.3.5 Send Playback Volume (0x24)
=== "Command Format"
**XU316 Returns**
**XU316 Sends**
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Version: 1 byte - 0x00
Command: 1 byte - 0x24
Data Length: 1 byte - 0x02 (2 bytes)
Data: 2 bytes
@@ -786,10 +823,10 @@ sequenceDiagram
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
**MCU Sends**
**MCU Returns**
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Version: 1 byte - 0x03
Command: 1 byte - 0x24
Data Length: 1 byte - 0x00
Data: 0 bytes
@@ -820,20 +857,20 @@ sequenceDiagram
#### 3.3.6 Send Recording Volume (0x25)
=== "Command Format"
**MCU Sends**
**XU316 Sends**
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x03
Version: 1 byte - 0x00
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
```
**XU316 Returns**
**MCU Returns**
```
Frame Header: 2 bytes - 0x55aa
Version: 1 byte - 0x00
Version: 1 byte - 0x03
Command: 1 byte - 0x25
Data Length: 1 byte - 0x00
Data: 0 bytes
@@ -988,7 +1025,64 @@ sequenceDiagram
| 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)
#### 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)
=== "Command Format"
**MCU Sends**
@@ -1007,13 +1101,31 @@ sequenceDiagram
Version: 1 byte - 0x00
Command: 1 byte - 0xF1
Data Length: 1 byte - 0
Data: 0 bytes
Data: 3 bytes
Checksum: 1 byte - Sum of all bytes from frame header, modulo 256
```
=== "Function Description"
- Get firmware version
=== "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 |
### 3.4 DAC Configuration Selection (0xF0)
@@ -1045,6 +1157,25 @@ sequenceDiagram
- 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.
=== "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 |
### 3.5 HID and MCU Data Passthrough Commands via XU316
#### 3.5.1 HID Passthrough Data to MCU via XU316 (0xEE)