Annesville
Posts: 6
Joined: Wed May 23, 2012 12:51 pm

Arduino USB connection not working

Tue May 30, 2017 9:48 pm

I am having problems establishing communications between a Raspberry Pi 3 and an Arduino Uno on the standard USB connection.

I am powering the Arduino from an external 9V power supply. Before that I had no success at all.

I have Raspbian Jessie installed and have run the usual apt-get update and apt-get dist-upgrade. I installed the default Arduino IDE package with sudo apt-get install arduino but I could not get it to actually upload tp the Arduino board. I removed the arduino package, and installed the latest IDE (v1.8.2) from Arduino.cc but I am having the identical problems still...

The Arduino shows up for lsusb:

Code: Select all

pi@raspberrypi:~ $ lsusb
Bus 001 Device 004: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
Bus 001 Device 009: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
But it does not always list as a tty device in which case there are errors in dmesg:

Code: Select all

pi@raspberrypi:~ $ dmesg
[355787.688227] brcmfmac: brcmf_cfg80211_escan: Connecting: status (3)
[355787.688239] brcmfmac: brcmf_cfg80211_scan: scan error (-11)
[355834.521294] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
[355835.061280] usb 1-1.2: device not accepting address 6, error -32
[355835.161273] usb 1-1.2: new full-speed USB device number 7 using dwc_otg
[355835.701290] usb 1-1.2: device not accepting address 7, error -32
[355835.801319] usb 1-1.2: new full-speed USB device number 8 using dwc_otg
[355835.850646] usb 1-1.2: device descriptor read/all, error -32
[355835.941283] usb 1-1.2: new full-speed USB device number 9 using dwc_otg
[355835.973517] usb 1-1.2: unable to read config index 0 descriptor/start: -32
[355835.973528] usb 1-1.2: chopping to 0 config(s)
[355835.986026] usb 1-1.2: string descriptor 0 read error: -32
[355835.986049] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
[355835.986061] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[355835.986678] usb 1-1.2: no configuration chosen from 0 choices
[355835.986687] usb 1-1.2: No support over 500mA
[355847.689866] brcmfmac: brcmf_cfg80211_escan: Connecting: status (3)
[355847.689880] brcmfmac: brcmf_cfg80211_scan: scan error (-11)
Unplugging the USB cable and reconnecting it sometimes gives better results, where it lists as /dev/ttyACM0 and dmesg shows more success like this:

Code: Select all

pi@raspberrypi:/dev $ dmesg
[357139.822453] usb 1-1.2: USB disconnect, device number 9
[357153.688442] usb 1-1.2: new full-speed USB device number 10 using dwc_otg
[357157.122550] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
[357157.122560] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[357157.122564] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
[357157.122568] usb 1-1.2: SerialNumber: 5533031363535160B1D0
[357157.153772] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
[357157.154503] usbcore: registered new interface driver cdc_acm
[357157.154509] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
But even then, actually uploading to the Arduino fails. I enabled verbose logging on the Arduino upload and this is the output:

Code: Select all

Archiving built core (caching) in: /tmp/arduino_cache_664260/core/core_arduino_avr_uno_64911034d6446a05af243bd509e434f6.a
Sketch uses 926 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.
/usr/bin/arduino-1.8.2/hardware/tools/avr/bin/avrdude -C/usr/bin/arduino-1.8.2/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_470013/Blink_fast.ino.hex:i 

avrdude: Version 6.3, compiled on Dec 16 2016 at 12:14:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/usr/bin/arduino-1.8.2/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/pi/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMSET"): Broken pipe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
And then, dmesg gives the following output. See the final line which corresponds with the "programmer not responding" message from avrdude:

Code: Select all

pi@raspberrypi:~ $ dmesg
[357139.822453] usb 1-1.2: USB disconnect, device number 9
[357153.688442] usb 1-1.2: new full-speed USB device number 10 using dwc_otg
[357157.122550] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
[357157.122560] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[357157.122564] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
[357157.122568] usb 1-1.2: SerialNumber: 5533031363535160B1D0
[357157.153772] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
[357157.154503] usbcore: registered new interface driver cdc_acm
[357157.154509] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[357491.879909] cdc_acm 1-1.2:1.0: failed to set dtr/rts
USB driver details as follows:

Code: Select all

