English
English
简体中文
日本語
UART / Protocol reference
PDF

Unit 8Servos2-Chain UART Control Protocol (Documentation V1)


1. Basic Information

Item Description
Communication method UART / serial port asynchronous communication
Device Unit 8Servos2-Chain
SKU U223
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 sent low byte first.

The maximum packet length is 256 bytes. The Length field is the number of bytes from Index to CRC, including Index and CRC but excluding the header, the tail and the Length field itself.

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 Index ID of the device in the Chain link
Cmd 1 Request command code
Req Data n Request parameters; the length is 0 when there are no parameters
CRC 1 See "3. Checksum"
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 Index ID of the device in the Chain link
Cmd 1 Same as the request Cmd
Resp Data n Response data, whose structure is defined by the corresponding command
CRC 1 See "3. Checksum"
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
Response with a status code Operation_status = 0 means the operation failed; Operation_status = 1 means the operation succeeded
Response without a status code How success or failure is determined follows the "Notes" of the corresponding command

3. Checksum

Item rules
Check field CRC
Checksum range From Index up to the last byte of Data
Checksum algorithm Excluding the header, the tail, Length and CRC; the remaining bytes are summed and the low 8 bits are used
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
0x10 Set mode (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), Mode (mode) Operation_status 5.1
0x11 Set mode (multiple) 0x000B 0x0004 Index_id (device index ID), Mode (mode) Operation_status 5.2
0x12 Get mode (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, Mode (mode) 5.3
0x13 Get mode (multiple) 0x0003 0x000B Index_id (device index ID) Mode (mode) 5.4
0x30 Set input pull-up/pull-down (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), PU/PD (input pull-up/pull-down configuration) Operation_status 5.5
0x31 Set input pull-up/pull-down (multiple) 0x000B 0x0004 Index_id (device index ID), PU/PD (input pull-up/pull-down configuration) Operation_status 5.6
0x32 Get input pull-up/pull-down (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, PU/PD (input pull-up/pull-down configuration) 5.7
0x33 Get input pull-up/pull-down (multiple) 0x0003 0x000B Index_id (device index ID) PU/PD (input pull-up/pull-down configuration) 5.8
0x34 Get input level (single) 0x0004 0x0005/0x0004 Index_id (device index ID), GPIO (channel) Operation_status, Level (input level) 5.9
0x35 Get input level (multiple) 0x0003 0x000B Index_id (device index ID) Level (input level) 5.10
0x40 Set output level (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), Level (output level) Operation_status 5.11
0x41 Set output level (multiple) 0x000B 0x0004 Index_id (device index ID), Level (output level) Operation_status 5.12
0x42 Get output level (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, Level (output level) 5.13
0x43 Get output level (multiple) 0x0003 0x000B Index_id (device index ID) Level (output level) 5.14
0x50 Get ADC channel value (single) 0x0004 0x0004/0x0006 Index_id (device index ID), GPIO (channel) Operation_status, ADC 5.15
0x51 Get ADC channel value (multiple) 0x0003 0x0013 Index_id (device index ID) ADC 5.16
0x60 Set Angle (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), Angle (servo angle) Operation_status 5.17
0x61 Set Angle (multiple) 0x000B 0x0004 Index_id (device index ID), Angle (servo angle) Operation_status 5.18
0x62 Get Angle (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, Angle (servo angle) 5.19
0x63 Get Angle (multiple) 0x0003 0x000B Index_id (device index ID) Angle (servo angle) 5.20
0x70 Set RGB configuration (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), RGB (RGB configuration) Operation_status 5.21
0x71 Set RGB configuration (multiple) 0x000B 0x0004 Index_id (device index ID), RGB (RGB configuration) Operation_status 5.22
0x72 Get RGB configuration (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, RGB (RGB configuration) 5.23
0x73 Get RGB configuration (multiple) 0x0003 0x000B Index_id (device index ID) RGB0 ~ RGB7 (RGB configuration of each channel) 5.24
0x74 Set RGB buffer (single) 0x0007 0x0004 Index_id (device index ID), Index (channel), R, G, B (color) Operation_status 5.25
0x75 Set RGB buffer (multiple) 0x0033 0x0003 Index_id (device index ID), R, G, B (color) None 5.26
0x76 Get RGB buffer (single) 0x0004 0x0004/0x0007 Index_id (device index ID), Index (channel) Operation_status, R, G, B (color) 5.27
0x77 Get RGB buffer (multiple) 0x0003 0x0033 Index_id (device index ID) R0 ~ B15 (16 sets of RGB buffer values) 5.28
0x80 Set PWM duty cycle (single) 0x0005 0x0004 Index_id (device index ID), GPIO (channel), Duty (duty cycle) Operation_status 5.29
0x81 Set PWM duty cycle (multiple) 0x000B 0x0004 Index_id (device index ID), Duty (duty cycle) Operation_status 5.30
0x82 Get PWM duty cycle (single) 0x0004 0x0004/0x0005 Index_id (device index ID), GPIO (channel) Operation_status, Duty (duty cycle) 5.31
0x83 Get PWM duty cycle (multiple) 0x0003 0x000B Index_id (device index ID) Duty0 ~ Duty7 (duty cycle of each channel) 5.32
0x90 Set timer frequency (single) 0x0006 0x0004 Index_id (device index ID), Time (channel), Freq (frequency) Operation_status 5.33
0x91 Set timer frequency (multiple) 0x0007 0x0004 Index_id (device index ID), Freq (frequency) Operation_status 5.34
0x92 Get timer frequency (single) 0x0004 0x0004/0x0006 Index_id (device index ID), Time (channel) Operation_status, Freq (frequency) 5.35
0x93 Get timer frequency (multiple) 0x0003 0x0007 Index_id (device index ID) Freq0_L ~ Freq1_H (TIM2 / TIM3 frequency) 5.36
0xA0 Get reference voltage 0x0003 0x0005 Index_id (device index ID) Operation_status, Voltage (unit mV) 5.37
0xA1 Get GROVE voltage 0x0003 0x0005 Index_id (device index ID) Operation_status, Voltage (unit mV) 5.38
0xA2 Get DC port voltage 0x0003 0x0005 Index_id (device index ID) Operation_status, Voltage (unit mV) 5.39
0xA3 Get system current 0x0003 0x0005 Index_id (device index ID) Operation_status, Current (unit mA) 5.40
0xF8 Query device unique UID 0x0004 0x0004+4/12 Index_id (device index ID), UID_Type Operation_status, UID 5.41
0xF9 Query the upgrade program version number 0x0003 0x0004 Index_id (device index ID) Bootloader_version 5.42
0xFA Query the device software version number 0x0003 0x0004 Index_id (device index ID) Firmware_version 5.43
0xFB Query device type 0x0003 0x0005 Index_id (device index ID) Device_type 5.44
0xFC Enumeration request, sent by the end device when the Chain link changes 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.45
0xFD Heartbeat packet, periodic communication between Chain devices, which can self-discover whether a device is the end device; the host can also use heartbeat packets to determine whether a Chain device is connected 0x0003 0x0003 none none 5.46
0xFE Enumerate the number of cascaded devices 0x0004 0x0004 Send_num (default 0, used to record the number of devices) Receive_num (the value represents the number of devices) 5.47

5. Command Details

5.1 Set mode (single) - Cmd 0x10

Request data

Input parameters: Index_id (device index ID), GPIO (channel), Mode (mode)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x10 | GPIO | Mode | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x10 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Mode
    • 0: Input
    • 1: Output
    • 2: ADC
    • 3: Servo
    • 4: RGB (WS2812)
    • 5: PWM
    • default: 0

5.2 Set mode (multiple) - Cmd 0x11

Request data

Input parameters: Index_id (device index ID), Mode (mode)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x11 | Mode0 | Mode1 | Mode2 | Mode3 | ... | Mode7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x11 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Mode
    • 0: Input
    • 1: Output
    • 2: ADC
    • 3: Servo
    • 4: RGB
    • 5: PWM
    • default: 0

5.3 Get mode (single) - Cmd 0x12

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x12 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, Mode (mode)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x12 | Operation_status | Mode | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Mode
    • 0: Input
    • 1: Output
    • 2: ADC
    • 3: Servo
    • 4: RGB
    • 5: PWM
    • default: 0
  4. The response length is 0x05 on success and 0x04 on failure

5.4 Get mode (multiple) - Cmd 0x13

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x13 | CRC | 55 AA

Response Data

Return parameters: Mode (mode)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x13 | Mode0 | Mode1 | Mode2 | Mode3 | ... | Mode7 | CRC | 55 AA

Things to note

  1. Mode
    • 0: Input
    • 1: Output
    • 2: ADC
    • 3: Servo
    • 4: RGB
    • 5: PWM
    • default: 0

5.5 Set input pull-up/pull-down (single) - Cmd 0x30

Request data

Input parameters: Index_id (device index ID), GPIO (channel), PU/PD (input pull-up/pull-down configuration)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x30 | GPIO | PU/PD | 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

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. PU/PD pull-up/pull-down configuration
    • 0: No pull-up/pull-down
    • 1: Pull-up
    • 2: Pull-down
    • default: 0

5.6 Set input pull-up/pull-down (multiple) - Cmd 0x31

Request data

Input parameters: Index_id (device index ID), PU/PD (input pull-up/pull-down configuration)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x31 | PU/PD0 | PU/PD1 | PU/PD2 | PU/PD3 | ... | PU/PD7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x31 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. PU/PD pull-up/pull-down configuration
    • 0: No pull-up/pull-down
    • 1: Pull-up
    • 2: Pull-down
    • default: 0

5.7 Get input pull-up/pull-down (single) - Cmd 0x32

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x32 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, PU/PD (input pull-up/pull-down configuration)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x32 | Operation_status | PU/PD | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. PU/PD pull-up/pull-down configuration
    • 0: No pull-up/pull-down
    • 1: Pull-up
    • 2: Pull-down
    • default: 0
  4. The response length is 0x05 on success and 0x04 on failure

5.8 Get input pull-up/pull-down (multiple) - Cmd 0x33

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x33 | CRC | 55 AA

Response Data

Return parameters: PU/PD (input pull-up/pull-down configuration)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x33 | PU/PD0 | PU/PD1 | PU/PD2 | PU/PD3 | ... | PU/PD7 | CRC | 55 AA

Things to note

  1. PU/PD pull-up/pull-down configuration
    • 0: No pull-up/pull-down
    • 1: Pull-up
    • 2: Pull-down
    • default: 0

5.9 Get input level (single) - Cmd 0x34

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x34 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, Level (input level)

Response Frame:
  AA 55 | 0x05/0x04 | 0x00 | Index_id | 0x34 | Operation_status | Level | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Level input level
    • 1: High level
    • 0: Low level
  4. The response length is 0x05 on success and 0x04 on failure

5.10 Get input level (multiple) - Cmd 0x35

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x35 | CRC | 55 AA

Response Data

Return parameters: Level (input level)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x35 | Level0 | Level1 | Level2 | Level3 | ... | Level7 | CRC | 55 AA

Things to note

  1. Level input level
    • 1: High level
    • 0: Low level

5.11 Set output level (single) - Cmd 0x40

Request data

Input parameters: Index_id (device index ID), GPIO (channel), Level (output level)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x40 | GPIO | Level | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x40 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Level output level
    • 1: High level
    • 0: Low level

5.12 Set output level (multiple) - Cmd 0x41

Request data

Input parameters: Index_id (device index ID), Level (output level)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x41 | Level0 | Level1 | Level2 | Level3 | ... | Level7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x41 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Level output level
    • 1: High level
    • 0: Low level

5.13 Get output level (single) - Cmd 0x42

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x42 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, Level (output level)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x42 | Operation_status | Level | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Level output level
    • 1: High level
    • 0: Low level
  4. The response length is 0x05 on success and 0x04 on failure

5.14 Get output level (multiple) - Cmd 0x43

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x43 | CRC | 55 AA

Response Data

Return parameters: Level (output level)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x43 | Level0 | Level1 | Level2 | Level3 | ... | Level7 | CRC | 55 AA

Things to note

  1. Level output level
    • 1: High level
    • 0: Low level

5.15 Get ADC channel value (single) - Cmd 0x50

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x50 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, ADC

Response Frame:
  AA 55 | 0x04/0x06 | 0x00 | Index_id | 0x50 | Operation_status | ADC_L | ADC_H | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. ADC: 0~4095
  4. If the GPIO channel being read is not configured for ADC mode, the returned value is always 0
  5. The response length is 0x06 on success and 0x04 on failure

5.16 Get ADC channel value (multiple) - Cmd 0x51

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x51 | CRC | 55 AA

Response Data

Return parameters: ADC

Response Frame:
  AA 55 | 0x13 | 0x00 | Index_id | 0x51 | ADC0_L | ADC0_H | ADC1_L | ADC1_H | ... | ADC7_H | CRC | 55 AA

Things to note

  1. ADC: 0~4095
  2. If the GPIO channel being read is not configured for ADC mode, the returned value is always 0

5.17 Set Angle (single) - Cmd 0x60

Request data

Input parameters: Index_id (device index ID), GPIO (channel), Angle (servo angle)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x60 | GPIO | Angle | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x60 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Angle
    • 0~180
    • default: 0

5.18 Set Angle (multiple) - Cmd 0x61

Request data

Input parameters: Index_id (device index ID), Angle (servo angle)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x61 | Angle0 | Angle1 | Angle2 | Angle3 | ... | Angle7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x61 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Angle
    • 0~180
    • default: 0

5.19 Get Angle (single) - Cmd 0x62

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x62 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, Angle (servo angle)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x62 | Operation_status | Angle | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Angle
    • 0~180
    • default: 0
  4. The response length is 0x05 on success and 0x04 on failure

5.20 Get Angle (multiple) - Cmd 0x63

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x63 | CRC | 55 AA

Response Data

Return parameters: Angle (servo angle)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x63 | Angle0 | Angle1 | Angle2 | Angle3 | ... | Angle7 | CRC | 55 AA

Things to note

  1. Angle
    • 0~180
    • default: 0

5.21 Set RGB configuration (single) - Cmd 0x70

Request data

Input parameters: Index_id (device index ID), GPIO (channel), RGB (RGB configuration)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x70 | GPIO | RGB | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x70 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. RGB configuration
    • bit[7:6]: Reserved
    • bit[5]: Refresh bit
    • bit[4~0]: Number of RGB LEDs (1~16)
    • default: 0
  4. Refresh condition: first set the corresponding GPIO channel to RGB mode, then configure the buffer, the LED count and the refresh bit; the refresh bit is cleared automatically after the refresh (it is also cleared automatically when the channel is not in RGB mode)

5.22 Set RGB configuration (multiple) - Cmd 0x71

Request data

Input parameters: Index_id (device index ID), RGB (RGB configuration)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x71 | RGB0 | RGB1 | RGB2 | RGB3 | ... | RGB7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x71 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. RGB configuration
    • bit[7:6]: Reserved
    • bit[5]: Refresh bit
    • bit[4~0]: Number of RGB LEDs (1~16)
    • default: 0
  3. Refresh condition: first set the corresponding GPIO channel to RGB mode, then configure the buffer, the LED count and the refresh bit; the refresh bit is cleared automatically after the refresh (it is also cleared automatically when the channel is not in RGB mode)

5.23 Get RGB configuration (single) - Cmd 0x72

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x72 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, RGB (RGB configuration)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x72 | Operation_status | RGB | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. RGB configuration
    • bit[7:6]: Reserved
    • bit[5]: Refresh bit
    • bit[4~0]: Number of RGB LEDs (1~16)
    • default: 0
  4. Refresh condition: first set the corresponding GPIO channel to RGB mode, then configure the buffer, the LED count and the refresh bit; the refresh bit is cleared automatically after the refresh (it is also cleared automatically when the channel is not in RGB mode)
  5. The response length is 0x05 on success and 0x04 on failure

5.24 Get RGB configuration (multiple) - Cmd 0x73

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x73 | CRC | 55 AA

Response Data

Return parameters: RGB0 ~ RGB7 (RGB configuration of each channel)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x73 | RGB0 | RGB1 | RGB2 | RGB3 | ... | RGB7 | CRC | 55 AA

Things to note

  1. RGB configuration
    • bit[7:6]: Reserved
    • bit[5]: Refresh bit
    • bit[4~0]: Number of RGB LEDs (1~16)
    • default: 0
  2. Refresh condition: first set the corresponding GPIO channel to RGB mode, then configure the buffer, the LED count and the refresh bit; the refresh bit is cleared automatically after the refresh (it is also cleared automatically when the channel is not in RGB mode)

5.25 Set RGB buffer (single) - Cmd 0x74

Request data

Input parameters: Index_id (device index ID), Index (channel), R, G, B (color)

Request Frame:
  AA 55 | 0x07 | 0x00 | Index_id | 0x74 | Index | R | G | B | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x74 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Index buffer index: 0~15

5.26 Set RGB buffer (multiple) - Cmd 0x75

Request data

Input parameters: Index_id (device index ID), R, G, B (color)

Request Frame:
  AA 55 | 0x33 | 0x00 | Index_id | 0x75 | R0 | G0 | B0 | ... | G15 | B15 | CRC | 55 AA

Response Data

Return parameters: None

Response Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x75 | CRC | 55 AA

Things to note

None.


5.27 Get RGB buffer (single) - Cmd 0x76

Request data

Input parameters: Index_id (device index ID), Index (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x76 | Index | CRC | 55 AA

Response Data

Return parameters: Operation_status, R, G, B (color)

Response Frame:
  AA 55 | 0x04/0x07 | 0x00 | Index_id | 0x76 | Operation_status | R | G | B | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Index buffer index: 0~15
  3. The response length is 0x07 on success and 0x04 on failure

5.28 Get RGB buffer (multiple) - Cmd 0x77

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x77 | CRC | 55 AA

Response Data

Return parameters: R0 ~ B15 (16 sets of RGB buffer values)

Response Frame:
  AA 55 | 0x33 | 0x00 | Index_id | 0x77 | R0 | G0 | B0 | ... | G15 | B15 | CRC | 55 AA

Things to note

None.


5.29 Set PWM duty cycle (single) - Cmd 0x80

Request data

Input parameters: Index_id (device index ID), GPIO (channel), Duty (duty cycle)

Request Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0x80 | GPIO | Duty | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x80 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Duty duty cycle
    • 0~100
    • default: 0

5.30 Set PWM duty cycle (multiple) - Cmd 0x81

Request data

Input parameters: Index_id (device index ID), Duty (duty cycle)

Request Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x81 | Duty0 | Duty1 | Duty2 | Duty3 | ... | Duty7 | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x81 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Duty duty cycle
    • 0~100
    • default: 0

5.31 Get PWM duty cycle (single) - Cmd 0x82

Request data

Input parameters: Index_id (device index ID), GPIO (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x82 | GPIO | CRC | 55 AA

Response Data

Return parameters: Operation_status, Duty (duty cycle)

Response Frame:
  AA 55 | 0x04/0x05 | 0x00 | Index_id | 0x82 | Operation_status | Duty | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. GPIO channel: 0~7
  3. Duty duty cycle
    • 0~100
    • default: 0
  4. The response length is 0x05 on success and 0x04 on failure

5.32 Get PWM duty cycle (multiple) - Cmd 0x83

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x83 | CRC | 55 AA

Response Data

Return parameters: Duty0 ~ Duty7 (duty cycle of each channel)

Response Frame:
  AA 55 | 0x0B | 0x00 | Index_id | 0x83 | Duty0 | Duty1 | Duty2 | Duty3 | ... | Duty7 | CRC | 55 AA

Things to note

  1. Duty duty cycle
    • 0~100
    • default: 0

5.33 Set timer frequency (single) - Cmd 0x90

Request data

Input parameters: Index_id (device index ID), Time (channel), Freq (frequency)

Request Frame:
  AA 55 | 0x06 | 0x00 | Index_id | 0x90 | Time | Freq_L | Freq_H | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x90 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Time channel
    • 0~1
    • 0: TIM2
    • 1: TIM3
  3. Freq
    • 1~65535
    • default: 50Hz
  4. TIM2 sets the frequency of the GPIO0~GPIO3 channels and TIM3 sets the frequency of the GPIO4~GPIO7 channels

5.34 Set timer frequency (multiple) - Cmd 0x91

Request data

Input parameters: Index_id (device index ID), Freq (frequency)

Request Frame:
  AA 55 | 0x07 | 0x00 | Index_id | 0x91 | Freq0_L | Freq0_H | Freq1_L | Freq1_H | CRC | 55 AA

Response Data

Return parameters: Operation_status

Response Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x91 | Operation_status | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Freq
    • 1~65535
    • default: 50Hz
  3. TIM2 sets the frequency of the GPIO0~GPIO3 channels and TIM3 sets the frequency of the GPIO4~GPIO7 channels

5.35 Get timer frequency (single) - Cmd 0x92

Request data

Input parameters: Index_id (device index ID), Time (channel)

Request Frame:
  AA 55 | 0x04 | 0x00 | Index_id | 0x92 | Time | CRC | 55 AA

Response Data

Return parameters: Operation_status, Freq (frequency)

Response Frame:
  AA 55 | 0x04/0x06 | 0x00 | Index_id | 0x92 | Operation_status | Freq_L | Freq_H | CRC | 55 AA

Things to note

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. Time channel: 0~1
  3. Freq
    • 1~65535
    • default: 50Hz
  4. TIM2 sets the frequency of the GPIO0~GPIO3 channels and TIM3 sets the frequency of the GPIO4~GPIO7 channels
  5. The response length is 0x06 on success and 0x04 on failure

5.36 Get timer frequency (multiple) - Cmd 0x93

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0x93 | CRC | 55 AA

Response Data

Return parameters: Freq0_L ~ Freq1_H (TIM2 / TIM3 frequency)

Response Frame:
  AA 55 | 0x07 | 0x00 | Index_id | 0x93 | Freq0_L | Freq0_H | Freq1_L | Freq1_H | CRC | 55 AA

Things to note

  1. Freq
    • 1~65535
    • default: 50Hz
  2. TIM2 sets the frequency of the GPIO0~GPIO3 channels and TIM3 sets the frequency of the GPIO4~GPIO7 channels

5.37 Get reference voltage - Cmd 0xA0

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0xA0 | CRC | 55 AA

Response Data

Return parameters: Operation_status, Voltage (unit mV)

Response Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0xA0 | Voltage_L | Voltage_H | CRC | 55 AA

Things to note

None.


5.38 Get GROVE voltage - Cmd 0xA1

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0xA1 | CRC | 55 AA

Response Data

Return parameters: Operation_status, Voltage (unit mV)

Response Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0xA1 | Voltage_L | Voltage_H | CRC | 55 AA

Things to note

None.


5.39 Get DC port voltage - Cmd 0xA2

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0xA2 | CRC | 55 AA

Response Data

Return parameters: Operation_status, Voltage (unit mV)

Response Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0xA2 | Voltage_L | Voltage_H | CRC | 55 AA

Things to note

None.


5.40 Get system current - Cmd 0xA3

Request data

Input parameters: Index_id (device index ID)

Request Frame:
  AA 55 | 0x03 | 0x00 | Index_id | 0xA3 | CRC | 55 AA

Response Data

Return parameters: Operation_status, Current (unit mA)

Response Frame:
  AA 55 | 0x05 | 0x00 | Index_id | 0xA3 | Current_L | Current_H | CRC | 55 AA

Things to note

None.


5.41 Query device unique UID - 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

  1. Operation_status operation status
    • 0: Operation failed
    • 1: Operation succeeded
  2. UID_Type UID type
    • 0: 4byte UID
    • 1: 12byte UID

5.42 Query the upgrade program version number - Cmd 0xF9

Request data

Input parameters: 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.43 Query the device software version number - Cmd 0xFA

Request data

Input parameters: 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.44 Query device type - Cmd 0xFB

Request data

Input parameters: 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

  1. Device_type = (uint16_t)((Device_type_high << 8) | Device_type_low)
  2. The device type code of the Unit 8Servos2-Chain is 0x000C

Request data

Input parameters: none

Request Frame:
  Device-initiated report, no host request frame

Response Data

Return parameters: none

Response Frame:
  AA 55 | 0x03 | 0x00 | 0xFF | 0xFC | CRC | 55 AA

Things to note

None.


5.46 Heartbeat packet, periodic communication between Chain devices, which can self-discover whether a device is the end device; the host can also use heartbeat packets to determine whether a Chain device is 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.47 Enumerate the number of cascaded devices - Cmd 0xFE

Request data

Input parameters: 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 parameters: 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 succeeded

Other modes, ranges and event enumeration values are defined in the "Things to note" of the corresponding command.


7. Version records

Document version Date Description
V1 2026-7-14 Compiled from the official Unit 8Servos2-Chain protocol