# 5.8. Reading and writing from EEPROM and flash

The Pololu USB AVR Programmer v2.x supports reading and writing from an AVR’s EEPROM and flash memories.

If you are using Atmel Studio, you can use the “Memories” section of the “Device Programming” dialog to read and write from EEPROM and flash.

If you are using AVRDUDE, you can use the “-U” option:

• To read from flash and save the contents to a HEX file, use something like -U flash:r:filename.hex:i
• To write a HEX file to flash, use something like -U flash:w:filename.hex:i (and see Section 5.5)
• To read from EEPROM and save the contents to a HEX file, use something like -U eeprom:r:filename.hex:i
• To write a HEX file to EEPROM, use something like -U eeprom:w:filename.hex:i

In the examples above, filename.hex should be changed to actual name of the file you want to use.

Don’t forget to pass the other required options to AVRDUDE. A complete AVRDUDE command to read from EEPROM would look something like this:

avrdude -c stk500v2 -P COM6 -p atmega328p -U eeprom:r:filename.hex:i

You’ll need to change “COM6” to the actual name of the programmer’s programming port, which you can find by running pavr2cmd --prog-port or by following the instructions in Section 4.5.

More information is available in the AVRDUDE manual, which you can see by running man avrdude.

Note: Many AVRs have lock bits which might prevent you from reading the EEPROM or flash without first performing a full chip erase.

## Related Products

(702) 262-6648
Same-day shipping, worldwide