Pages: [1]   Go Down
Author Topic: The Linux ttyACM0 drama - more details after a lot of experimenting  (Read 14995 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have looked and looked at this ttyACM0 thing with linux and tried just about every fix on the net smiley-eek

I also have a Decimilia and Duemilanove running other projects, both of which work out of the box on the same system and default appropriately to /dev/ttyUSB0 - no issues.

This is what happens on my xubuntu 12.04 system and UNO compatible - Freetronics Eleven.

First - permissions set as recommended for groups and files.

Next - Uno is selected as the board, and when it appears (not grayed out), serial port /dev/ttyACM0.

From the beginning;

Connect board to USB

Code:
dmesg
[ 1562.488131] usb 3-1: USB disconnect, device number 6
[ 1570.049707] usb 3-1: new full-speed USB device number 7 using xhci_hcd
[ 1570.121549] usb 3-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[ 1570.124259] cdc_acm 3-1:1.0: ttyACM0: USB ACM device

Open IDE (1.0 ubuntu installed or 1.0.1 in user folder)

Serial port /dev/ttyACM0 with a tick

But this is where the trouble starts;

Select File (or File > Sketchbook > 'your favorite sketch')

Serial port grayed out; and this

Code:
dmesg
[ 1611.679418] xhci_hcd 0000:0c:00.0: ERROR no room on ep ring
[ 1611.679423] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 1611.679426] tty_port_close_start: tty->count = 1 port count = 0.
[ 1615.390878] xhci_hcd 0000:0c:00.0: ERROR no room on ep ring
[ 1615.390893] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 1615.390903] tty_port_close_start: tty->count = 1 port count = 0.

Now disconnect USB and reconnect;

Serial port /dev/ttyACM0 with a tick. Compile and upload OK, except for

Code:
avrdude: ser_open(): can't open device
"/dev/tty/ACM0" : Input/output error
ioctl("TIOCMET") : Invalid argument

Sometimes the error above doesn't show

Now try selecting the Serial Monitor (bunch of Java errors). Serial port '/dev/tty/ACM0' not found (of course). dmesg output same as previous failure.

This behaviour occurs when connecting and opening the IDE the first time. Second time around is unpredictable as to whether you even get to upload the script.

As I see it, any attempt to use the IDE causes ttyACM0 to become unavailable. I guess, if I understand dmesg output correctly, writing to the device fails, I think?

Reading further, Kernel 3.4 (version from memory) should fix this. Apparently, it's a bug in 3.2, however, some people have found a fix. Interestingly, there is not a lot of consistency to each one.

I have tried a lot of fixes on the net to no avail, except at one point I had it running smoothly. Then looked the other way and sneezed - and of course it broke. Reapplying the previous 'fix' did not fix it.

Hope there's enough here to help, but I guess it's old news anyhow.
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I notice linux is using xhci - are you on a USB3 port? If your computer has any USB2-only ports try using those instead. A few of us have had trouble with USB3 ports on linux. I've upgraded to Kubuntu 12.10 and just checked my Uno on a USB3 port and it seems to be working again.

Please post the output of running "sudo lsusb -v"
Logged


perpignan, france
Offline Offline
Sr. Member
****
Karma: 2
Posts: 341
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use Uno on 12.04, with ttyACM0, and it works ok. But my laptop as only USB2 ports.
Logged

-tu savais que si tu passe le CD de windows à l'envers, tu entends une chanson satanique ?
-non, mais il y a pire : à l'endroit, ça l'instal

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have 1 USB2 port and it works without a hitch. I guess I was looking to fix the USB3 thing. Will have to wait for the new kernel? Will have to find a new spot for the mouse  smiley-eek

Code:
dmesg
[10998.175212] 3-1: USB disconnect, device number 18
[11013.463158] usb 2-1.2: new full-speed USB device number 10 using ehci_hcd
[11013.557924] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device

sudo lsusb -v attached as a .txt file. Too many characters.

* lsusb-v.txt (48.86 KB - downloaded 74 times.)
« Last Edit: October 29, 2012, 05:37:14 am by geoland » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The lsusb output looks fine (although being a clone board it uses different vid and pid numbers to a regular Arduino, so if you install any udev rules you might need to change the numbers)

It looks like the problem is the kernel USB3 driver. All you can do is wait for an updated kernel to be released, or there might be a PPA you can install a newer kernel from. It's probably better to ask on the xubuntu forums about that, they will probably know more.
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. That's the conclusion I came to. I'll wait for 3.4 which is not too far away. Annoying more than any other issue. smiley-confuse
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Or get a USB 2.0 hub (preferably powered) and plug that into your single USB 2.0 port, and plug the other devices into the hub.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6782
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did I see somewhere that this could be fixed with a USB 2 hub on the USB 3 port?
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My own Uno (original R1) doesn't work through a hub in Linux. It has to be connected to a port on the computer. I don't know if this is fixed in later versions of the board.

The new Arduino Due works fine through a hub in Linux (on both ports).
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

USB 2 does the trick.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah! Moving from USB3 to USB2 fixed the problem to me, too!
Thanks for pointing it out!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the hub did not fix the problem for me. but running avrdude as root worked. After that I realize that adding permissions to ttyACM0 for everybody also works. I just executed
sudo chmod 777 /dev/ttyACM0

and after that I could compile and upload the code to the arduino
The only issue with this is that I have to run that line everytime I connect the Arduino to the USB because ttyACM0 is recreated
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The solution here is that you need to run the IDE as a superuser:
sudo ./arduino
to gain the necessary permissions to the serial interface.

cheers,
derick
« Last Edit: October 20, 2013, 04:49:36 am by derick » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 148
Posts: 6104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you must run the IDE as root, you probably do not have the correct group assigned to your user. The Ubuntu install does not (did not on my install) add dialout group to your user. If you add dialout group to your user, log out, then log in again, you should have access to the  Arduino serial.
Code:
sudo usermod -a -G dialout yourUserName
Here is another thread on this:
http://forum.arduino.cc//index.php?topic=160106.0
That user needed to add tty group to the user also. On Ubuntu, I needed to add dialout only.
Logged

Pages: [1]   Go Up
Jump to: