[SOLVED] Cannot uploading code to Arduino board

Hi all,
Every time I try to access the serial USB port of my Arduino board that it call /dev/ttyACM0,
It will disconnect the serial port and then reset the port, that leads to an error like this.

Arduino: 1.8.19 (Linux), Board: "Arduino Uno"

Sketch uses 924 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "/dev/ttyACM0": Input/output error

And this the debug message that I can see

[  817.675157] usb 1-1.3: Product: Arduino Uno
[  817.675159] usb 1-1.3: Manufacturer: Arduino (www.arduino.cc)
[  817.675161] usb 1-1.3: SerialNumber: 12354501101136710365
[  817.675875] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
[  829.621381] usb 1-1.3: USB disconnect, device number 13
[  838.018752] usb 1-1.3: new full-speed USB device number 14 using ehci-pci
[  838.117514] usb 1-1.3: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[  838.117531] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[  838.117537] usb 1-1.3: Product: Arduino Uno
[  838.117541] usb 1-1.3: Manufacturer: Arduino (www.arduino.cc)
[  838.117545] usb 1-1.3: SerialNumber: 12354501101136710365
[  838.118576] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
[ 1409.984337] usb 1-1.3: reset full-speed USB device number 14 using ehci-pci
[ 1415.237928] usb 1-1.3: USB disconnect, device number 14
[ 1415.314078] usb 1-1.3: new full-speed USB device number 15 using ehci-pci
[ 1415.416354] usb 1-1.3: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[ 1415.416362] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 1415.416365] usb 1-1.3: Product: Arduino Uno
[ 1415.416367] usb 1-1.3: Manufacturer: Arduino (www.arduino.cc)
[ 1415.416369] usb 1-1.3: SerialNumber: 12354501101136710365
[ 1415.417486] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device

And I have loaded cdc_acm and ch341 also, but can not solve the problem. Maybe it is the fault of the board?
Thank all.
P/S: My board is Arduino Uno R3, using ATmega328P

There are several things that come to mine. Try this:
Type 'groups', is 'dialout' there, if not do the following ?
sudo usermod -a -G tty yourUserName - sudo usermod -a -G tty gil
sudo usermod -a -G dialout yourUserName
Log off and log on again for the changes to take effect. (I just restart)

I found this in my notesL"Run the dmesg, is there any reference to BRLTTTY? If yes, uninstall BRLTTY or create udev rules to disable it. It has been mentioned a few times on the forum, a search for BRLTTY should give you the pointers how to do it.

Note that dmesg output can be very long; I'm not sure when BRLTTY will show up, possibly just after the detection of your board. In that case, you can use dmesg -w (use C to abort).

After I run ls -l /dev/ttyACM0

crw-rw---- 1 root uucp 166, 0 Oct 18 09:10 /dev/ttyACM0

And my user is in uucp group.
I have searched for the "BRLTTTY" but no result found.
This is the message for dmesg -w

[  521.407186] usb 1-1.2: reset full-speed USB device number 8 using ehci-pci
[  526.660843] usb 1-1.2: USB disconnect, device number 8
[  526.733725] usb 1-1.2: new full-speed USB device number 9 using ehci-pci
[  526.832663] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[  526.832671] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[  526.832674] usb 1-1.2: Product: Arduino Uno
[  526.832676] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
[  526.832678] usb 1-1.2: SerialNumber: 12354501101136710365
[  526.833468] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device

Are you sure you have a good USB cable, an intermittent would will do that as well. Try another cable and board, then if that works narrow down to the problem child.

After I tried the new board, everything worked fine. So the problem is the fault of the board. Thanks for your responsibility!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.