Unable to upload sketch to Arduino Uno board

Hi,
I need to connect to an Arduino board using Arduino IDE. When I plug in the board, it is recognised and a /dev/ttyACM0 is created and available in the Tools menu of the IDE. However whenever I tried to upload a sketch it give the following error:


avrdude: ser_open(): can't open device "/dev/ttyACM0": Input/output error

I have search on the web and tried the following solution but without success:

  • Add the user to ‘dialout’ group.
  • Change the permission of /dev/ttyACM0 to 666.
  • Disable/Stop ModemManager service.

There was a discussion in one Arch based forum about kernel issues. So I booted into my Kubuntu installation that runs kernel 5.8 and ran the same sketch and it works without any problem. So I tested again with another distro - Garuda Linux (Arch based) also worked without any problem. This was running kernel 5.11.17. So the I deduced that the problem could be just the Tumbleweed kernel.

Then I checked for kernel messages and found this:


May 04 17:31:01 venks-lappy kernel: cdc_acm 3-1.1.3:1.0: acm_port_activate - usb_submit_urb(ctrl irq) failed

At the moment I am running the latest kernel - 5.12.0.2 also without any success.

Any help, guidance or solutions are most welcome. I don’t want to boot into Kubuntu just to do this as I am happy with Tumbleweed.

That is a tough one…

One question: That kernel message timestamp, is that the same time you tried to upload a sketch or was it triggered earlier/later?

It happened at the same time and everytime I tried uploading.

Okay, not sure if it helps but I connected a board, did run Arduino 1.8.9 and uploaded a sketch successfully and below I what I see:

When I connect the board dmesg shows:

[20270.041272] usb 2-3: New USB device found, idVendor=239a, idProduct=800b, bcdDevice= 1.00 
[20270.041277] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 
[20270.041279] usb 2-3: Product: Feather M0 
[20270.041280] usb 2-3: Manufacturer: Adafruit 
[20270.041282] usb 2-3: SerialNumber: 530C7DD4514D503259202020FF181733 
[20270.055549] cdc_acm 2-3:1.0: ttyACM0: USB ACM device 
[20270.056246] usbcore: registered new interface driver cdc_acm 
[20270.056249] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Checking things:

$ ls -als /dev/ttyACM0
0 crw-rw---- 1 root dialout 166, 0 May  5 13:27 **/dev/ttyACM0**
$ groups             
users docker wireshark dialout

Once I uploaded the sketch I see in dmesg that the board disconnects and connects again.

[20414.304328] usb 2-3: USB disconnect, device number 11 
[20415.077516] usb 2-3: new full-speed USB device number 12 using xhci_hcd 
[20415.226116] usb 2-3: New USB device found, idVendor=239a, idProduct=000b, bcdDevice= 2.00 
[20415.226122] usb 2-3: New USB device strings: Mfr=0, Product=0, SerialNumber=0 
[20415.227773] cdc_acm 2-3:1.0: ttyACM0: USB ACM device 
[20417.696988] usb 2-3: USB disconnect, device number 12 
[20418.481531] usb 2-3: new full-speed USB device number 13 using xhci_hcd 
[20418.636490] usb 2-3: New USB device found, idVendor=239a, idProduct=800b, bcdDevice= 1.00 
[20418.636508] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 
[20418.636515] usb 2-3: Product: Feather M0 
[20418.636520] usb 2-3: Manufacturer: Adafruit 
[20418.636525] usb 2-3: SerialNumber: 530C7DD4514D503259202020FF181733 
[20418.641195] cdc_acm 2-3:1.0: ttyACM0: USB ACM device

Do you see any significant differences?

This is what I get in ‘dmesg -w’ when I plugin the board and then try to connect serial monitor from Arduino IDE…


[55305.245690] usb 3-1.1.3: new full-speed USB device number 30 using xhci_hcd
[55305.497743] usb 3-1.1.3: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
[55305.497749] usb 3-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[55305.497750] usb 3-1.1.3: Manufacturer: Arduino (www.arduino.cc)
[55305.497752] usb 3-1.1.3: SerialNumber: 757353230303518001E1
[55305.537975] cdc_acm 3-1.1.3:1.0: ttyACM0: USB ACM device
[55317.312996] cdc_acm 3-1.1.3:1.0: acm_port_activate - usb_submit_urb(ctrl irq) failed  <<== Me trying to connect the serial monitor
[55333.912743] cdc_acm 3-1.1.3:1.0: acm_port_activate - usb_submit_urb(ctrl irq) failed  <<== Me trying to connect the serial monitor

So you do not see the two lines after “ttyACM0: USB ACM device” that I see:

[20270.056246] usbcore: registered new interface driver cdc_acm
[20270.056249] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

If so, that might be the reason your are running into a problem.
Also to double check: the rights on /dev/ttyACM0 are matching and you are member of the dailout group?

Already tried as I have mentioned on the first post.

Okay, that leave the two lines missing.

Can you check if the cdc_acm is loaded and used by used bu usbcore:

lsmod | grep cdc_acm      
**cdc_acm**                45056  0 
usbcore               323584  14 xhci_hcd,ehci_pci,snd_usb_audio,usbhid,snd_usbmidi_lib,**cdc_acm**,usb_storage,uvcvideo,ehci_hcd,btusb,xhci_pci,uas

I think that is not the case.

Please provide also the output of “usb-devices” for the Arduino device.

Here is the output of lsmod:


**cdc_acm**                45056  0
usbcore               323584  6 xhci_hcd,usbhid,**cdc_acm**,uvcvideo,btusb,xhci_pci

This is the output of lsusb:

Bus 004 Device 002: ID 05e3:0620 Genesys Logic, Inc. USB3.2 Hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 048d:c100 Integrated Technology Express, Inc. ITE Device(8910)
Bus 003 Device 003: ID 8087:0029 Intel Corp. AX200 Bluetooth
Bus 003 Device 006: ID 24ae:1813 Shenzhen Rapoo Technology Co., Ltd. E9260 Wireless Multi-mode Keyboard
Bus 003 Device 007: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 003 Device 009: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 003 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 003 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 048d:c955 Integrated Technology Express, Inc. ITE Device(8295)
Bus 001 Device 002: ID 13d3:56ff IMC Networks Integrated Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

As cdc_acm is used by usbcore, I think those two lines missing in the dmesg output are not relevant.

“usb-devices” is a command that dumps detailed information about all USB devices, for me it gives for the Arduino board:

T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=05 Dev#= 11 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=239a ProdID=800b Rev=01.00
S:  Manufacturer=Adafruit
S:  Product=Feather M0
S:  SerialNumber=530C7DD4514D503259202020FF181733
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

Searching for the problem I found Bug 1950958 - cdc_acm acm_port_activate usb_submit_urb(ctrl irq) failed.

My Tubleweed is reporting (“uname -r”) 5.11.15-1-default so I guess you are having something like that. Seems like the 5.13 kernel will fix it.

Hi,
here is my usb-device command output:


T:  Bus=03 Lev=03 Prnt=04 Port=02 Cnt=01 Dev#= 10 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=02(commc) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=2341 ProdID=0043 Rev=00.01
S:  Manufacturer=Arduino (www.arduino.cc)
S:  SerialNumber=757353230303518001E1
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=01 Driver=cdc_acm
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

I am running kernel 5.12.0-2-default at the moment. If I recall correctly, kernel 5.11.15 also had this problem. So I am wondering if this is only my setup???
[FONT=arial]Thanks for helping me out here. I was hoping that this could be solved with a work around but looks like I need to wait for the next kernel version to be released.

Anyway at the moment I am running Arduino IDE on a Ubuntu 18.04 on VBox. Funny thing this setup works! I just have to tick the Arduino’s USB connect in VBox and Ubuntu picks it up.

[/FONT]

The bug page says “So the problem was introduced between 5.11.11 and 5.11.12”.

What kernel version is Ubuntu running? I guess it is an older version.

Your usb-device command output shows some differences with mine but I am no USB expert so I think it is better to wait for 5.13 or you can try an older kernel.

Yes. It is running 5.8.x.

How do I go back to an older kernel with Tumbleweed? Because every new kernel will cause previous to previous kernel uninstalled. Is there a way to keep a specific kernel permenantly?

To keep older kernels, see SDB:Keep multiple kernel versions.

Thanks will look at it later.

The latest kernel update (5.12.2-1) solved the problem! Yay to the devs! I can now upload the sketches.