Skip to main content
FW version: Stable

How to perform a task using CAN bus

What do you need to prepare before:

  • The controller is turned ON
  • CANbus works properly
  • The controller CAN address is set to 0
note
  • All the values are in big-endian

Step 1: Compose the CAN frame

CAN IDDLC
0x0C78
Byte 0Byte 1Byte 2Byte 3 - Byte 7
Receiver address
0x0
Perform task
0x4
task ID0x0
How to compute CAN ID

SID is 24, sender address is 7 -> (24 « 3) + 7 = 192 + 7 = 199 (DEC) = 0xC7

Task ID list

Task IDDescription
1Driver reinit.
2Execute identlin
3Execute identrun
128Save parameters
129Load parameters from flash
255Request task result
OtherUnsupported command (can be used as heardbeat)

Step 2: Receive response

CAN IDDLC
0x0C03
Byte 0Byte 1Byte 2
Receiver address
0x7
Perform task - response
0x44
Task ID
How to compute CAN ID

SID is 24, sender address is 0 -> (24 « 3) + 0 = 192 (DEC) = 0xC0

note
  • If you get DLC = 7. Byte 3 - Byte 7 contains value -1. This means that the task is not supported.
  • If there is unfinished task, the response will have the task ID of the unfinished task.

Step 3: Request the task result

CAN IDDLC
0x0C78
Byte 0Byte 1Byte 2Byte 3 - Byte 7
Receiver address
0x0
Perform task
0x4
Request resul
0xFF
0x0

Task is still runing

You will get this message, there is running task.

CAN IDDLC
0x0C03
Byte 0Byte 1Byte 2
Receiver address
0x7
Perform task - response
0x44
Running task ID

Task finished

With this response, you will get result of the latest task.

CAN IDDLC
0x0C07
Byte 0Byte 1Byte 2Byte 3 - Byte 7
Receiver address
0x7
Perform task - response
0x44
Running task IDTask result

Usually, if the result is 0, the task is successful. If the result is different from 0, the task is failed.