A simple 28C16 EEPROM writer for Arduino Nano or Uno based on Ben Eater's EEPROM programmer.
This project includes:
- An arduino project that accepts commands from the serial USB to read or write the EEPROM
- A command line tool for Linux (might work on Mac?) written in C to read and write data files to the EEPROM
The circuit is heavily based on Ben Eater's circuit with a few changes to make it more robust when using an Arduino Uno. The main changes are:
- Don't use pin 13 for write enable (which is used by the Arduino during boot to blink the builtin LED). Instead we use the digital output of analog pins A0 to A2 to control the EEPROM chip enable, write enable and output enable pins.
- Add 10k resistors to pull down the shift register inputs do they don't float wildly while the Arduino is starting
- Add 10k resistors to pull up the enable pins of the EEPROM (chip enable, write enable and output enable) to make it more reliable (especially when arduino is starting up).
The command line tool is written in C. To build it, just enter the cmdline
directory and type make
(make sure you have the necessary stuff installed, like build-essential
if using Ubuntu).
The available commands are:
eeprom dump [ADDRESS [LENGTH]]
Sends the contents of the EEPROM to the standard output formatted as traditional hexdump output. The default ADDRESS
is 0
and the default LENGTH
to the end of the EEPROM. Examples:
./eeprom dump # the whole EEPROM
./eeprom dump 0 64 # 64 bytes starting at address 0
./eeprom dump 0x200 0x80 # 128 bytes (0x80) starting at address 512 (0x200)
eeprom read FILE [ADDRESS [LENGTH]]
Reads the contents of the EEPROM and writes the data to a file. The default ADDRESS
is 0
and the default LENGTH
is the length of the EEPROM. Examples:
./eeprom read file.bin # the whole EEPROM
./eeprom read file.bin 0 64 # the first 64 bytes
./eeprom read file.bin 100 0x20 # 32 bytes (0x20) starting at address 100
eeprom write FILE [ADDRESS]
Writes the whole contents of a file to the EEPROM. The default ADDRESS
is 0. Examples:
./eeprom write file.bin # writes to start of the EEPROM
./eeprom write file.bin 0x400 # writes to the address 1024 (0x400)
The Arduino program (found in arduino/eeprom_writer
) waits for commands from the serial and executes them. The prompt
*READY
is written to the serial port at the start and after every command is executed successfully. If a command fails, the prompt
*ERROR: <message>
is written to the serial port.
The available commands are:
d ADDRESS LENGTH
Reads data from ADDRESS
to ADDRESS+LENGTH
and sends it to the serial it in a classic "hexdump" format. Both numbers must be in hexadecimal.
r ADDRESS LENGTH
Reads data from ADDRESS
to ADDRESS+LENGTH
and sends it to the serial it in a stream of hex digits with no formatting. Both numbers must be in hexadecimal.
w ADDRESS LENGTH
Reads LENGTH
pairs of hex digits (each pair representing a byte) from the serial and writes the bytes to the EEPROM starting at address ADDRESS
. Both numbers must be in hexadecimal. I the data is not sent in 5 seconds, a timeout error is written to the serial and no data is written.