Linux usb-serial issue Mega 2560 r2/r3

I have a device that uses an Arduino Mega 2560 and tethers to a linux-based computer to receive/send serial commands from a program written in QT that uses QtextSerialPort to communicate.

This solution has worked flawlessly for over a year when I was running Ubuntu 10.04. Recently I was faced with the necessity of upgrading to Ubuntu 11.10, which uses the linux kernel 3.0. Now the serial communication unexpectedly halts and will not work fully again until I unplug the USB cable and plug it back in. The Arduino sketch is running fine and resets when I used stty -a with the /dev/ttyACM0- I see indication from LEDs that the sketch continues to run and is not crashing. The serial port is initialized at 57600 8n1. Again, this has worked flawlessly for nearly a year and only stopped functioning when I introduced Ubuntu 11.10 with Kernel 3.0.

I cannot reliably recreate this problem...so I don't know what is causing it. At first I thought perhaps it was related to the USB-Serial firmware on the Mega 2560 v2 board, so I swapped it for a Mega 2560 v3 board and the problem persists. The syslog on the linux system doesn't show anything out of the ordinary- the serial port never goes away, it just stops functioning. After it hangs, I've opened minicom (a stable terminal program on linux) and managed to get a response from the board, however it appears to hang at some point in the middle of a response. The situation occurred and I issued a command to get the version and it worked twice in a row and then gave me an incomplete response on the 3rd try and then stopped responding. I know the sketch is still running because is servicing the LED's in its main loop. After I exit minicom and launch it again, it resets the board due to the DTR signal and then I can again query for the version string- with it eventually hanging again! If I unplug the USB cable, triggering a reset of the USB driver under linux, the condition is cleared for some time until it again happens putting the driver in this strange state.

I'm really stumped and could use assistance. My belief is that there is some incompatibility with the usb-serial stack and I'm working on a list of things to try, which includes:

  1. Try a different computer running Ubuntu 11.10 - see if perhaps this is a hardware defect on the computer
  2. Replace the USB cable
  3. Try Ubuntu 10.04 again to see if its now occurring with that rev
  4. Replace the arduino Mega 2560 v2 board (Done- replaced with a v3 board didn't affect matters)
  5. Find a way to disable any power management in Linux (not sure how this would impact things)
  6. Look for grounding issues on the device?
  7. Add more debug output on my debug serial port and log all data received on the arduino board
  8. Logic sniffer on the serial pins? Not sure how this will help if its not occurring on previous OS revs
  9. ???? open to suggestions ????

If anyone is aware of an issue with the cdc_acm implementation in kernel 3.0 with respect to the usb-serial on arduino, please let me know. I've read that the usb-serial implementation on these boards is based on LUFA, and wondering if the LUFA guys are aware of any such compatibility issue. If I can't resolve this, I will have to go back to an old OS release or add an FTDI chip to the shield and use it instead of the Atmega8U2/16U2.

Please- if you know of something I'm missing I'd greatly appreciate the help.

Thanks,
Byron

Is there a reference Atmel USB Serial closed source firmware for the Atmega8U2/16U2 that I could try flashing?

I confirmed on Friday that the same code and device still works fine on Ubuntu 10.04. It was operated for several hours straight with no issues, as opposed to running for maybe 20 minutes before the Ubuntu 11.10 cdc_acm driver discontinues communication.

I also confirmed that this problem exists with Ubuntu 11.10 even after upgrading to Kernel 3.2.0. I have not yet tried 3.9.0.

I've been searching for days now trying to find other reports of issues with Ubuntu 11 or Kernel 3.0, and I've not run into much. Apparently most people are still interfacing with 2.6 kernels and older versions of Ubuntu. I wrote the LUFA author to inquire whether he had had any reports of compatibility issues between the usb-serial firmware and linux kernel 3.0, but haven't heard anything back.

If anyone else has observed a similar problem- please let me know. Monday I intend to rule out hardware issues by using a completely different system running Ubuntu 11.10. I may also try an Ubuntu 12 alpha release, although that is not an option for us at this point. I'd love for it to be something I'm doing, but the fact that minicom initially works then freezes seems to indicate that there is some issue between the USB-serial firmware and the Linux 3.x cdc_acm driver.