CANFD:
Usage Demo 1. Basic demo
Read the current position of the module whose ID is 1
Command = CMD_RD; Current position low 16-bit address = 0x14, read the data of two registers;
Command package:
CAN-ID | DLC | Byte1 | Byte2 | Byte3 |
---|---|---|---|---|
0x01 | 0x03 | 0x01 | 0x14 | 0x02 |
Current position query |
Response package:
CAN-ID | DLC | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 |
---|---|---|---|---|---|---|---|
0x101 | 0x06 | 0x01 | 0x14 | 0x10 | 0x27 | 0x00 | 0x00 |
Current position |
Current position: position = 0x00002710/10000 = 1°
Set the target position of the module whose ID is 1 to 1°
Command = CMD_WR; address = 0x36; data = 10000 = 0x00002710;
(1) Normal mode:
Command package:
CAN-ID | DLC | Byte1 | Byte2 | Byte3 | Byte4 | Byte5 | Byte6 |
---|---|---|---|---|---|---|---|
0x01 | 0x06 | 0x02 | 0x36 | 0x10 | 0x27 | 0x00 | 0x00 |
Set the target position |
Response package:
CAN-ID | DLC | Byte1 | Byte2 | Byte3 | |
---|---|---|---|---|---|
0x101 | 0x03 | 0x02 | 0x36 | 0x01 | |
Target position set successfully |
(2) Servo mode:
Command package:
CAN-ID | DLC | Byte1 | Byte2 | Byte3 | Byte4 |
---|---|---|---|---|---|
0x201 | 0x04 | 0x10 | 0x27 | 0x00 | 0x00 |
Set the target position |
Response package:
CAN-ID | DLC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x501 | 0x10 | 0x64 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x20 | 0x00 | 0x00 |
Current current (100 mA) | Current speed (0) | Current position | |||||||||||
13 | 14 | 15 | 15 | ||||||||||
0x01 | 0x00 | 0x00 | 0x00 | ||||||||||
Enable status (Enable status) | Error code (no error) |
2. Demo of common command package
Position servo command package
When the joint is in the position servo mode, it enters the cyclic position servo control stage. At this stage, the controller sends position command frames to each joint module, and each joint module that has received the command frames performs corresponding position servo control and sends the current position information, current information, speed information, enable status, and error code to the controller through a feedback frame.
If 7 modules on a bus participate in cyclic servo control, 14 frames of communication will be generated on the bus within one control cycle to reduce the bus load.
Position servo command frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | IDE | FDF | R0 | BRS | ESI | DLC/4 | Data(4Byte) | CRC | ACK | EOF | IFS | |||
ID+0x200 | 0 | 0 | 1 | 0 | 1 | 0 | Length | D0 | D1 | D2 | D3 | ||||
4 | Current position |
Servo feedback frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||
---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | ...... | DLC/4 | Data(16Byte) | ...... | ||||
ID+0x500 | 0 | ...... | Length | D0~D3 | D4~D7 | D8~D11 | D12~D13 | D14~D15 | ...... |
16 | Current current | Current speed | Current position | Enable status | Error code | ...... |
Speed servo command package
When the joint is in the speed servo mode, it enters the cyclic speed servo control stage. At this stage, the controller sends speed command frames to each joint module, and each joint module that has received the command frames performs corresponding speed servo control and sends the current position information, current information, speed information, enable status, and error code to the controller through a feedback frame.
Speed servo command frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | IDE | FDF | R0 | BRS | ESI | DLC/4 | Data(4Byte) | CRC | ACK | EOF | IFS | |||
ID+0x300 | 0 | 0 | 1 | 0 | 1 | 0 | Length | D0 | D1 | D2 | D3 | ||||
4 | Target speed |
Servo feedback frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||
---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | ...... | DLC/4 | Data(16Byte) | ...... | ||||
ID+0x500 | 0 | ...... | Length | D0~D3 | D4~D7 | D8~D11 | D12~D13 | D14~D15 | ...... |
16 | Current current | Current speed | Current position | Enable status | Error code | ...... |
Current servo command package
To control the joint current. Once a current servo command frame is issued, a servo feedback frame is returned.
Current servo command frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | IDE | FDF | R0 | BRS | ESI | DLC/4 | Data(4Byte) | CRC | ACK | EOF | IFS | |||
ID+0x400 | 0 | 0 | 1 | 0 | 1 | 0 | Length | D0 | D1 | D2 | D3 | ||||
4 | Target speed |
Servo feedback frame:
Arbitration field | Control field | Data field | CRC and other fields | ||||||
---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | ...... | DLC/4 | Data(16Byte) | ...... | ||||
ID+0x500 | 0 | ...... | Length | D0~D3 | D4~D7 | D8~D11 | D12~D13 | D14~D15 | ...... |
16 | Current current | Current speed | Current position | Enable status | Error code | ...... |
Joint status query command package
To query the joint status in cycles. To improve the bus utilization, the common joint data is queried through a command frame, and after the joint receives the command frame, it integrates the error code, system voltage, system temperature, enable status, and current position into a joint status feedback frame for feedback.
Joint status query command frame:
Arbitration field | Control field | Data field | CRC and other fields | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | IDE | FDF | R0 | BRS | ESI | DLC/4 | Data(0Byte) | CRC | ACK | EOF | IFS |
ID+0x600 | 0 | 0 | 1 | 0 | 1 | 0 | Length | |||||
0 |
Joint status feedback frame:
Arbitration field | Control field | Data field | CRC and other fields | |||||||
---|---|---|---|---|---|---|---|---|---|---|
STID/11 | R1 | ...... | DLC/4 | Data(16Byte) | ...... | |||||
ID+0x700 | 0 | ....... | Length | D0~D1 | D2~D3 | D4~D5 | D6~D7 | D8~D11 | D12~D15 | ....... |
12 | Error code | System voltage | System temperature | D6 Enable status D7 Brake status | Current position | Current current | ...... |