Ubuntu 11.10 Oneiric Ocelot and Arduino Uno R2

Hello,
I'm running Ubuntu 11.10 Oneiric Ocelot on a Dell XPS 15 and I'm trying to use my new Arduino Uno without success. This is what happened.

I installed the 0022 Arduino software from the Ubuntu repositories. When I connected the board with the USB for the first time, the LED on pin 13 was blinking once every second, just like in the Blink sketch.
The first time I was able to upload a modified version of Blink (with different delays) and it worked nicely. However after that I wasn't able to upload anything more.
The Arduino keeps repeating what was coded in the last uploaded sketch, but the Tools>Serial Port menu is grayed out, and if I try to upload it says

Binary sketch size: 2240 bytes (of a 32256 byte maximum)
processing.app.SerialNotFoundException: Serial port '/dev/ttyACM0' not found.  Did you select the right one from the Tools > Serial Port menu?
	at processing.app.Serial.<init>(Serial.java:153)
	at processing.app.Serial.<init>(Serial.java:76)
	at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:75)
	at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:93)
	at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:56)
	at processing.app.Sketch.upload(Sketch.java:1603)
	at processing.app.Sketch.exportApplet(Sketch.java:1568)
	at processing.app.Sketch.exportApplet(Sketch.java:1524)
	at processing.app.Editor$DefaultExportHandler.run(Editor.java:2293)
	at java.lang.Thread.run(Thread.java:679)

Sometimes, when I disconnect and reconnect the USB and restart the IDE, I can select the serial port again. However as soon as I do anything (like opening an example sketch) it grays out again.

Everything works normally with Windows 7, including uploading new sketches, so the problem is not in the board.

I have tried every solution I've seen on the internet for the last 2 days, without results.

  • I think I've updated the firmware through Windows, but I don't know how to verify that.
$ ll /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 2012-01-22 17:45 /dev/ttyACM0
  • I've already tried adding myself to the dialout group, or chowning the port directly.

  • I've also tried making a symlink from /dev/ttyACM0 to /dev/ttyUSB0.

$ locate -i rxtx
/usr/share/matlab/bin/glnx86/librxtxSerial.so
/usr/share/matlab/java/jarext/RXTX.rights
/usr/share/matlab/java/jarext/RXTXcomm.jar
/usr/share/matlab/toolbox/rtw/targets/c166/blocks/c166_c_can_rxtx_validate.m
  • As you can see the only files with "rxtx" are in the matlab folders, so maybe they're unrelated. Is there something I should do in this case?

  • I also thought that the problem might be the cable, because It was originally from a digital camera and it has a cylindrical "box" with electronics in it along the cord. However it works fine in Windows, so it should be ok.

lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 003: ID 0408:2fb1 Quanta Computer, Inc. 
Bus 003 Device 003: ID 2341:0001  
Bus 003 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
  • The arduino is detected by the system (the second from last in the list).

What else can I try?

If the serial menu is greyed out, then you do not have the proper permissions to access the serial ports. These are my groups. I had to add uucp manually. The Ubuntu install did not do that one correctly.

tim@tim-desktop:~$ groups
tim adm uucp dialout cdrom lpadmin admin

You need to logout and login again for the group permissions to take effect.

Thank you, but it doesn't appear to have any effect. Also, running arduino as root still gives the same symptoms.

Just so I understand, when you select Tools - Serial Port, do you see any serial ports (like /dev/ttyS0 and /dev/ttyS1) without the Arduino plugged in? Are they greyed out? Or can you select one of those?

Add: When the Arduino is plugged in, do you see it in that selection and it is greyed out?
Or is the Serial Port selection greyed out and you cant select anything?

The only port that ever appeared in Tools>Serial Port is Arduino's one (/dev/ttyACM0), but even that only for a moment, because then the whole "Serial Port" submenu becomes grayed out.
The funny thing is that it worked once.

nacest:
The funny thing is that it worked once.

That is why I first suspected a change in permissions. If it worked once, then you logged out and back in, and it didn't, then that may have reset the permissions. But then it wouldn't just appear and disappear later if it were the permissions.

Have you tried changing that usb cable, just to make sure nothing is up with it? I know you said it works with your Windows machine, but...

BTW, I am using Ubuntu v11.10 without any problems.

Edit: Is the listing "/dev/ttyACM0" appearing and disappearing along with the listing in "Tools - Serial Port"?

I'll try to buy another cable today.
When "Serial Port" is grayed out it doesn't open any submenu, so "/dev/ttyACM0" is not displayed. For the few first seconds after I connect the arduino it does appear though, but I don't have time to do anything before it becomes unselectable.

Ok, I've changed the cable and the behavior is the same as before.

