Dynamixel AX12 motors
Robotis’s Dynamixel AX12 servo/actuator motors are among the most sophisticated servos in the Robotics/hobby market. They have many features but most importantly the servos are controlled through serial commands. This allows one wire to go around many servos and control a complete robot with one wire!
Default baudrate
While the AX12 servo allows you to change the default baudrate, you first must communicate with it on the default baud rate before you could change it!! OK, this sounds simple but not really. The AX12 defaults to 1000000 baud. This is not a standard baud rate and chances are you will never find a terminal nor a serial connection that can be set to 1000000!
Fortunately, FEZ devices can be tweaked to handle 1000000 baud. This is done through register access. You can use the LPC23xx user manual to learn about registers but here is a simple demo to tweak COM1 (UART0) but remember that if you use a different COM port then this must be changed.
SerialPort serial = new SerialPort(“COM1”, 1000000,Parity.None,8,StopBits.One);
serial.ReadTimeout = 100;
serial.Open();
//fix the baud on COM1 to non-standard 1000000
Register U0FDR = new Register(0xE000C028);
U0FDR.Write((8 << 4) | 1);//fix the fractional divider register
// we now have 1000000 ready
// …
Connecting AX12
FEZ Domino with AX12
Reading through the manual you learn that they use TX and RX on one wire. There is no worries about bus collisions because the AX12 servo will not send any data till the controller (like FEZ) requests something. After the controller sends some data, it converts itself from transmitter to receiver.
Controllers usually have 2 pins for transmit and receive, to connect these to the AX12, you will need a simple circuitry to disable/enable the transmit/receive.
Another option is to use software. What we need is to disable TX as long as we are not transmitting and then we need to discard RX after every command since our command will be echoed back. Here is code that does just that…again, this only works on COM1 on FEZ Domino or FEZ Mini. You need to consult the LPC23xx user manual for details.
// enable UART0 TX pin
PINSEL0.SetBits((1 << 4));
// send data
_ser.Write(_packet, 0, 6);
//wait till all is sent
while (_ser.BytesToWrite > 0) ;
//discard echo on RX
_ser.DiscardInBuffer();
// disconnect UART TX pin
PINSEL0.ClearBits((1 << 4));
//the responce is now coming back so you must read it
Start by connecting FEZ COM1 TX and RX together. Then connect the 2 wires to AX12 data pin. It is recommended that you use a 100ohm resistor to protect your AX12.
USB2Dynamixel
The easiest way would be to get started is by using the USB2Dynamexil dongle then switch to FEZ.