Skip to main content
FW version: Stable

How to Read/Write Drive Parameters Over CAN Bus

This example demonstrates reading and writing the parameter /driver/limiter/ppos (ID: 80/0x50). We'll write the value 1000.0 and read it back.

Prerequisites:

  • An ESCx Controller that is powered ON
  • CAN bus is functioning properly
  • Controller CAN address is set to 0
note
  • All values use big-endian byte order

Step 1: Write Parameter CAN Frame

note
  • See parameter list for available parameters
  • Verify parameter type - most are float, some are integer
CAN IDDLC
0x0C78
Byte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7
Receiver address
0x0
Write parameter
0x3
Parameter ID
0x50
Array index
0x0
Float LSB
0x00
Float
0x00
Float
0x7A
Float MSB
0x44
note
  • CAN ID calculation: SID is 24, sender address is 7 -> (24 � 3) + 7 = 192 + 7 = 199 (DEC) = 0xC7
  • Decimal 1000.0 in float is 0x447a0000

Step 2: Write Response

CAN IDDLC
0x0C06
Byte 0Byte 1Byte 2Byte 3Byte 4 - Byte 5
Receiver address
0x7
Write parameter response
0x43
Parameter ID
0x50
0xFF = error
Parameter ID if success
Error code (INT16)

Step 3: Read Parameter Request

CAN IDDLC
0x0C78
Byte 0Byte 1Byte 2Byte 3Byte 4 - Byte 7
Receiver address
0x0
Read parameter
0x2
Parameter ID
0x50
Array index
0x0
0x0

Step 4: Read Response

CAN IDDLC
0x0C05-8 (depends on parameter type)
Byte 0Byte 1Byte 2Byte 3Byte 4 - Byte 5
Receiver address
0x7
Read parameter response
0x42
Parameter ID
0x50
0xFF = error
Parameter ID if success
Parameter value - 0x00007A44
Error code (INT16) if error occurs

Error Code

Error codeDescription
-1Parameter ID out of bounds
-2Parameter not found
-3Variable is not parameter
-4Set value below minimum
-5Set value above maximum
-6Parameter is preset type and value not in preset list