Copy program fom one arduino to another

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to copy a program from one Arduino to another using Avrdude.

I have used the instructions to set up an Arduino uno as an ISP, complete with the 3 leds as recommended.

iv connected the arduinos together as per the instructions (pins 11,12,13 and pin 10 to reset, Gnd and VCC etc) 

The Arduino uno ISP seems to do as required I've managed to reburn a new bootloader to another old Arduino and it behaved as expected.

I have connected the Arduino uno isp to the donor Arduino and I believe I have read the file I require back to the computer.

The file is called "fob.bin" and is a full copy of the flash file from the donor. I have checked the file and it contains valid data.

 

When I try to write file to replacement Arduino it doesn't work.

 

(my input)
C:\Program Files\Arduino Programmer>avrdude -v -p atmega328p -c arduino -P com5 -D -U flash:w:fob.bin:i

 

(output on screen)

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Arduino Programmer\avrdude.conf"

         Using Port                    : com5
         Using Programmer              : arduino
         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     5     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.02s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "fob.bin"
avrdude: WARNING: no end of file record found for Intel Hex file "fob.bin"
avrdude: writing flash (0 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 0 bytes of flash written
avrdude: verifying flash memory against fob.bin:
avrdude: load data flash data from input file fob.bin:
avrdude: WARNING: no end of file record found for Intel Hex file "fob.bin"
avrdude: input file fob.bin contains 0 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 4.42s

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

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Anyone have any ideas of how to overcome this and enable file to be copied. any help greatly appreciated.

Last Edited: Wed. May 13, 2020 - 06:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh that's pretty cool. I don't know how you'd read the memory out of a chip. It'd be great to have a recipe for that.

 

It reminds me I have a lost program running on an AtTiny chip and it would be great to extract it to copy it to a rebuilt project.

 

My GitHub (FAB_LED bitbang for ws2812, DigitalIO, SerialMenu...).
I make portable, code optimized Arduino libraries as a hobby and use AtTiny85 the most for my builds.
I am a burner and an OS and systems programmer by trade.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the:

 

-U memtype:op:filename[:format]

 

command of avrdude the "op" can just as easily be "r" (read) as it can be the more usual "w" (write).

 

I do wonder why OP is using ".bin" not ".hex" thouugh?

Last Edited: Wed. May 13, 2020 - 11:41 AM