Edit on GitHub

Protocol 1.0

Instruction Packet

Instruction Packet is the command data sent to the Device.

Header1 Header2 ID Length Instruction Param 1 Param N Checksum
0xFF 0xFF ID Length Instruction Param 1 Param N CHKSUM

The field indicates the start of the Packet.

Packet ID

The field that indicates the ID of the Device that should receive the Instruction Packet and process it

  1. Range : 0 ~ 253 (0x00 ~ 0xFD), which is a total of 254 numbers that can be used.
  2. Broadcast ID : 254 (0xFE), which makes all connected devices execute the Instruction Packet.

Length

The length of the Packet(Instruction, Parameter, Checksum fields). Length = number of Parameters + 2

Instruction

The field that defines the type of instruction.

Value Instructions Description
0x01 Ping Instruction that checks whether the Packet has arrived to a device with the same ID as Packet ID
0x02 Read Instruction to read data from the Device
0x03 Write Instruction to write data on the Device
0x04 Reg Write Instruction that registers the Instruction Packet to a standby status; Packet is later executed through the Action instruction
0x05 Action Instruction that executes the Packet that was registered beforehand using Reg Write
0x06 Factory Reset Instruction that resets the Control Table to its initial factory default settings
0x83 Sync Write For multiple devices, Instruction to write data on the same Address with the same length at once

Parameters

Parameters are used when additional data is required for an instruction.

Instruction Checksum

It is used to check if packet is damaged during communication. Instruction Checksum is calculated according to the following formula.

Instruction Checksum = ~( ID + Length + Instruction + Parameter1 + … Parameter N )

Where “~” is the Binary Ones Complement operator. When the calculation result of the parenthesis in the above formula is larger than 255 (0xFF), use only lower bytes.

For example, when you want to use below Instruction Packet,

ID=1(0x01), Length=5(0x05), Instruction=3(0x03), Parameter1=12(0x0C), Parameter2=100(0x64), Parameter3=170(0xAA)

Checksum = ~ ( ID + Length + Instruction + Parameter1 + … Parameter 3 ) = ~ [ 0x01 + 0x05 + 0x03 + 0x0C + 0x64 + 0xAA ] = ~ [ 0x123 ] // Only the lower byte 0x23 executes the Not operation. = 0xDC

Thus, Instruction Packet should be 0xFF, 0xFF, 0x01, 0x05, 0x03, 0x0C, 0x64, 0xAA, 0xDC.

Status Packet

Header1 Header2 ID Length Error Param 1 Param N Checksum
0xFF 0xFF ID Length Error Param 1 Param N CHKSUM

Error

This field displays the error status occurred during the operation of Dynamixel.

Bit Error Description
Bit 7 0 -
Bit 6 Instruction Error In case of sending an undefined instruction or delivering the action instruction without the reg_write instruction, it is set as 1
Bit 5 Overload Error When the current load cannot be controlled by the set Torque, it is set as 1
Bit 4 Checksum Error When the Checksum of the transmitted Instruction Packet is incorrect, it is set as 1
Bit 3 Range Error When an instruction is out of the range for use, it is set as 1
Bit 2 Overheating Error When internal temperature of Dynamixel is out of the range of operating temperature set in the Control table, it is set as 1
Bit 1 Angle Limit Error When Goal Position is written out of the range from CW Angle Limit to CCW Angle Limit , it is set as 1
Bit 0 Input Voltage Error When the applied voltage is out of the range of operating voltage set in the Control table, it is as 1

For example, when Status Packet is returned as below

0xFF 0xFF 0x01 0x02 0x24 0xD8 It means that the error of 0x24 occurs from Dynamixel whose ID is 01. Since 0x24 is 00100100 as binary, Bit5 and Bit2 become 1. In order words, Overload and Overheating Errors have occurred.

Note The error types on the table above are related to actuators, and the contents may vary depending on the type of Dynamixel.

Status Checksum

It is used to check if packet is damaged during communication. Status Checksum is calculated according to the following formula.

Status Checksum = ~( ID + Length + Error + Parameter1 + … Parameter N )

Instruction Details

Ping

This instruction requests the Status Packet from a specific ID. Even if Status Return Level(16) is 0, Dynamixel returns Status Packet all the time for Ping Instruction.

Instruction Length Parameter
0x01 0x02 -

Example

Conditions

Ping Instruction Packet