It must be a software issue. One thing that's not very clear to me is how RXTX works. The package librxtx-java 2.2pre2-8 was already installed on my system. Is that all that is needed? As I showed in my initial post the only files containing "rxtx" are in the matlab installation folders.

Right now there's nothing else that comes to mind.

It sounds a bit like the old firmware bug, but I thought that was fixed in R2. Can you run:

sudo lsusb -d 2341:0001 -v | grep bcdDevice

If it returns 0.00 it's a buggy firmware, there's some instructions to fix it somewhere on the Arduino site.

If you were using a USB hub, use a port directly on the computer instead, Unos on Linux are more reliable that way.

Thanks stimmer, this is what I get.

# lsusb -d 2341:0001 -v | grep bcdDevice
bcdDevice            0.01

I did update the firmware through windows, and I didn't get any error, but I didn't have any guarantee that the new firmware was actually installed. Does this mean that it is?

EDIT: I'm using the laptop's main usb ports.

Yes, 0.01 is the new firmware. The buggy firmware had version 0.00

If you hold down the reset button as you plug the cable in, are you then able to upload a sketch?

When disconnecting and reconnecting the USB cable, it's best to disconnect, count to ten, reconnect and count to ten again to be sure everything got properly reset.

The dmesg command might say something useful too.

Ok, if I plug it in while holding reset, the "Serial Port" submenu is visible, and inside it the /dev/ttyACM0 appears, already selected. However, like before, after I do anything (like opening the serial monitor or a new sketch) the whole submenu becomes gray again.

After ttyACM0 disappears, run dmesg. Does it say that there has been a USB disconnect too? (run lsusb too, see if the Arduino is still listed)

Using windows, upload some program which generates some serial output, then on LInux try running a different serial monitor (gtkterm for instance) without loading the Arduino software. If ttyACM0 disappears again you will know that it's not the Arduino software at fault.

Ok, for the dmesg part. I actually found something that may be related.

This is what appears after I plug the usb in:

[ 5664.616404] usb 3-1: new full speed USB device number 4 using xhci_hcd
[ 5664.659946] xhci_hcd 0000:05:00.0: WARN: short transfer on control ep
[ 5664.666930] xhci_hcd 0000:05:00.0: WARN: short transfer on control ep
[ 5664.676935] xhci_hcd 0000:05:00.0: WARN: short transfer on control ep
[ 5664.685919] xhci_hcd 0000:05:00.0: WARN: short transfer on control ep
[ 5664.688106] usb 3-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[ 5665.266764] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 5665.271796] usbcore: registered new interface driver cdc_acm
[ 5665.271801] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

After opening the arduino software:

[ 5686.979331] xhci_hcd 0000:05:00.0: ERROR no room on ep ring
[ 5686.979344] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 5686.979354] tty_port_close_start: tty->count = 1 port count = 0.
[ 5688.850592] xhci_hcd 0000:05:00.0: ERROR no room on ep ring
[ 5688.850603] cdc_acm 3-1:1.1: acm_submit_read_urb - usb_submit_urb failed: -12
[ 5688.850611] tty_port_close_start: tty->count = 1 port count = 0.

After confirming that "Serial Port" was grayed out:

[ 5702.685323] usb 3-1: USB disconnect, device number 4

The device is listed in lsusb even after it becomes unreachable by the software.

But the thing that bugs me the most is this message, which appears many times always, regardless of the arduino:

[ 6397.474401] xhci_hcd 0000:05:00.0: WARN: transfer error on endpoint

I don't really understand this stuff, but it appears to be a problem with the USB 3.0 port. I think this could be related to the source of the problem.

(didn't have time to do the serial monitor experiment yet).

Ok, I want to bury myself deep now.

The problem was indeed the USB 3.0, and it may simply be a bug. But until now I was convinced that my laptop had only 2 usb ports, both 3.0...
then I discovered a third, 2.0 port I had never realized I had!
It's a eSATA/powershare combo port, so the shape is different, and I never used it or inspected it carefully enough to notice the little usb logo.

The usb 3 problem is not solved, but now it looks like the arduino works normally with the usb 2 port.

Sorry for all the trouble. :disappointed_relieved:

Thanks for letting us know - if it really is a USB 3 problem I expect it will affect other people too, especially as USB 3 becomes more common.

Tomorrow I might try the USB 3 port on my computer and see if I can reproduce the error.

Yeah it would be nice to get that to work too. I found this bug that may be related:

It took a while to find but my computer does have a USB 3 port hidden on the back, and after plugging my Uno into it I get exactly the same problem as you describe - it uploads once, then stops working.

Unfortunately I can't find an easy workaround so all we can do is just not use USB 3 ports until the kernel is fixed.