Hi All.
Getting Arduino working properly under Linux can be a trouble. Sad but true.
Here is my story.
Recently I decided to use my PC (Ubuntu 16.04 64bit) for plays with my Arduino UNO (clone based on ATMEGA328-P).
I've downloaded latest Arduino IDE 1.8.3 for my platform from official site.
Installation procedure was pretty simple: I've unpacked .tgz and run ./install.sh script.
Well done!
Then I've connected my Arduino-clone to my Linux PC via USB cable (the Power led near the ICSP header is lit up, the yellow led marked "L" thrice blinked and then lit up constantly too.),
After that I've run a command into console:
$ ls -l /dev/ttyACM*
as a result I've got:
crw-rw---- 1 root dialout 166, 3 Jun 16 10:00 /dev/ttyACM0
Ok, now lets deal with file permissions for properly serial communication.
I've added my current Linux username to group "dialout".
Then I've re-login and checked:
$ id
uid=1000(ks) gid=1000(ks) group=1000(ks),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),131(libvirtd)
All systems go! Lets play.
I've run Arduino IDE and selected basic "Blink" project from Examples.
Then I've checked port (/dev/ttyACM0) in Tools menu and pressed "Download".
The project was succesfully downloaded into Arduino. The yellow led is nicely blinking.
Great. Inspired by the result I've tried to download another project, and... my Arduino is stop working and /dev/ttyACM0 is lost.
Ok. Replugging is a solition! Heh. No, not at all.
I've run dmesg -w, replug and see:
usb 1-1.2: new full-speed USB device number 3 using ehci-pci
usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
usb 1-1.2: SerialNumber: 9553034313535181D1F0
cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[2 second later]
usb 1-1.2: USB disconnect, device number 3
Strange isn't?
I've ran through the arduino.cc website in search of a reason and any solution but without significant result.
But still I have noticed an interesting thing: /dev/ttyACM0 still present while Reset key is pressed.
And If I try to download a simple empty sketch (only set+loop functions) while Reset key is pressed, my Arduino is back to working condition.
If I try to use small sketch (a set of Serial.println for example) I get same result. But my Arduino hangs up if I try to use something more complicated.
Whats the hell?
I'm sure, it is not USB or cabling issue.
Any help were great appreicated.