Dynamixel SDK for Linux

Dynamixel SDK for Linux can be downloaded.

btn_download.gif DXL_SDK_LINUX_ v1_01.zip

 

[System Requirements]

  ▶ OS : Over Linux Kernel 2.6.21 is recommended

  ▶ USB2Dynamixel is required

 

 

Composing Folder

The structure of Dynamixel SDK for Linux is as follows.

/include     : there are header files to use Dynamixel SDK

/src             : there are Dynamixel SDK source files

/lib              : there are complied library files

/example  : there are examples to control Dynamixels

 

 

Installing USB2Dynamixel Driver and Setting the Response Speed

USB2Dynamixel Driver

 FTDI's FT232RL is used for USB2Dynamixel.

 

Setting USB2Dynamixel Driver Installation Environment

 * Lenux Source Directory

   (Receive the source directly or copy the same source as its own Kernel version through package manager.)

   /usr/src/linux-2.6.28/

 * Temporary directory (empty) to compile USB2Dynamixel Driver

   /usr/src/ftdi_sio

 

Installing USB2Dynamixel Driver

The installation procedure of USB2Dynamixel Driver is as follows.

 

1. Copy the following files to /usr/src/ftdi_sio directory.

/usr/src/linux-2.6.28/drivers/usb/serial/ftdi_sio.h

/usr/src/linux-2.6.28/drivers/usb/serial/ftdi_sio.c

/usr/src/linux-2.6.28/drivers/usb/serial/usb-serial.h

 

 

2. Modify the source codes of copied files to set the response speed to 1msec.

 

2-1. Modify ftdi_sio.c file in USB2Dynamixel Driver directory

- Modified File : /usr/src/ftdi_sio/ftdi_sio.c

Add "define" to the first part of @@ ftdi_sio.c file

#define FTDI_LATENCY_TIMER_DEFAULT 1

 

2-2. Modify Kernel's FTDI Driver

- Modified File : /usr/src/ftdi_sio/ftdi_sio.c

Find ftdi_sio_port_probe() function, and then add the highlighted part with bold letters

The first part of @@ ftdi_sio_port_probe() function

static int ftdi_sio_port_probe(struct usb_serial_port *port)

{

struct ftdi_private *priv;

struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial);

struct usb_device *udev;

int rv;

char buf[1];

dbg("%s", __func__);

udev = port->serial->dev;

priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);

if (!priv)

{

dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,

sizeof(struct ftdi_private));

return -ENOMEM;

}

 

Add the highlighted part with bold letters under create_sysfs_attrs(port) on the last part of @@ ftdi_sio_port_probe() function

usb_set_serial_port_data(port, priv);

ftdi_determine_type(port);

create_sysfs_attrs(port);

 

rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),

FTDI_SIO_SET_LATENCY_TIMER_REQUEST,

FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,

FTDI_LATENCY_TIMER_DEFAULT, priv->interface, buf, 0, WDR_TIMEOUT);

 

if (rv < 0) {

dbg("Unable to write latency timer: %i", rv);

return -EIO;

}

return 0;

}

 

3. Create Makefile in the /usr/src/ftdi_sio directory as below.

The path name of KDIR must be changed to Linux Source directory.

It is written as below since this example uses /usr/src/linux-2.6.28/.

Write as below and save as "Makefile" using proper small and capital letters.

 

obj-m := ftdi_sio.o

KDIR := /usr/src/linux-2.6.28/

PWD := $(shell pwd)

all:

$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:

rm -rf *.ko

rm -rf *.mod.*

rm -rf *.o

rm -rf Modules.symvers

rm -rf .tmp_versions

rm -rf .ftdi_sio*

 

4. Execute "make" and the compiling is completed

If "make" command is executed in /usr/src/ftdi_sio directory, the compiling is completed right away.

 

5. Register Module

5-1. Connect the Pc to USB2Dynamixel.

 

5-2. Check whether Driverf before modification is loaded or not.

If existing Driver of # lsmod // is loaded, ftdi_sio module can be checked.

 

5-3. Erase the existing driver.

# rmmod ftdi_sio

 

5-4. Install new-built driver.

# insmod ftdi_sio.ko

 

* It must be reloaded by insmod command after rebooting.

 

 

Dynamixel SDK Build

If a library is built by "make" command in DynamixelSDK/src folder, it is automatically copied to DynamixelSDK/lib folder.

 

 

Example List

It provides ReadWrite, ScanDynamixel, and SyncWrite.  They are moved to each example folder in DynamxielSDK/example folder and can be built by "make" command.

All examples are supposed to use /dev/ttyUSB0 as the basic device.

 

Please refer to the following link for examples.