Difference between revisions of "CanServo/Protocol/Control/en"

From HITEC_HELP
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
This protocol is used when [[CanServo/MODE/CAN/en]] = 2.0A or 2.0B.
For protocol in UAVCAN state, refer to [[CanServo/Protocol/UAVCAN/en]].
CAN servo is controlled by sending CAN packets with CAN ID set in Register [[CanServo/ID2/en]] and data following the message format below.
CAN servo is controlled by sending CAN packets with CAN ID set in Register [[CanServo/ID2/en]] and data following the message format below.
According to the message type ( write, read, etc, first byte in data part ) of CAN Data, the register containing servo operation data can be changed or read.
Depending on the message type of CAN Data, the servo register can be changed or read.
* As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.
* As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.
** CAN ID = 0
** CAN ID = 0
** CAN DATA = 'w', 0, 0x30, 0x34, 0x12
** CAN DATA = 'w', 0, 0x30, 0x34, 0x12
** DLC = 5
** DLC = 5
* However, the Can Packet Type is determined according to the [[CanServo/MODE/CAN/en]] setting value.





Latest revision as of 01:58, 29 September 2022

This protocol is used when CanServo/MODE/CAN/en = 2.0A or 2.0B. For protocol in UAVCAN state, refer to CanServo/Protocol/UAVCAN/en.


CAN servo is controlled by sending CAN packets with CAN ID set in Register CanServo/ID2/en and data following the message format below. Depending on the message type of CAN Data, the servo register can be changed or read.

  • As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.
    • CAN ID = 0
    • CAN DATA = 'w', 0, 0x30, 0x34, 0x12
    • DLC = 5
  • However, the Can Packet Type is determined according to the CanServo/MODE/CAN/en setting value.


There are 11 types of messages in 8 data bytes of CAN Packet, 3 old types and 8 new types. The first byte indicates the kind of message. The second byte is the servo ID.


Here, Target Servo ID must match the value of CanServo/ID1/en of Servo. Or if 0 is specified, all servos will react. For the exact procedure, refer to CanServo/Packet Accept Rule/en.


V0: Old Format:


  • Old Write Command
    • write 1 register
      • 0x96, (target servo id), (address), 2, (data low byte), (data high byte), (chksum)
      • DLC = 7


  • Old Read Command
    • read 1 register
      • 0x96, (target servo id), (address), 0, (chksum)
      • DLC = 5


  • Old Return Message
    • return 1 register
      • 0x69, (servo id), (address), 2, (data low byte), (data high byte), (chksum)
      • DLC = 7


  • Old message's chksum
    • add all bytes before chksum, except first byte


V1: New Format: (checksum removed)


  • Write Command
    • write 1 register
      • 'w', (target servo id), (address), (data low byte), (data high byte)
      • DLC = 5
    • write 2 registers
      • 'W', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
      • DLC = 8


  • Read Command
    • read 1 register
      • 'r', (target servo id), (address)
      • DLC = 3
    • read 2 registers
      • 'R', (target servo id), (address 0), (address 1)
      • DLC = 4


  • Write and Read Command
    • write and read: 1 register
      • 'x', (target servo id), (address), (data low byte), (data high byte)
      • DLC = 5
    • write and read: 2 registers
      • 'X', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
      • DLC = 8


  • Return Message : Servo --> Host
    • return 1 register
      • 'v', (servo id), (address), (data low byte), (data high byte)
      • DLC = 5
    • return 2 registers
      • 'V', (servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
      • DLC = 8