H1 H2 ID LEN INST CKSM
0xFF 0xFF 0x01 0x02 0x01 0xFB

ID 1 Status Packet

H1 H2 ID LEN ERR CKSM
0xFF 0xFF 0x01 0x02 0x00 0xFC

Read

This instruction is to read data in the Control Table of Dynamixel.

Instruction Length Param 1 Param 2
0x02 0x04 Starting Address of the Data Length of Data to read

Example

Conditions

Read Instruction Packet

H1 H2 ID LEN INST P1 P2 CKSM
0xFF 0xFF 0x01 0x04 0x02 0x2B 0x01 0xCC

ID 1 Status Packet

H1 H2 ID LEN ERR P1 CKSM
0xFF 0xFF 0x01 0x03 0x00 0x20 0xDB

Write

This instruction is to write data to the Control Table of DYNAMIXEL

Instruction Length Param 1 Param 2 Param 3 Param N+1
0x03 N + 3 Starting Address of the Data 1st Byte 2nd Byte Nth Byte

Example

Conditions

Write Instruction Packet

H1 H2 ID LEN INST P1 P2 CKSM
0xFF 0xFF 0xFE 0x04 0x03 0x03 0x01 0xF6

Note Status Packet will not be returned if Broadcast ID(0xFE) is used.

Reg Write

Instruction Length Param 1 Param 2 Param N+1
0x04 N+3 Starting Address of the Data 1st Byte Nth Byte

Example

Conditions

Reg Write Instruction Packet

H1 H2 ID LEN INST P1 P2 P3 CKSM
0xFF 0xFF 0x01 0x05 0x04 0x1E 0xF4 0x01 0xE2

ID 1 Status Packet

H1 H2 ID LEN ERR CKSM
0xFF 0xFF 0x01 0x02 0x00 0xFC

Action

This instruction is to execute the registered Reg Write instruction. The Action instruction is useful when multiple Dynamixels are required to start moving at the same time. When several devices are controlled via communication, there is a minor time difference between enabling the first and last device. Dynamixel has resolved this problem by using Action instruction.

Instruction Length Parameter
0x05 0x02 -

Example

Conditions

Action Instruction Packet

H1 H2 ID LEN INST CKSM
0xFF 0xFF 0xFE 0x02 0x05 0xFA

Note Status Packet will not be returned if Broadcast ID(0xFE) is used.

Factory Reset

This instruction is to reset the Control Table of Dynamixel to the factory default values.

Caution Please be careful as Reset instruction will erase saved custom values in the EEPROM.

Instruction Length Parameter
0x06 0x02 -

Example

Conditions

Factory Reset Instruction Packet

H1 H2 ID LEN INST CKSM
0xFF 0xFF 0x00 0x02 0x06 0xF7

ID 0 Status Packet

H1 H2 ID LEN ERR CKSM
0xFF 0xFF 0x00 0x02 0x00 0xFD

Sync Write

This instruction is used to control multiple Dynamixels simultaneously with a single Instruction Packet transmission. When this instruction is used, several instructions can be transmitted at once, so that the communication time is reduced when multiple Dynamixels are connected in a single channel. However, the SYNC WRITE instruction can only be used to a single address with an identical length of data over connected Dynamixels. ID should be transmitted as Broadcasting ID.

Item Description
Instruction 0x83
Length ((L + 1) * N) + 4, L:Data Length, N:Number of Dynamixel
Parameter 1 Starting address
Parameter 2 Length of Data to write
Parameter 3 [1st Device] ID
Parameter 4 [1st Device] 1st Byte
Parameter 5 [1st Device] 2nd Byte
Parameter L+3 [1st Device] L-th Byte
Parameter L+4 [2nd Device] ID
Parameter L+5 [2nd Device] 1st Byte
Parameter L+6 [2nd Device] 2nd Byte
Parameter 2L+4 [2nd Device] L-th Byte

Example

Conditions

Sync Write Instruction Packet

H1 H2 ID LEN INST P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 CKSM
0xFF 0xFF 0xFE 0x0E 0x83 0x1E 0x04 0x00 0x10 0x00 0x50 0x01 0x01 0x20 0x02 0x60 0x03 0x67

Note Status Packet will not be returned if Broadcast ID(0xFE) is used.

Bulk Read

This instruction is used for reading values of multiple DYNAMIXELs simultaneously by sending a single Instruction Packet. The packet length is shortened compared to sending multiple READ commands, and the idle time between the status packets being returned is also shortened to save communication time. However, this cannot be used to read a single module. If an identical ID is designated multiple times, only the first designated parameter will be processed.

Item Description
Instruction 0x92
Length 3N + 3
Parameter 1 0x00
Parameter 2 [1st Device] Length of Data to read
Parameter 3 [1st Device] ID
Parameter 4 [1st Device] Starting address
Parameter 3N+2 [Nth Device] Length of Data to read
Parameter 3N+3 [Nth Device] ID
Parameter 3N+4 [Nth Device] Starting address

Example

Conditions

Bulk Read Instruction Packet

H1 H2 ID LEN INST P1 P2 P3 P4 P5 P6 P7 CKSM
0xFF 0xFF 0xFE 0x09 0x92 0x00 0x02 0x01 0x1E 0x02 0x02 0x24 0x1D

When Bulk Read instruction is received, Dynamixel with ID 2 monitors the status packet being sent from ID 1 of the data bus (the preceeding device ID), and when device ID 1’s status packet transmission is completed, ID 2 sends its own status packet.

ID 1 Status Packet

H1 H2 ID LEN ERR P1 P2 CKSM
0xFF 0xFF 0x01 0x04 0x00 0x00 0x80 0x7A

ID 2 Status Packet

H1 H2 ID LEN ERR P1 P2 CKSM
0xFF 0xFF 0x02 0x04 0x00 0x00 0x80 0x79

More Packet Examples

Communication Overview

To control Dynamixel, communication should be established according to the protocol of Dynamixel. Dynamixel is driven by receiving binary data. Examples of programs for the transmission of this kind of data are described in detail in the User’s Manual of the Dynamixel-only controller or the USB2Dynamixel. Thus, this manual describes only the method and protocol of communication used in Dynamixel on the assumption that Main Controller can transfer binary data.

Packet

Main Controller and Dynamixel communicate each other by sending and receiving data called Packet. Packet has two kinds: Instruction Packet, which Main Controller sends to control Dynamixel, and Status Packet, which Dynamixel responses to Main Controller.

ID

ID is a specific number for distinction of each Dynamixel when several Dynamixels are linked to one bus.
By giving IDs to Instruction and Status Packets, Main Controller can control only the Dynamixel that you want to control

Protocol

Dynamixel does the Asynchronous Serial Communication with 8 bit, 1 Stop bit, and None Parity.

If Dynamixel with the same ID is connected, packet will collide and network problem will occur. Thus, set ID as such that there is no Dynamixel with the same ID.

ID of Dynamixel is changeable. For this change, please refer to Changing IDs of Dynamixel. The factory default setting ID is 1.

Half Duplex

Half duplex UART is a serial communication protocol where both TxD and RxD cannot be used at the same time. This method is generally used when many devices need to be connected to a single bus. Since more than one device are connected to the same bus, all the other devices need to be in input mode while one device is transmitting. The Main Controller that controllers the Dynamixel actuators sets the communication direction to input mode, and only when it is transmitting an Instruction Packet, it changes the direction to output mode.

Tx, Rx Direction

For Half Duplex UART, the transmission ending timing is important to change the direction to receiving mode. The bit definitions within the register that indicates UART_STATUS are as the following

When changing the direction, the TXD_SHIFT_REGISTER_EMPTY_BIT must be checked. The following is an example program that sends an Instruction Packet

  DIRECTION_PORT = TX_DIRECTION;
  TxDByte(0xff);
  TxDByte(0xff);
  TxDByte(bID);
  TxDByte(bLength);
  TxDByte(bInstruction);
  TxDByte(Parameter0); TxDByte(Parameter1); …
  DisableInterrupt(); // interrupt should be disable
  TxDByte(Checksum); //last TxD
  while(!TXD_SHIFT_REGISTER_EMPTY_BIT); //Wait till last data bit has been sent
  DIRECTION_PORT = RX_DIRECTION; //Direction change to RXD
  EnableInterrupt(); // enable interrupt again

Note Please note the important lines between LINE 8 and LINE 12. Line 8 is necessary since an interrupt here may cause a delay longer than the return delay time and corruption to the front of the status packet may occur.

Byte to Byte Time

The delay time between bytes when sending an instruction packet. If the delay time is over 100ms, then the Dynamixel actuator recognizes this as a communication problem and waits for the next header (0xff 0xff) of a packet again.