pi@raspberrypi:/lib/modules/4.9.24-v7+/kernel/drivers/usb/class $ ls -la
total 100
drwxr-xr-x  2 root root  4096 May  4 17:43 .
drwxr-xr-x 10 root root  4096 May  4 17:43 ..
-rw-r--r--  1 root root 44184 Apr 28 03:19 cdc-acm.ko
-rw-r--r--  1 root root 23588 Apr 28 03:19 cdc-wdm.ko
-rw-r--r--  1 root root 24052 Apr 28 03:19 usblp.ko
and

Code: Select all

pi@raspberrypi:/lib/modules/4.9.24-v7+/kernel/drivers/usb/class $ /sbin/modinfo cdc-acm.ko
filename:       /lib/modules/4.9.24-v7+/kernel/drivers/usb/class/cdc-acm.ko
alias:          char-major-166-*
license:        GPL
description:    USB Abstract Control Model driver for USB modems and ISDN adapters
author:         Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik, David Kubicek, Johan Hovold
srcversion:     E6F93DF5B531FBEA275C120
alias:          usb:v1519p0452d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip06in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip05in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip04in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip03in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip02in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip01in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc02ip00in*
alias:          usb:v058Bp0041d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v04E8p685Dd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v04D8p000Bd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v03EBp0030d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v04E7p6651d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p03CDd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0335d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0302d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p01D4d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04CEd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0154d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p026Cd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0275d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0223d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p01D0d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p02D9d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p010Ed*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0178d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p02E3d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p01F5d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0108d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00E9d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p003Ad*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0094d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p007Bd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00A0d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p008Fd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0128d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0099d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00E9d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0070d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04F0d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0071d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0007d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0481d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00ABd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00B0d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0042d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p00FCd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0088d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p002Fd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p046Ed*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0134d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04B2d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04E6d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0420d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p048Ed*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p042Fd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0445d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p000Ed*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04DFd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0486d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0425d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0418d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0508d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0475d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0001d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p044Dd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p0419d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04C9d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p04D8d*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v0421p042Dd*dc*dsc*dp*ic02isc02ipFFin*
alias:          usb:v2912p0001d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v1576p03B1d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v1BBBp0003d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v05F9p4002d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0572p1340d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0572p1329d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D9Ad*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D99d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D97d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D96d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D95d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D93d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D92d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p2D91d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p6425d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2184p0036d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2184p001Cd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v20DFp0001d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0572p1328d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0572p1324d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0572p1321d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0803p3095d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v22B8p7000d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0ACEp1611d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0ACEp1608d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0ACEp1602d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v079Bp000Fd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0482p0203d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0E8Dp3329d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0E8Dp0003d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0870p0001d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v17EFp7000d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v076Dp0006d*dc*dsc*dp*ic*isc*ip*in*
depends:        
intree:         Y
vermagic:       4.9.24-v7+ SMP mod_unload modversions ARMv7 p2v8
and

Code: Select all

pi@raspberrypi:/ $ sudo lsusb -v
...
Bus 001 Device 010: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            2 Communications
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x2341 Arduino SA
  idProduct          0x0043 Uno R3 (CDC ACM)
  bcdDevice            0.01
  iManufacturer           1 (error)
  iProduct                2 (error)
  iSerial               220 (error)
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           62
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0 
      CDC Header:
        bcdCDC               10.01
      CDC ACM:
        bmCapabilities       0x06
          sends break
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval             255
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
...
It feels like I have read every Raspberry Pi/Arduino blog post and forum entry on the whole internet, but I am no closer to getting further than this. Specifically, I have tried the "press the reset button just before it uploads" trick numerous times without success. And I have tried running the Arduino IDE under sudo as well.

I have tested the Arduino with the same cable and everything on a Windows system and it just works first time.

Any suggestions would be welcome! Thanks in advance

User avatar
scruss
Posts: 3142
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Arduino USB connection not working

Thu Jul 06, 2017 1:38 am

What does

Code: Select all

systemctl status ModemManager.service
return?

If it is loaded (Active: anything other than inactive), you may need to:

Code: Select all

sudo systemctl disable ModemManager.service
I just got bitten by this problem for the first time today, and I've been a fairly active Arduino coder for years and never seen it before.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Annesville
Posts: 6
Joined: Wed May 23, 2012 12:51 pm

Re: Arduino USB connection not working

Wed Jul 04, 2018 9:15 pm

Just for the record, the problem was solved with a new high-quality USB cable!

Return to “Troubleshooting”