How to Perform Motor Identification Using CAN Bus
Prerequisites:
- An ESCx controller that is powered ON
- CAN bus is functioning properly
- Controller address is set to 0
note
- All payloads use big-endian byte order
Step 1: Compose the CAN Frame
CAN ID | DLC |
---|---|
0x0C7 | 8 |
Byte 0 | Byte 1 | Byte 2 | Byte 3 - Byte 7 |
---|---|---|---|
Receiver address 0x0 | Perform task 0x4 | task ID | 0x0 |
How to Calculate CAN ID
SID is 24, sender address is 7 -> (24 � 3) + 7 = 192 + 7 = 199 (DEC) = 0xC7
Task ID List
Task ID | Description |
---|---|
1 | Driver reinit |
2 | Execute identlin |
3 | Execute identrun |
128 | Save parameters |
129 | Load parameters from flash |
255 | Request task result |
Other | Unsupported command (can be used as heartbeat) |
Step 2: Receive Response
CAN ID | DLC |
---|---|
0x0C0 | 3 |
Byte 0 | Byte 1 | Byte 2 |
---|---|---|
Receiver address 0x7 | Perform task - response 0x44 | Task ID |
How to Calculate CAN ID
SID is 24, sender address is 0 -> (24 � 3) + 0 = 192 (DEC) = 0xC0
note
- DLC = 7 with Byte 3 - Byte 7 containing value -1 indicates unsupported task
- If a task is unfinished, the response includes the ID of the unfinished task
Step 3: Request Task Result
CAN ID | DLC |
---|---|
0x0C7 | 8 |
Byte 0 | Byte 1 | Byte 2 | Byte 3 - Byte 7 |
---|---|---|---|
Receiver address 0x0 | Perform task 0x4 | Request result 0xFF | 0x0 |
Task is Still Running
Response when a task is in progress:
CAN ID | DLC |
---|---|
0x0C0 | 3 |
Byte 0 | Byte 1 | Byte 2 |
---|---|---|
Receiver address 0x7 | Perform task - response 0x44 | Running task ID |
Task Finished
Response containing the latest task result:
CAN ID | DLC |
---|---|
0x0C0 | 7 |
Byte 0 | Byte 1 | Byte 2 | Byte 3 - Byte 7 |
---|---|---|---|
Receiver address 0x7 | Perform task - response 0x44 | Running task ID | Task result |
A result of 0 typically indicates success, while any other value indicates failure.