Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save letroll/1f137cc5eeab058902275f2a5b4da032 to your computer and use it in GitHub Desktop.
Save letroll/1f137cc5eeab058902275f2a5b4da032 to your computer and use it in GitHub Desktop.
Arduino backup

CD to a folder like:

mkdir $HOME/Desktop/Backup_Arduino
cd $HOME/Desktop/Backup_Arduino

Set these variables

Arduino Nano Old Bootloader:

export BOARD=atmega328p
export PORT=/dev/ttyUSB0
export BAUD=57600
export PROGRAMMER=arduino
export AVR_DIR=/usr/bin

Arduino Uno:

export BOARD=atmega328p
export PORT=/dev/ttyUSB0
export BAUD=115200
export PROGRAMMER=arduino
export AVR_DIR=/usr/bin

Arduino Mega:

export BOARD=m2560
export PORT=/dev/ttyUSB0
export BAUD=115200
export PROGRAMMER=stk500v2
export AVR_DIR=/usr/bin

Backup

$AVR_DIR/avrdude -n -C /etc/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -U eeprom:r:eeprom.bin:r -U flash:r:flash.bin:r -v
echo "Restore with: $AVR_DIR/avrdude -C /etc/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -D -U eeprom:w:eeprom.bin:r -U flash:w:flash.bin:r -v -v" > readme.md
zip fw_backup.zip readme.md eeprom.bin flash.bin -T

Restore

$AVR_DIR/avrdude -C $AVR_DIR/avrdude.conf -c $PROGRAMMER -p $BOARD -P $PORT -b$BAUD -D -U eeprom:w:eeprom.bin:r -U flash:w:flash.bin:r -v -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment