spacer

Dynamixel AX-12+ Protocol

The dynamixel AX-12 is a powerful, feature rich, network servo that can report voltage, temperature, load, speed, and position through an easy to use protocol.

AX-12
space
AX-12+ Network Protocol

The Dynamixel AX-12 is a new breed of smart servos. Each AX-12 contains a microcontroller that handles:

  • Network communications
  • Angular positioning and velocity control
  • Real-time positon, speed, voltage, and load reporting
  • Auto shut-down/error reporting
  • Adjustable operational parameters

AX-12s commands are processed through a simple packet protocol. See the "Structure of a Dynamixel Instruction Packet" example below.

Dynamixel AX-12 Communication Protocol

The AX-12 network uses a instruction/status packet protocol AX-12 Packets
Packets over the multi-drop serial bus
to control the AX-12s connected to the multi-drop serial bus. Each instruction packet consists of a unique AX-12 ID, packet length, instruction, parameters, and a checksum.

Detailed information on the Dynamixel communication protocol can be found in the Dynamixel AX-12+ Manual starting on page 9.

Structure of a Dynamixel Instruction Packet

Let's say we want to light the LED on AX-12 ID #6. We would send the following instruction packet down the AX-12 bus.

0xFF 0xFF 0x06 0x04 0x03 0x19 0x01 0xD8

Start bytes

Take a look at the instruction packet, notice that the first two bytes are the same 0xFF. These bytes signal to the AX-12 network get ready an instruction is on the way!

Dynamixel ID

The next byte, byte 2 counting from zero, is the AX-12 address. Since we’re trying to light the LED on ID #6 we send 0x06 in the ID position. If we wanted to light all LEDs on the bus we could have used the broadcast ID, 0xFD.

Length

Byte three is the length byte which equals 0x04. This tells AX-12 #6 to expect 4 more bytes. If you take a look in the AX-12 manual on page 10 you'll find length is a calculated value
Length = (the number of parameters + 2).

Instruction

Next comes the instruction byte at position four. Instruction 0x03 is a "Write Data" instruction. This tells ID #6 that we’ll be writing values to its control table.

Each AX-12 contains a control table. Every table cell has a unique address starting at 0x00 (model number) and ending at 0x49 (punch high). Writing values to the control table allow us to control AX-12 behavior. Reading the values from the control table allows us to view real-time AX-12 status.

Parameter 1 [Start Address]

Byte 5 is the first parameter byte. This byte tells #6 that we'll start writing data at control table address, 0x19. If you look in the AX-12 manual you will see that address 0x19 controls the LED.

Parameter 2 [data]

The next parameter byte is the actaul data to write to address 0x19. Since we want to light the LED we write a 0x01. Writing 0x00 would turn the LED off.

CheckSum

The last byte is the checksum. A checksum is a calculted valued used to validate that the instruction packet was received intact. The checksum is calculated as follows:

~(ID + Length + Instruction + Parameter 1 + Parameter 2 + Parameter N)

The “~” means inverse.

So let’s do the math. First we’ll do the hexadecimal addition.

0x06 = ID
0x04 = Length
0x03 = Instruction
0x19 = Parameter 1 (Start address)
0x01 = Parameter 2 (value)
0xD8 = Checksum

In Hex we have
0x06 + 0x04 + 0x03 + 0x19 + 0x01 = 0x27

In decimal it would be
6 + 4 + 3 + 25 + 1 = 39

Now we need to get the inverse of 0x27. To do that, we’ll convert the hexidecimal value 0x27 to binary. If after the addition we end up with a number larger than a byte 0xFF (255), then use only the lowest 8 bits.

0x27 = 0010 0111

Invert the bits (0 = 1 & 1 = 0)and convert back to hexideciaml.

1101 1000 = 0xD8

There you have it! To light the LED on AX-12 ID #6 send the instruction packet
0xFF 0xFF 0x06 0x04 0x03 0x19 0x01 0xD8.

Other Dynamixel Instructions

If you understand the example above you now know how to fomat 85% of the Dynamixel AX-12 instruction packets. There are 7 instruction packets.

  • Ping
  • Read Data
  • Write Data
  • Register write
  • Action
  • Reset
  • Sync Write

The Sync Write is the one instruction that's a little different than the others.

Need help? Check out the Agave Robotics Community Forums.