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

From HITEC_HELP
Jump to navigation Jump to search
 
(4 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.
This protocols is used when [[CanServo/MODE/CAN/en]] = 2.0A or 2.0B.
For protocol in UAVCAN state, refer to [[CanServo/Protocol/UAVCAN/en]].
For protocol in UAVCAN state, refer to [[CanServo/Protocol/UAVCAN/en]].


Line 22: Line 22:




V0: Old Format:
V0: 0x96 Format:




* Old Write Command
* 0x96 Write Command
** write 1 register
** write 1 register
*** 0x96, (target servo id), (address), 2, (data low byte), (data high byte), (chksum)
*** 0x96, (target servo id), (address), 2, (data low byte), (data high byte), (chksum)
Line 31: Line 31:




* Old Read Command
* 0x96 Read Command
** read 1 register
** read 1 register
*** 0x96, (target servo id), (address), 0, (chksum)
*** 0x96, (target servo id), (address), 0, (chksum)
Line 37: Line 37:




* Old Return Message
* 0x69 Return Message
** return 1 register
** return 1 register
*** 0x69, (servo id), (address), 2, (data low byte), (data high byte), (chksum)
*** 0x69, (servo id), (address), 2, (data low byte), (data high byte), (chksum)
Line 43: Line 43:




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




V1: New Format: (checksum removed)
V1: Checksum removed format
 
NOTE) V1: FW Ver >= 1.3
 
NOTE) V1 has included V0.





Latest revision as of 02:58, 10 January 2025

This protocols 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: 0x96 Format:


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


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


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


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


V1: Checksum removed format

NOTE) V1: FW Ver >= 1.3

NOTE) V1 has included V0.


  • 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