Tuesday, June 29, 2010

How to enable USB to SERIAL port(FT232R) in linux....


I am currently developing a robot. This robot has to be controlled using wireless module zigbee. I am using usb to serial converter chip FT232R for this purpose. It is easy to configure this device in windows based platform...you have to just download respective driver from this website..http://www.ftdichip.com/Drivers/VCP.htm but when it comes to Linux it is quite troublesome task. After going through so many website I found one easy way of doing this.


steps

1) First plug the device in usb port and type "dmesg" in terminal...u will see lot of stuff but don't worry..just dump the output in a file.. $ dmesg > out and see the out file..u will find a line like

usb 3-1.3: new full speed USB device using uhci_hcd and address 5

this means device has recognised by system.
2) "unplug" the device and type "lsusb" command... output will look like this

Bus 003 Device 003: ID 413c:8161 Dell Computer Corp.
Bus 003 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0c45:63ee Microdia

then "plug" the device again and type "lsusb" again in terminal and see the output...u will see one additional line is there...

Bus 003 Device 003: ID 413c:8161 Dell Computer Corp.
Bus 003 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 003 Device 002: ID 4313:6001 FTDI 232r usb to serial....
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0c45:63ee Microdia

In this line 4313 is vendor id and 6001 is product id. just type following line in terminal

sudo modprobe usbserial vendor=0x4313 product=0x6001

type "dmesg" again and u will see something like this in last line of output..

usbserial_generic 3-1:3.0: generic converter detected
usb 3-1: generic converter now attached to ttyUSB0
usbcore: registered new interface driver usbserial

3) type this on terminal:- sudo gedit /etc/modules and add line "usbserial vendor=0x4313 product=0x6001" without quotes.
this will enable linux to automatically detect device...

4) Verification:
type "cd /dev" in terminal and check output...u will find ttyUSB0 there..means u r done...

cheers........