Reading/writing flash memory

There are many possibilities to read from and write to flash memory. This page tries to give a overview of a few practical methods.

Arduino based

The memory is connected to the arduino microcontroller via the standard dedicated i2c pins. Then following sketch is used. After a reset the microcontroller will start outputting in its serial port the contents of the eeprom. With a utility like cool term, byte for byte can be captured and written to a file. After reading all bytes and closing the file, the file is exactly the size of the eeprom.

#include <Wire.h>
 
byte eeprom_i2c_read(int address, int from_addr) {
  Wire.beginTransmission(address);
  Wire.write(from_addr);
  Wire.endTransmission();
 
  Wire.requestFrom(address, 1);
  if(Wire.available())
    return Wire.read();
  else
    return 0xFF;
}
 
void setup() {
  Wire.begin();
  Serial.begin(9600);
 
  for(int i = 0; i < 256; i++) {
    byte r = eeprom_i2c_read(B01010000, i);
    Serial.write(r);
    delay(10);
  }
 
  for(int i = 0; i < 256; i++) {
    byte r = eeprom_i2c_read(B01010001, i);
    Serial.write(r);
    delay(10);
  }
 
  for(int i = 0; i < 256; i++) {
    byte r = eeprom_i2c_read(B01010010, i);
    Serial.write(r);
    delay(10);
  }
 
  for(int i = 0; i < 256; i++) {
    byte r = eeprom_i2c_read(B01010011, i);
    Serial.write(r);
    delay(10);
  }
}
 
void loop() {
}