Sketch upload fails

Hi,

I installed Arduventure a bunch of times and never had problems uploading new sketches after pressing the reset button during upload. However, the last time I installed Arduventure and tried to re-flash a new program something must have gone wrong and now my Arduboy is stuck in a corrupted state.

Using Arduino 1.8.10 on Linux with the latest Arduboy2 lib. After some flashes it shows artifacts, other times just a black screen. Trying to flash the example ArduBreakout sketch, after pressing the reset pin, results in this:

Found upload port: /dev/ttyACM0
/opt/arduino-1.8.10/hardware/tools/avr/bin/avrdude -C/opt/arduino-1.8.10/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_625973/ArduBreakout.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/opt/arduino-1.8.10/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/alex/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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 : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/tmp/arduino_build_625973/ArduBreakout.ino.hex"
avrdude: writing flash (14796 bytes):

Writing | ####################avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: write block
 ***failed;  
...
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
 *** page 127 (addresses 0x0000 - 0x007f) failed to write
...
 ***failed;  
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
 *** page 127 (addresses 0x0080 - 0x00ff) failed to write
 ***failed;  
 ***failed;  
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
 *** page 127 (addresses 0x0100 - 0x017f) failed to write

 ***failed;  
...

Things used to work fine, same software and OS, so I think something might be wrong with the Arduboy itself. Any thoughts?

Have you always used the butterfly programmer? For my homemade arduboy clones I usually set the programmer to avrisp mkII.

Does it gives you the same error in another computer? i.e. Windows running Arduino IDE?

Thanks for your help!

@sjm4306 I tried mkII, but writing the program fails the same way part way through. I don’t remember making any programmer changes since everything used to work, unless the ESP32 board package changed some global settings when I installed it last month. In the past I was able to switch between Arduboy and the SAMD-based Gamebuino Meta without having to change anything except the board type. Flashing the Gamebuino and Odroid-Go still works fine, but I don’t have another 8-bit AVR device to test.

@eried I tried it on a different Linux computer and with a different USB cable, but it fails the same way. I’ll try it on Windows too when I get a chance, but this is starting to look like a :brick:

You can always unbrick it Bring your Arduboy back from the dead (burn bootloader)

I’m not so sure about that. The Bootloader’s programmer is able to flash partially

But fails writing the 128th page. Looks like programming is interrupted by some event or there is some kind of brown out.

You could also try running the Arduino IDE as admin or change permissions on the port

sudo chmod 777 /dev/ttyACM0