Cannot upload to Arduino from Raspberry Pi

(See my post on the Raspberry Pi forums too, with the same info)

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 (ARM package, manually corrected the resource name in install.sh) but I am having the identical problems still...

The Arduino shows up for lsusb:

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:

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:

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:

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:

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

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

The USB driver details are as follows:

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

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:v076Dp0006d*dc*dsc*dp*ic*isc*ip*in*
depends:        
intree:         Y
vermagic:       4.9.24-v7+ SMP mod_unload modversions ARMv7 p2v8

and

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)
...

Annesville:
(See my post on the Raspberry Pi forums too, with the same info)

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.




I got this same message about programmer not responding and I can't get mine to work at all not even by restarting or unplugging usb

see it razzpisampler sheds any light

ieee488, the guidelines there involve editing /etc/inittab whereas Raspbian Jessie uses systemd instead.

Nevertheless, I have tried all combinations of serial port and console enabled and disabled (using raspi-config to do the changes).

I had this problem connecting an Arduino Uno to aPi zero W.

All I did was played around connecting the USB cable from the pi to the USB hub (4 ports). Try it on different usb sockets on the USB hub. For me it worked on one but not on the others.

Thanks all for your suggestions. I had forgotten about this thread. The solution was very low tech - a brand new high quality USB cable solved the problem!