Hammer How to USB FTDI

From eLinux.org
Jump to: navigation, search

This page shows how to configure the FTDI serial adapter for use with the hammer.

Configure the FTDI driver into the kernel

cd linux-2.6.22
make menuconfig
Enable the FTDI Serial Converter Driver
   Device Drivers --->
      USB Support --->
         USB Serial Converter Support --->
   <M> USB FTDI Single Port Serial Driver (EXPERIMENTAL)
Exit, saving your changes
make
make modules_install INSTALL_MOD_PATH=../buildroot/project_build_arm_nofpu/Hammer/root/

This will compile the various kernel modules required and install them in the appropriate location in the root filesystem.

Make sure that /dev/ttyUSB0 gets created

Since the /dev entries are staticlaly defined, we need to ensure that /dev/ttyUSB0 gets created. Edit the buildroot/target/device/Samsung/Hammer/device_table.txt file. Copy the /dev/ttyS line to create a /dev/ttyUSB line. You need to change the name (ttyS to ttyUSB), the major (4 to 188), and the minor (64 to 0).

/dev/ttyS   c   666 0   0   4   64  0   1   4
/dev/ttyUSB c   666 0   0   188  0  0   1   4

Make sure that the ftdi_sio.ko module gets loaded at boot time

Edit the buildroot/project_build_arm_nofpu/Hammer/root/etc/inittab file and add a new entry after the rcS entry:

::sysinit:/etc/init.d/rcS
::sysinit:/sbin/modprobe ftdi_sio

Recreate your rootfs image

cd buildroot
rm binaries/Hammer/rootfs.arm_nofpu.ext2
make

Compile a simple serial test program

Compile sertest.c using the command line:

arm-linux-gcc -lpthreads -o sertest sertest.c

Transfer the sertest program to the hammer (I put it in /mnt/flash). You can use the rx command:

rx /mnt/flash/sertest
chmod +x /mnt/flash/sertest

and send the sertest program using X-Modem with your serial program. You can run sertest using the following command line:

/mnt/flash/sertest -p /dev/ttyUSB0

If you connect Tx to Rx on the FT232RL module, then you should see what you type.