1
votes

Good day all,

I have an arduino pro micro (Chinese knock off version) with which I am able to flash to with the arduino IDE but I am unable to recreate the same effect with avrdude in the terminal on Ubuntu 16.04

This is what I have observed from the verbose output on the arduino IDE:

Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, } / {} => {}
PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_182426/strandtest.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/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
     User configuration file is "/home/philip/.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_182426/strandtest.ino.hex"
avrdude: writing flash (5918 bytes):

Writing | ################################################## | 100% 0.45s

avrdude: 5918 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_182426/strandtest.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_182426/strandtest.ino.hex:
avrdude: input file /tmp/arduino_build_182426/strandtest.ino.hex contains 5918 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 5918 bytes of flash verified

avrdude done.  Thank you.

Which I have done my best to replicate by using this code:

stty -F /dev/ttyACM0 speed 1200
stty -F /dev/ttyACM0 speed 57600
/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -v -p m32u4 -C /home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -c avr109 -P /dev/ttyACM0 -b 57600 -D -U flash:w:layout.hex

To the extent of using the same avrdude file and configuration as the IDE

However, when I do it this way, I face the following error:

/home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/bin/avrdude -v -p m32u4 -C /home/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -c avr109 -P /dev/ttyACM0 -b 57600 -D -U flash:w:layout.hex

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/philip/Desktop/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/philip/.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: .avrdude: butterfly_recv(): programmer is not responding

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = ""; type = 
    Software Version =  .; Hardware Version = .
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?**
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader

So my question is, why is the Arduino IDE able to detect the type of programmer when the exact same avrdude executable is run through the terminal and yet is unable to flash the hex file?

My best bet is that it has something to do with the forced reset using the baud rate and that the arduino IDE is doing it differently from me, but I am unsure of what I need to change

Any help is greatly appreciated! Thank you.

1

1 Answers

0
votes

Darn I fixed it within 5 seconds of posting the question, heres how I did it

Instead of using the baud rate to reset it I pressed the reset switch and run the exact same code

So the error is here

stty -F /dev/ttyACM0 speed 1200
stty -F /dev/ttyACM0 speed 57600

But I am not sure what exactly about it is wrong, and clarification would be appreciated anyway :)