AgileX Robotics (Dongguan) Co.,Ltd.
23
3.4.2 Serial message protocol
•
Basic parameters of communication
Item
Parameter
Baud rate
115200
Check
No check
Data bit length
8 bits
Stop bit
1 bit
•
Protocol specification
Start bit
Frame
length
Command
type
Comman
d ID
Data field
Frame ID
Checksum
composition
SOF
frame_L
CMD_TYPE
CMD_ID
data [0]
…
data[n]
frame_id
check_sum
byte 1
byte 2
byte 3
byte 4
byte 5
byte 6
…
byte 6+n
byte 7+n
byte 8+n
5A
A5
The protocol includes start bit, frame length, frame command type, command ID, data field, frame
ID, and checksum composition. Where, the frame length refers to the length excluding start bit and
checksum composition; the checksum refers to the sum from start bit to all data of frame ID; the
frame ID is a loop count between 0 to 255, which will be added once every command sent.
•
Protocol content
System status feedback command
Command Name
System status feedback command
* @briefserial message checksum example code
* @param[in]*data : serial message data struct pointer
* @param[in]len :serial message data length
* @returnthe checksum result
*/
staticuint8Agilex_SerialMsgChecksum
(
uint8
*
data
,
uint8len
)
{
uint8checksum
=
0x00
;
for
(
uint8 i
=
0
;
i
<(
len
-
1
);
i
++)
{
checksum
+=
data
[
i
];
}
return
checksum
;
}
Figure 3.3 Example of Serial Check Algorithm Codes