Unable to set baud rate to USB serial port for Ubuntu 12.04

I just updated Ubuntu 10.04 on a project that connects an embedded device via a USB serial port at 115,200 baud. After the update, this did not work, but I rebooted and was able to connect. Since shutting down and restarting my system, I could not connect. The serial line looks like it is connected at the wrong baud rate (a fast character string is like:

"'''''''''''''''''ppppp'''''''''''''''pppppp'''''''''''"... 

The USB device is recognized and configured as /dev/ttyUSB0 . When I try to set the baud rate to stty , I get:

 $ sudo stty -F /dev/ttyUSB0 115200 stty: /dev/ttyUSB0: unable to perform all requested operations 

If I try to set the value to 9600 , this will work:

 $ sudo stty -F /dev/ttyUSB0 9600 

But nothing works:

 $ sudo stty -F /dev/ttyUSB0 4800 stty: /dev/ttyUSB0: unable to perform all requested operations 

This is what stty sees:

 $ stty -F /dev/ttyUSB0 speed 9600 baud; line = 0; min = 1; time = 0; -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke 

I can change other values ​​using stty (echo, echoe, etc.), but not the baud rate.

I saw a comment on the Internet that someone could install baud with Minicom , but not from the command line, so I got Minicom and tried this, but I get the same result (which seems to be the wrong transfer speed).

I also tried seterial, but also refuse to accept /dev/ttyUSB :

 $ sudo setserial /dev/ttyUSB0 -a Cannot get serial info: Invalid argument $ sudo setserial /dev/ttyS0 -a /dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4 Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000 Flags: spd_normal skip_test 

Finally, here are the devices and their installation from dmesg:

 $ ls -l /dev/ttyUSB* crw-rw-rw- 1 root dialout 188, 0 Nov 19 15:53 /dev/ttyUSB0 crw-rw-rw- 1 root dialout 188, 1 Nov 19 16:00 /dev/ttyUSB1 $ dmesg | grep ttyUSB [ 32.444445] usb 4-1: generic converter now attached to ttyUSB0 [ 32.444549] usb 8-2: generic converter now attached to ttyUSB1 

I worked with this device under Ubuntu 10.04 for several months and was able to use them last week, but after closing and rebooting, I could not. I looked online and found several people with a similar problem, but none of them had solutions. How can I fix this problem?

+7
source share
2 answers

I still don’t know what happened, but it’s working now. For those facing the same problem, I tried "modprobe -r usbserial" (I thought if the old driver should be loaded with modprobe -f, it couldn’t), and then reloaded the module "modprobe usbserial", This time the series worked correctly - I don’t know why.

Now when I do stty, it reports:

 ~$ stty -F /dev/ttyUSB0 speed 115200 baud; line = 0; min = 1; time = 0; -brkint -icrnl -imaxbel -opost -isig -icanon -iexten -echo 

and I can change the baud rate (I changed it to 9600 and then back to 115200).

Thus, there is no satisfactory answer, but, apparently, playing with it can make it work - just like it started working the first time after a reboot.

+3
source

To change the settings, permission to write to the device file is required. You can control this with a simple listing. For example.

 $ ls -l crw-rw-rT 1 root dialout 188, 0 jan 9 16:16 /dev/ttyUSB0 

In the above case, everyone has read permission ( r ) of the root superuser and the dialout group also has write permission ( rw ).

If you are a member of the dialout group, you can change the speed without any additional thing mentioned above stty -F /dev/ttyUSB0 115200 otherwise you need to use sudo .

You can manage your membership status with the id command.

0
source

All Articles