更新免开发协议内容,加入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

BIN
.DS_Store vendored

Binary file not shown.

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)

View File

@@ -228,6 +228,7 @@ sequenceDiagram
| 0x27 | 设置 unmute | MCU→XU316 |
| 0x28 | 发送音频格式的时间延迟 | MCU→XU316 |
| 0x29 | 报告USB连接状态 | XU316→MCU |
| 0x30 | 设置Mute引脚反转 | MCU→XU316 |
=== "HID-MCU互相透传命令(0xEE-0xEF)"
| 命令字 | 命令描述 | 发送方向 |
@@ -373,7 +374,7 @@ sequenceDiagram
**命令示例**
```
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
```
**逐段解析**
@@ -391,8 +392,8 @@ sequenceDiagram
| ManufactureName | 16字节 | `50 48 41 54 45 4E 00 00 00 00 00 00 00 00 00 00` | ASCII 字符串 `PHATEN`,后面不足 16 字节的部分用 `00` 补齐 |
| ProductName | 16字节 | `58 55 33 31 36 20 44 41 43 00 00 00 00 00 00 00` | ASCII 字符串 `XU316 DAC`,后面用 `00` 补齐到 16 字节 |
| SerialNumber | 16字节 | `53 4E 32 34 30 30 30 31 00 00 00 00 00 00 00 00` | ASCII 字符串 `SN240001`,后面用 `00` 补齐到 16 字节 |
| CRC | 4字节 | `12 34 56 78` | 产品基础信息的 32 位 CRC 校验值,这里仅作为示例演示 |
| 校验和 | 1字节 | `D9` | 从 `55` 开始到 `78` 结束,所有字节相加后对 256 取余的结果 |
| CRC | 4字节 | `27 2B F6 44` | 产品基础信息的 32 位 CRC 校验值(小端序),这里仅作为示例演示 |
| 校验和 | 1字节 | `51` | 从 `55` 开始到 `44` 结束,所有字节相加后对 256 取余的结果 |
#### 3.2.3 读取上电配置信息0x02
@@ -437,7 +438,7 @@ sequenceDiagram
**命令示例**
```
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
```
**逐段解析**
@@ -453,8 +454,8 @@ sequenceDiagram
| 麦克风默认音量 | 1字节 | `20` | 示例默认麦克风音量 |
| DAC左声道默认音量 | 1字节 | `30` | 示例默认左声道音量 |
| DAC右声道默认音量 | 1字节 | `30` | 示例默认右声道音量 |
| CRC | 4字节 | `11 22 33 44` | 上电配置的 32 位 CRC 校验值,这里仅作为示例演示 |
| 校验和 | 1字节 | `6A` | 从 `55` 开始到 `44` 结束,所有字节相加后对 256 取余的结果 |
| CRC | 4字节 | `C1 7A 1E 1A` | 上电配置的 32 位 CRC 校验值(小端序),这里仅作为示例演示 |
| 校验和 | 1字节 | `33` | 从 `55` 开始到 `1A` 结束,所有字节相加后对 256 取余的结果 |
#### 3.2.4 获取当前输入输出模式0x03
@@ -534,7 +535,7 @@ sequenceDiagram
**命令示例**
```
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
```
**逐段解析**
@@ -550,8 +551,8 @@ sequenceDiagram
| 麦克风音量 | 1字节 | `18` | 示例当前麦克风音量 |
| DAC左声道音量 | 1字节 | `28` | 示例当前左声道音量 |
| DAC右声道音量 | 1字节 | `28` | 示例当前右声道音量 |
| CRC | 4字节 | `55 66 77 88` | 用户配置的 32 位 CRC 校验值,这里仅作为示例演示 |
| 校验和 | 1字节 | `00` | 从 `55` 开始到 `88` 结束,所有字节相加后对 256 取余的结果 |
| CRC | 4字节 | `3A 8A 5B 2E` | 用户配置的 32 位 CRC 校验值(小端序),这里仅作为示例演示 |
| 校验和 | 1字节 | `93` | 从 `55` 开始到 `2E` 结束,所有字节相加后对 256 取余的结果 |
#### 3.2.6 启动完成命令0x05
@@ -700,6 +701,7 @@ sequenceDiagram
=== "MCU发送示例"
**命令示例**
```
55 AA 03 21 01 02 26
```
@@ -790,6 +792,7 @@ sequenceDiagram
=== "MCU发送示例"
**命令示例**
```
55 AA 03 23 05 02 00 00 00 00 2C
```
@@ -925,6 +928,7 @@ sequenceDiagram
=== "MCU发送示例"
**命令示例**
```
55 AA 03 26 01 01 2A
```
@@ -1039,7 +1043,64 @@ sequenceDiagram
| 数据长度 | 1字节 | `00` | 表示这是一条纯确认帧,不携带额外数据 |
| 校验和 | 1字节 | `2B` | 从 `55` 开始到 `00` 结束,所有字节相加后对 256 取余的结果 |
#### 3.3.11 获取固件版本命令0xF1
#### 3.3.11 设置Mute引脚反转0x30
=== "命令格式"
**MCU发送**
```
帧头: 2字节 - 0x55aa
版本: 1字节 - 0x03
命令字: 1字节 - 0x30
数据长度: 1字节 - 0x01
数据: 1字节
B0: 反转标志
0x00 = 正常逻辑(高电平解除静音,低电平静音)
0x01 = 反转逻辑(低电平解除静音,高电平静音)
校验和: 1字节 - 从帧头开始按字节求和结果对256求余
```
**XU316返回**
```
帧头: 2字节 - 0x55aa
版本: 1字节 - 0x00
命令字: 1字节 - 0x30
数据长度: 1字节 - 0x01
数据: 1字节
B0: 当前反转标志状态
0x00 = 正常逻辑
0x01 = 反转逻辑
校验和: 1字节 - 从帧头开始按字节求和结果对256求余
```
=== "功能说明"
1. 该命令用于设置Mute引脚的输出逻辑反转
2. 当某些硬件设计的Mute逻辑与默认相反时使用此命令进行适配
3. 配置会自动保存到Flash断电后保持
4. 设置后立即生效,并返回当前状态
=== "使用场景"
- 硬件设计中Mute脚极性与默认相反
- 需要适配不同硬件版本的设备
=== "MCU示例"
**命令示例**
```
55 AA 03 30 01 01 34
```
**逐段解析**
| 字节段 | 长度 | 示例值 | 说明 |
|:-------|:-----|:-------|:-----|
| 帧头 | 2字节 | `55 AA` | 固定帧头 |
| 版本 | 1字节 | `03` | MCU发送给XU316 |
| 命令字 | 1字节 | `30` | 设置Mute引脚反转 |
| 数据长度 | 1字节 | `01` | 1字节数据 |
| 反转标志 | 1字节 | `01` | 0x01=反转逻辑 |
| 校验和 | 1字节 | `34` | 从 `55` 开始到反转标志结束,所有字节相加后对 256 取余的结果 |
#### 3.3.12 获取固件版本命令0xF1
=== "命令格式"
**MCU发送**
@@ -1067,6 +1128,7 @@ sequenceDiagram
=== "MCU发送示例"
**命令示例**
```
55 AA 03 F1 02 00 00 F5
```
@@ -1115,6 +1177,7 @@ sequenceDiagram
=== "MCU发送示例"
**命令示例**
```
55 AA 03 F0 04 00 00 00 00 F6
```