Ubuntu – Cannot change baud rate on usb serial device

serial portUbuntuusb

I recently upgraded to ubuntu 12.04 from 10.04. Under 10.04 I had no trouble using usbserial driver to connect to a device through the serial port. After the upgrade usually I cannot reset the baud rate: it is initialized to 9600, but my device needs 115200. When I try to reset the speed I get:

$ sudo stty -F /dev/ttyUSB0 
speed 9600 baud; line = 0;
-brkint -imaxbel
$ sudo stty -F /dev/ttyUSB0 115200
stty: /dev/ttyUSB0: unable to perform all requested operations
$ sudo setserial -av /dev/ttyUSB0
Cannot get serial info: Invalid argument
$ ls -l /dev/ttyUS*
crw-rw---- 1 root dialout 188, 0 Nov 26 10:21 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Nov 26 10:21 /dev/ttyUSB1

The oddest thing is that I have gotten this to work on occasion. The first time I rebooted the system, and it worked. After a shutdown it had the same problem and rebooting did not work, but reloading the driver did. Unfortunately this has not worked since:

$ sudo modprobe -r usbserial
$ sudo modprobe usbserial vendor=0x0403 product=0x6001
$ sudo stty -F /dev/ttyUSB0 115200
stty: /dev/ttyUSB0: unable to perform all requested operations

Best Answer

I think I found the solution to this, in case anyone googles it in the future. My 10.04 did not load usbserial by default, so I had to do it with modprobe usbserial vendor=0x0403 product=0x6001, which I added to /etc/modules. After I upgraded, my 12.04 loads the ftdi_sio driver by default, which is for the embedded device I am using. I didn't change my /etc/modules back, so usbserial was being loaded too, and probably causing some sort of conflict. I removed usbserial from /etc/modules and rebooted, and it worked.

If I were really confident in this solution I would confirm it by rebooting my machine again and seeing if the serial port came up properly - but I would feel pretty silly if I rebooted and lost the connection, since I do need to get work done while I have it.

Related Question