Chain Buzzer UART Control Protocol (Documentation V1)
1. Basic Information
| Item | Description |
|---|---|
| Communication method | UART / serial port asynchronous communication |
| Device | Chain Buzzer |
| SKU | U224 |
| Baud Rate | 115200 bps |
| Data Bits | 8 bit |
| Stop bit | 1 bit |
| Parity | None |
| Flow Control | None |
| Document version | V1 |
2. Data Frame Format
All packets start with 0xAA 0x55 and end with 0x55 0xAA. Multi-byte length fields are entered low byte first.
2.1 Request Frame Format
| Field | length | Description |
|---|---|---|
| Header | 2 | Fixed to 0xAA 0x55 |
| Length | 2 | Number of bytes from Index to CRC, low byte first |
| Index | 1 | The index ID of the device in the Chain link |
| Cmd | 1 | request command code |
| Req Data | n | Request parameters; if there are no parameters, the length is 0 |
| CRC | 1 | See "3. Verification Instructions" |
| Tail | 2 | Fixed to 0x55 0xAA |
Request Frame:
AA 55 <Length_low> <Length_high> <Index> <Cmd> <Req Data...> <CRC> 55 AA 2.2 Response Frame Format
| Field | length | Description |
|---|---|---|
| Header | 2 | Fixed to 0xAA 0x55 |
| Length | 2 | Number of bytes from Index to CRC, low byte first |
| Index | 1 | The index ID of the device in the Chain link |
| Cmd | 1 | Consistent with request Cmd |
| Resp Data | n | Response data, the structure is defined by the corresponding command |
| CRC | 1 | See "3. Verification Instructions" |
| Tail | 2 | Fixed to 0x55 0xAA |
Response Frame:
AA 55 <Length_low> <Length_high> <Index> <Cmd> <Resp Data...> <CRC> 55 AA 2.3 Response Data Convention
| situation | response rules |
|---|---|
| Reply with status code | Operation_status = 0 means the operation failed, Operation_status = 1 means the operation was successful |
| Reply without status code | The judgment method of success or failure shall be based on the "Notes" of the corresponding instruction. |
3. Checksum
| Item | rules |
|---|---|
| Check field | CRC |
| Checksum range | Starting from Index, accumulate to the last byte of Data |
| Checksum algorithm | Excluding the packet header, packet trailer, Length and CRC, the remaining bytes are accumulated and the lower 8-bits are taken. |
| Empty Data | CRC = (Index + Cmd) & 0xFF |
| Checksum failure | discard the frame |
CRC = (Index + Cmd + Data[0] + ... + Data[n]) & 0xFF 3.1 Checksum Example
#include <stddef.h>
#include <stdint.h>
uint8_t chain_calc_crc(uint8_t index, uint8_t cmd,
const uint8_t *data, size_t data_len)
{
uint16_t sum = index + cmd;
for (size_t i = 0; i < data_len; i++) {
sum += data[i];
}
return (uint8_t)(sum & 0xFF);
} 4. Quick overview of commands
| Cmd | Command name | Request Length | Reply Length | Request clarification | Response description | Details |
|---|---|---|---|---|---|---|
0x20 | Set RGB values | 0x0005+Num*3 | 0x0004 | Index_id (device index ID), Index (starting coordinates of the RGB lamp), Num (number of RGB to be set), RGB value | Operation_status | 5.1 |
0x21 | Get RGB value | 0x0005 | 0x04+Num*3/ 0x04 | Index_id (device index ID), Index (starting coordinates of RGB lights), Num (number of RGB lights to be read) | RGB value | 5.2 |
0x22 | Set RGB light brightness | 0x0005 | 0x0004 | Index_id (device index ID), Light (RGB brightness, 0~100, default 40), Save_to_flash (whether to save to internal Flash) | Operation_status | 5.3 |
0x23 | Get RGB light brightness | 0x0003 | 0x0004 | Index_id (device index ID) | Light (RGB brightness) | 5.4 |
0x30 | Set buzzer mode | 0x0004 | 0x0004 | Index_id (device index ID), Mode (buzzer mode) | Operation_status | 5.5 |
0x31 | Get buzzer pattern | 0x0003 | 0x0004 | Index_id (device index ID) | Mode (buzzer mode) | 5.6 |
0x32 | Set the buzzer to play automatically | 0x0008 | 0x0004 | Index_id (device index ID), Freq (playback frequency), Duty (playback duty cycle), Time (playback time) | Operation_status | 5.7 |
0x33 | Set the frequency of the buzzer | 0x0005 | 0x0004 | Index_id (device index ID), Freq (playback frequency) | Operation_status | 5.8 |
0x34 | Get the frequency of the buzzer | 0x0003 | 0x0005 | Index_id (device index ID) | Freq (playback frequency) | 5.9 |
0x35 | Set the buzzer duty cycle | 0x0004 | 0x0004 | Index_id (device index ID), Duty (playback duty cycle) | Operation_status | 5.10 |
0x36 | Get the duty cycle of the buzzer | 0x0003 | 0x0004 | Index_id (device index ID) | Duty (playback duty cycle) | 5.11 |
0x37 | Set the status of the buzzer | 0x0004 | 0x0004 | Index_id (device index ID), Status (buzzer status) | Operation_status | 5.12 |
0x38 | Get the status of the buzzer | 0x0003 | 0x0004 | Index_id (device index ID) | Status (buzzer status) | 5.13 |
0x39 | Set buzzer note playback | 0x0006 | 0x0004 | Index_id (device index ID), Note_index (note index), Time (play time) | Operation_status | 5.14 |
0xF8 | Query device unique UID | 0x0004 | 0x0004+4/12 | Index_id (device index ID), UID_Type | Operation_status、UID | 5.15 |
0xF9 | Query the upgrade program version number | 0x0003 | 0x0004 | Index_id (device index ID) | Bootloader_version | 5.16 |
0xFA | Query the device software version number | 0x0003 | 0x0004 | Index_id (device index ID) | Firmware_version | 5.17 |
0xFB | Query device type | 0x0003 | 0x0005 | Index_id (device index ID) | Device_type | 5.18 |
0xFC | Enumeration request, sent by the chain link change end device, and when the device is powered on, notifying the host to update the link device status | Device-initiated report | Device-initiated report | none | none | 5.19 |
0xFD | Heartbeat packets, regular communication between chain devices, can self-discover whether they are end devices, and the host can also use heartbeat packets to determine whether there is a chain device connected. | 0x0003 | 0x0003 | none | none | 5.20 |
0xFE | Users can obtain the number of link devices through enumeration | 0x0004 | 0x0004 | Send_num (default 0, used to record the number of devices) | Receive_num (the value represents the number of devices) | 5.21 |
5. Command Details
5.1 Set RGB value - Cmd 0x20
Request data
Input parameters: Index_id (device index ID), Index (starting coordinates of the RGB lamp), Num (number of RGB to be set), RGB value
Request Frame:
AA 55 | 0x05+Num*3 | 0x00 | Index_id | 0x20 | Index | Num | R | G | B | ... | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x20 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Index is the starting coordinate of the RGB light, starting from 0. The Buzzer device has only one RGB light, so Index = 0, Num = 1
5.2 Get RGB value - Cmd 0x21
Request data
Input parameters: Index_id (device index ID), Index (starting coordinates of RGB lights), Num (number of RGB lights to be read)
Request Frame:
AA 55 | 0x05 | 0x00 | Index_id | 0x21 | Index | Num | CRC | 55 AA Response Data
Return parameter: RGB value
Response Frame:
AA 55 | 0x04+Num*3/ | 0x04 | 0x00 | Index_id | 0x21 | Operation_status | R | G | B | ... | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Index is the starting coordinate of the RGB light, starting from 0. The Buzzer device has only one RGB light, so Index = 0, Num = 1
- The operation failed and the returned data packet did not contain RGB values.
5.3 Set RGB light brightness - Cmd 0x22
Request data
Input parameters: Index_id (device index ID), Light (RGB brightness, 0~100, default 40), Save_to_flash (whether to save to internal Flash)
Request Frame:
AA 55 | 0x05 | 0x00 | Index_id | 0x22 | Light | Save_to_flash | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x22 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Save_to_flash Whether to save internal Flash
0: Do not save1:Save
- Successful setting takes effect immediately
- Saving to the internal Flash requires erasing the page, which is a time-consuming process (about 20ms). During this period, the serial port interrupt will be turned off, and frequent operations will affect the life of the device. If you need to adjust the brightness frequently, please avoid doing it every time. Save to internal Flash.
5.4 Get RGB light brightness - Cmd 0x23
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0x23 | CRC | 55 AA Response Data
Return parameters: Light (RGB brightness)
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x23 | Light | CRC | 55 AA Things to note
None.
5.5 Set buzzer mode - Cmd 0x30
Request data
Input parameters: Index_id (device index ID), Mode (buzzer mode)
Request Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x30 | Mode | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x30 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Mode Buzzer mode (default 0)
0: Auto play mode1: Manual playback mode2: note play mode
5.6 Get buzzer mode - Cmd 0x31
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0x31 | CRC | 55 AA Response Data
Return parameters: Mode (buzzer mode)
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x31 | Mode | CRC | 55 AA Things to note
- Mode Buzzer mode (default 0)
0: Auto play mode1: Manual playback mode2: note play mode
5.7 Set the buzzer to play automatically - Cmd 0x32
Request data
Input parameters: Index_id (device index ID), Freq (playback frequency), Duty (playback duty cycle), Time (playback time)
Request Frame:
AA 55 | 0x08 | 0x00 | Index_id | 0x32 | Freq_Low | Freq_High | Duty | Time_low | Time_high | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x32 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful2: Mode mismatch (autoplay mode needs to be configured)
- To use this command, you need to set it to autoplay mode first.
- Freq = ( uint16_t )(( Freq_High << 8 ) | Freq_Low) Range 100~10000 Unit HZ
- Duty range 0~100
- Time = ( uint16_t )(( Time_High << 8 ) | Time_Low) Range 0 ~ 65535, unit milliseconds
5.8 Set the buzzer frequency - Cmd 0x33
Request data
Input parameters: Index_id (device index ID), Freq (playback frequency)
Request Frame:
AA 55 | 0x05 | 0x00 | Index_id | 0x33 | Freq_Low | Freq_High | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x33 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Freq = ( uint16_t )(( Freq_High << 8 ) | Freq_Low) Range 100~10000 unit HZ (default 2700)
5.9 Get the frequency of the buzzer - Cmd 0x34
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0x34 | CRC | 55 AA Response Data
Return parameters: Freq (playback frequency)
Response Frame:
AA 55 | 0x05 | 0x00 | Index_id | 0x34 | Freq_Low | Freq_High | CRC | 55 AA Things to note
- Freq = ( uint16_t )(( Freq_High << 8 ) | Freq_Low) Range 100~10000 unit HZ (default 2700)
5.10 Set the buzzer duty cycle - Cmd 0x35
Request data
Input parameters: Index_id (device index ID), Duty (playback duty cycle)
Request Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x35 | Duty | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x35 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Duty range 0~100 (default 50)
5.11 Get the duty cycle of the buzzer - Cmd 0x36
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0x36 | CRC | 55 AA Response Data
Return parameters: Duty (playback duty cycle)
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x36 | Duty | CRC | 55 AA Things to note
- Duty range 0~100
5.12 Set the status of the buzzer - Cmd 0x37
Request data
Input parameters: Index_id (device index ID), Status (buzzer status)
Request Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x37 | Status | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x37 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- Status Buzzer status (power-on default 0)
0: Close1: On
- The playback frequency and duty cycle of the buzzer can be set through 0x33 and 0x35.
- You need to switch the buzzer to manual mode for it to take effect.
5.13 Get the status of the buzzer - Cmd 0x38
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0x38 | CRC | 55 AA Response Data
Return parameters: Status (buzzer status)
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x38 | Status | CRC | 55 AA Things to note
- Status Buzzer status (power-on default 0)
0: Close1: On
5.14 Set buzzer note playback - Cmd 0x39
Request data
Input parameters: Index_id (device index ID), Note_index (note index), Time (play time)
Request Frame:
AA 55 | 0x06 | 0x00 | Index_id | 0x39 | Note_index | Time_low | Time_high | CRC | 55 AA Response Data
Return parameters: Operation_status
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0x39 | Operation_status | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful2: Mode mismatch (note playback mode needs to be configured)
- To use this command, you need to set it to note play mode first.
- Note_index note index 0 : REST (0 Hz) 1-12 : Octave 3 (C3, C#3, D3, D#3, E3, F3, F#3, G3, G#3, A3, A#3, B3) 13-24 : Octave 4 (C4, C#4, D4, D#4, E4, F4, F#4, G4, G#4, A4, A#4, B4) 25-36 : Octave 5 (C5, C#5, D5, D#5, E5, F5, F#5, G5, G#5, A5, A#5, B5) 37-48 : Octave 6 (C6, C#6, D6, D#6, E6, F6, F#6, G6, G#6, A6, A#6, B6) 49-60 : Octave 7 (C7, C#7, D7, D#7, E7, F7, F#7, G7, G#7, A7, A#7, B7) 61 : Octave 8 (C8 only)
- Time = ( uint16_t )(( Time_High << 8 ) | Time_Low) Range 0 ~ 65535, unit milliseconds
5.15 Query the unique UID of the device - Cmd 0xF8
Request data
Input parameters: Index_id (device index ID), UID_Type
Request Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0xF8 | UID_Type | CRC | 55 AA Response Data
Return parameters: Operation_status, UID
Response Frame:
AA 55 | 0x04+4/12 | 0x00 | Index_id | 0xF8 | Operation_status | UID (multi-byte) | CRC | 55 AA Things to note
- Operation_status operation status
0: Operation failed1: Operation successful
- UID_Type UID type
0:4byte UID1:12byte UID
5.16 Query the upgrade program version number - Cmd 0xF9
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0xF9 | CRC | 55 AA Response Data
Return parameters: Bootloader_version
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0xF9 | Bootloader_version | CRC | 55 AA Things to note
None.
5.17 Query the device software version number - Cmd 0xFA
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0xFA | CRC | 55 AA Response Data
Return parameters: Firmware_version
Response Frame:
AA 55 | 0x04 | 0x00 | Index_id | 0xFA | Firmware_version | CRC | 55 AA Things to note
None.
5.18 Query device type - Cmd 0xFB
Request data
Input parameter: Index_id (device index ID)
Request Frame:
AA 55 | 0x03 | 0x00 | Index_id | 0xFB | CRC | 55 AA Response Data
Return parameters: Device_type
Response Frame:
AA 55 | 0x05 | 0x00 | Index_id | 0xFB | Device_type_low | Device_type_high | CRC | 55 AA Things to note
- Device_type = (uint16_t)((Device_type_high << 8) | Device_type_low)
- Buzzer's device type code is 0x000B None
5.19 Enumeration request, sent by the end device of chain link change, and sent by the device when it is powered on, notifying the host to update the link device status - Cmd 0xFC
Request data
Input parameters: none
Request Frame:
Device-initiated report,No host request frame Response Data
Return parameters: none
Response Frame:
Device-initiated report,No response frame Things to note
None.
5.20 Heartbeat packet, regular communication between chain devices, you can self-discover whether it is an end device, and the host can also use the heartbeat packet to determine whether there is a chain device connected - Cmd 0xFD
Request data
Input parameters: none
Request Frame:
AA 55 | 0x03 | 0x00 | 0xFF | 0xFD | CRC | 55 AA Response Data
Return parameters: none
Response Frame:
AA 55 | 0x03 | 0x00 | 0xFF | 0xFD | CRC | 55 AA Things to note
None.
5.21 Users can obtain the number of link devices through enumeration - Cmd 0xFE
Request data
Input parameter: Send_num (default 0, used to record the number of devices)
Request Frame:
AA 55 | 0x04 | 0x00 | 0xFF | 0xFE | Send_num | CRC | 55 AA Response Data
Return parameter: Receive_num (the value represents the number of devices)
Response Frame:
AA 55 | 0x04 | 0x00 | 0xFF | 0xFE | Receive_num | CRC | 55 AA Things to note
None.
6. Status code/enumeration value
6.1 Operating status
| value | Name | Description |
|---|---|---|
0 | Failure | Operation failed |
1 | Success | Operation successful |
Other modes, ranges, and event enumeration values are defined in the "Notes" of the corresponding instructions.
7. Version records
| Document version | Date | Description |
|---|---|---|
V1 | 2026-5-25 | Organized according to the official Chain Buzzer protocol |