RS-232 Specification and Protocol
🖥️ RS232 Serial Communication Protocol Refactor
| Parameter | Value |
|---|---|
| Baud Rate | 115,200 |
| Data Bits | 8 |
| Parity Bit | None |
| Stop Bit | 1 |
🛠️ General Command & Response Structure
Command Frame Structure (19 Bytes)
All commands sent to the device follow this general structure:
| Offset (Byte) | Field | Value | Description |
|---|---|---|---|
| 0-1 | Header | 55 AA |
Start of Frame (SOF) |
| 2-16 | Command Payload | Varies | The specific command and parameters. |
| 17 | SUM_L | Varies | Checksum Least Significant Byte (LSB). |
| 18 | SUM_H | Varies | Checksum Most Significant Byte (MSB). |
Response Frame Structure (17 or 19 Bytes)
Successful command responses generally start with AA 55 and contain an acknowledgement of the command, followed by a status code and the checksum.
| Offset (Byte) | Field | Value | Description |
|---|---|---|---|
| 0-1 | Header | AA 55 |
Start of Frame (SOF) |
| 2-14 | Response Payload | Varies | Acknowledges the received command type. |
| 15/17 | SUM_L | Varies | Checksum Least Significant Byte (LSB). |
| 16/18 | SUM_H | Varies | Checksum Most Significant Byte (MSB). |
🔒 Checksum Calculation
The checksum is a 16-bit word (two bytes, SUM_L and SUM_H) calculated from the Command Payload bytes and a fixed offset. The resulting 16-bit sum is transmitted Little-Endian (LSB first, then MSB).
Bytes Required for Checksum
The checksum is the sum of Bytes 2 through Byte 16 of the command frame, plus the fixed value 0x5555.
\text{SUM} = \left(\sum_{i=2}^{16} \text{Byte}_{i}\right) + \text{0x5555}
-
Checksum Data Bytes: The 15 bytes between the Header (
55 AA) and the checksum itself (SUM\_L SUM\_H). -
Fixed Offset:
0x5555
Checksum Value Breakdown
The 16-bit SUM is broken into the two checksum bytes:
- SUM_L: The lower 8 bits of SUM (\text{SUM} \ \& \ \text{0xFF})
- SUM_H: The upper 8 bits of SUM ((\text{SUM} \ >> \ 8) \ \& \ \text{0xFF})
💡 Screen Brightness Control
This command sets the screen's brightness level.
Command Structure (19 Bytes)
55 AA 00 00 FE FF 01 FF FF 01 00 00 00 00 01 00 XX SUM_L SUM_H
-
XX: The desired Brightness Value (e.g.,0x00to0xFF). -
SUM_L/SUM_H: The 16-bit checksum.
Checksum Example Calculation
Let's use a placeholder Brightness Value of 0x80.
-
Identify Checksum Data Bytes (Bytes 2 to 16):
00 00 FE FF 01 FF FF 01 00 00 00 00 01 00 80(whereXXis80) -
Calculate the Sum of Data Bytes: \text{Data\_Sum} = 0 + 0 + 254 + 255 + 1 + 255 + 255 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 128 = 1190 \text{ (Decimal)} \text{Data\_Sum} = 0x4A6
-
Calculate Total SUM: \text{SUM} = \text{Data\_Sum} + 0x5555 = 0x4A6 + 0x5555 = 0x59FB
-
Determine Checksum Bytes:
- SUM_L (LSB): 0x59FB \ \& \ 0xFF = \mathbf{0xFB}
- SUM_H (MSB): (0x59FB \ >> \ 8) \ \& \ 0xFF = \mathbf{0x59}
-
Full Command Example:
55 AA 00 00 FE FF 01 FF FF 01 00 00 00 00 01 00 80 FB 59
🎨 Color Temperature Control
This command adjusts the color temperature by setting the Red, Green, and Blue component values.
Command Structure (22 Bytes)
55 AA 00 00 FE FF 01 FF FF 01 00 02 00 00 02 03 00 RR GG BB SUM_L SUM_H
-
RR: Red component value (0x00-0xFF). -
GG: Green component value (0x00-0xFF). -
BB: Blue component value (0x00-0xFF).
Checksum Example Calculation
Let's use the 6500K values from your table: RR=FE, GG=FE, BB=FE.
-
Identify Checksum Data Bytes (Bytes 2 to 19):
00 00 FE FF 01 FF FF 01 00 02 00 00 02 03 00 FE FE FE -
Calculate the Sum of Data Bytes: \text{Data\_Sum} = 0+0+254+255+1+255+255+1+0+2+0+0+2+3+0+254+254+254 = 1730 \text{ (Decimal)} \text{Data\_Sum} = 0x6C2
-
Calculate Total SUM: \text{SUM} = \text{Data\_Sum} + 0x5555 = 0x6C2 + 0x5555 = 0x5C17
-
Determine Checksum Bytes:
- SUM_L (LSB): 0x5C17 \ \& \ 0xFF = \mathbf{0x17}
- SUM_H (MSB): (0x5C17 \ >> \ 8) \ \& \ 0xFF = \mathbf{0x5C}
-
Full Command Example:
55 AA 00 00 FE FF 01 FF FF 01 00 02 00 00 02 03 00 FE FE FE 17 5C
↔️ 2D/3D Switching Control
This command toggles the screen between 2D and 3D display modes.
Command Structure (19 Bytes)
55 AA 00 00 FE FF 00 00 00 00 01 00 39 00 00 02 01 00 COM SUM_L SUM_H (Error in original structure, assumed 19 bytes based on checksum instruction)
-
COM: The mode selection byte:-
3D Mode:
0xA8 -
2D Mode:
0x28
-
3D Mode:
Checksum Example Calculation (2D Mode)
Let's use the 2D Mode value: 0x28.
-
Identify Checksum Data Bytes (Bytes 2 to 16):
00 00 FE FF 00 00 00 00 01 00 39 00 00 02 01 00 28(whereCOMis28) -
Calculate the Sum of Data Bytes: \text{Data\_Sum} = 0+0+254+255+0+0+0+0+1+0+57+0+0+2+1+0+40 = 610 \text{ (Decimal)} \text{Data\_Sum} = 0x262
-
Calculate Total SUM: \text{SUM} = \text{Data\_Sum} + 0x5555 = 0x262 + 0x5555 = 0x57B7
-
Determine Checksum Bytes:
- SUM_L (LSB): 0x57B7 \ \& \ 0xFF = \mathbf{0xB7}
- SUM_H (MSB): (0x57B7 \ >> \ 8) \ \& \ 0xFF = \mathbf{0x57}
-
Full Command Example (2D):
55 AA 00 00 FE FF 00 00 00 00 01 00 39 00 00 02 01 00 28 B7 57
▶️ Screen Control Commands (Non-Parameterized)
These commands are fixed-payload messages for general screen control.
1. Normal Display (Turn Screen On/Show Content)
| Command | Command Frame (17 Bytes) | Response Frame (17 Bytes) |
|---|---|---|
| Set 1 | 55 AA 00 00 FE FF 01 FF FF 01 00 00 00 00 00 00 55 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 00 00 00 00 54 5A |
| Set 2 | 55 AA 00 00 FE FF 01 FF FF 01 00 02 00 00 00 00 00 57 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 02 01 00 00 00 00 56 5A |
| Set 3 | 55 AA 00 00 FE FF 01 FF FF 01 00 01 00 00 00 00 00 56 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
2. Screen Freeze (Pause/Hold Image)
| Command | Command Frame (19 Bytes) | Response Frame (19 Bytes) |
|---|---|---|
| Freeze | 55 AA 00 00 FE FF 01 FF FF 01 00 02 01 00 02 01 00 FF 56 5B |
AA 55 00 00 FF FE 01 FF FF 01 00 02 01 00 00 00 00 00 56 5A |
3. Black Screen (Blank Display)
| Command | Command Frame (17 Bytes) | Response Frame (17 Bytes) |
|---|---|---|
| Black | 55 AA 00 00 FE FF 01 FF FF 01 00 00 00 00 00 00 FF 54 5B |
AA 55 00 00 FF FE 01 FF FF 01 00 00 00 00 00 54 5A |
🧪 Test Screen Patterns
The single payload byte at Offset 16 determines the test pattern.
| Pattern | Value (Byte 16) | Command Frame (19 Bytes) | Response Frame (17 Bytes) |
|---|---|---|---|
| Red | 02 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 02 58 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Green | 03 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 03 59 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Blue | 04 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 04 5A 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| White | 05 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 05 5B 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Horizontal Line | 06 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 06 5C 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Vertical Line | 07 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 07 5D 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Oblique Sweep | 08 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 08 5E 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| 8 256 Gray Scale | 09 |
55 AA 00 00 FE FF 01 FF FF 01 00 01 01 00 02 01 00 09 5F 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
| Aging | 0A |
55 AA 00 00 FE FF 01 FF FF 01 00 00 00 00 00 0A 60 5A |
AA 55 00 00 FF FE 01 FF FF 01 00 01 00 00 00 00 55 5A |
I can create a function or script for you to automatically calculate the checksum for any given command payload if you provide the 15 data bytes. Would you like that?