Problems programming Arduino Uno Rev 3 in Linux

Hello

I'm trying to upload my Arduino program to my Uno Rev 3 from a Linux mint virtual machine. but i keep getting "avrdude: stk500_recv(): programmer is not responding".

I only have the USB cable plugged in to tha Arduino.

The error doesn't seem to appear the first time I program it after reconnecting the board, but the second time it fails halfway through the programming:

Sketch uses 928 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.
/home/jacobrosen/opt/arduino-1.8.4/hardware/tools/avr/bin/avrdude -C/home/jacobrosen/opt/arduino-1.8.4/hardware/tools/avr/etc/avrdude.conf -v -V -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_378299/Blink.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/jacobrosen/opt/arduino-1.8.4/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/jacobrosen/.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
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/tmp/arduino_build_378299/Blink.ino.hex"
avrdude: writing flash (928 bytes):

Writing | #########################avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
######avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

This only seems to be happening when I try to upload larger codes. A simple hello world works file:

void setup() {
  Serial.begin(9600);
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

  Serial.write("hello ");

  delay(1000);

}

But when I instead try to print some ascii art of pikachu (source) I get the issue.

#include <avr/pgmspace.h>

const PROGMEM char pika [] = "quu..__\
 $$b  `---.__\
  \"$b        `--.                          ___.---uuudP\
   `$b           `.__.------.__     __.---'      $$\"              .\
     \"$b          -'            `-.-'            $$\"              .'|\
       \".                                       d$\"             _.'  |\
         `.   /                              ...\"             .'     |\
           `./                           ..::-'            _.'       |\
            /                         .:::-'            .-'         .'\
           :                          ::''\          _.'            |\
          .' .-.             .-.           `.      .'               |\
          : /'$|           .@\"$\           `.   .'              _.-'\
         .'|$u$|          |$,$|           |  <            _.-'\
         | `:$:'          :$$$:           `.  `.       .-'\
         :                  `\"--'             |    `-.     \\
        :##.       ==             .###.       `.      `.    `\\
        |##:                      :###:        |        >     >\
        |#'     `..'`..'          `###'        x:      /     /\
         \                                   xXX|     /    ./\
          \                                xXXX'|    /   ./\
          /`-.                                  `.  /   /\
         :    `-  ...........,                   | /  .'\
         |         ``:::::::'       .            |<    `.\
         |             ```          |           x| \ `.:``.\
         |                         .'    /'   xXX|  `:`M`M':.\
         |    |                    ;    /:' xXXX'|  -'MMMMM:'\
         `.  .'                   :    /:'       |-'MMMM.-'\
          |  |                   .'   /'        .'MMM.-'\
          `'`'                   :  ,'          |MMM<\
            |                     `'            |tbap\\
             \                                  :MM.-'\
              \                 |              .''\
               \.               `.            /\
                /     .:::::::.. :           /\
               |     .:::::::::::`.         /\
               |   .:::------------\       /\
              /   .''               >::'  /\
              `',:                 :    .'\
                                    ";

void setup() {
  Serial.begin(9600);
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

  Serial.println(pika);

  delay(1000);

}

When searching for this issue I only found posts about it not working at all.

What I've tried so far:
Changing USB cable
Changing USB Port
Changing avrdude version (6.2 instead of 6.3)
Programming on windows host, works all the time, so this shouldn't be a hardware issue.
Looping back data in a serial terminal.

I'm thankful in advance for any help, I have been trying to get this to work for about 8 hours at this point.

Best regards
/Jacob

Hi Jacob,

it seems, that the serial connection runs out of sync after a while.
Next is a guess and NO scientifical based theory :wink: :slight_smile:

  1. The virtual machine influences the transfer speed...and de-sync
    the whole thing.
  2. The port settings except for the speed are different between Linux
    and the other system. '8N1' is the correct settings as far as I know.

Your Pica-Code prints with one println() statement a complete array.
Try to change this into a loop, whicht println only one line at a time
off the array.

Good luck!
Cheers
mcc

Thank for your answer!

Using this I managed to find this:
https://bbs.archlinux.org/viewtopic.php?id=204718

So it seems like this is not possible due to how the bridge chip resets...

I think I will just use a raspberry pi for the programming as this seems like a more stable solution.

/Jacob

Hello Again

I just wanted to update that i found a solution that worked for me:

Of course with the respective Arduino usb settings instead of the AVR ones.

So far it works for me.

/Jacob