Making a Raspberry Pi based I2C EEPROM Gang Programmer

 

The Software

Right now I am using the software I found at

https://www.richud.com/wiki/Rasberry_Pi_I2C_EEPROM_Program

but I may decide to write my own version later.

To summarize the excellent instructions from the Wiki:

You have to make sure that the following modules are loaded:

  • snd-bcm2835
  • i2c-bcm2708
  • i2c-dev

The first two were already loaded on my Pi, but I did have load i2c-dev

I already i2c-bcm2708 commented out in /etc/modprobe.d/raspi-blacklist.conf, make sure it is commented out on your Pi

add a new file /etc/modprobe.d/i2c.conf with the following line in it:

options i2c_bcm2708 baudrate=400000

Add a couple of packages:

sudo apt-get install i2c-tools hexedit

Fetch, make and install https://darkswarm.org/eeprog-0.7.6-tear5.tar.gz as per the instructions on the Wiki, which has examples on how to use it.

I simply ssh into the gang programmer Pi, and invoke my gang programming script with

sudo ./blast.sh

For now, I just wrote a dead-simple shell script   read each IC into X.bin (where X is the IC socket number), and compare

  • programming all eight EEPROM’s with a “RoboPi.eeprom” image
  • read each IC into X.bin (where X is the IC socket number) for later verification
  • compareeach X.bin (X=0..7) to RoboPi.eeprom, and report bad eeprom burns

Any errors will be visible at the end of the batch programming run.

FYI, it takes just over 25 minutes to program the eight eeproms – 25 minutes that can be used to work on something else 🙂

Here is the blast.sh script I use:


#!/bin/sh

# program all eight sockets

echo "\nPROGRAMMING...\n"

./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x50
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x51
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x52
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x53
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x54
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x55
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x56
./eeprog -f -16 -i robopi.eeprom -w 0x00 -t 5 /dev/i2c-1 0x57

# read back all eight chips

echo "\nREADING BACK...\n"

./eeprog -f -o 0.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x50
./eeprog -f -o 1.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x51
./eeprog -f -o 2.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x52
./eeprog -f -o 3.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x53
./eeprog -f -o 4.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x54
./eeprog -f -o 5.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x55
./eeprog -f -o 6.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x56
./eeprog -f -o 7.bin -16 -r0x0000:0x8000 -t 5 /dev/i2c-1 0x57

# verify all eight chips

echo "\nVERIFYING...\n"
echo "\nif you get a message about any *.bin file having a difference"
echo "then the eeprom in that socket failed to program, or is bad,"
echo "or is inserted the wrong way around.\n"

cmp robopi.eeprom 0.bin
cmp robopi.eeprom 1.bin
cmp robopi.eeprom 2.bin
cmp robopi.eeprom 3.bin
cmp robopi.eeprom 4.bin
cmp robopi.eeprom 5.bin
cmp robopi.eeprom 6.bin
cmp robopi.eeprom 7.bin

For now I run the script from the directory I have the eeprog binary in, however I will likely soon suid root it, and move it into /usr/bin

Future Improvements

Improved software

  • faster burning time
  • auto detection of EEPROM size
  • “read socket 0” button
  • “program” button that programs all sockets with last read image

Improved hardware

  • ZIF sockets
  • LED indicators for which LED is currently being programmed
  • LED indicating “OK” or “ERROR” status for each IC socket

Conclusion

I accomplished what I set out to do – semi-automate batch eeprom programming for RoboPi by making a very inexpensive gang programmer for a total cost of <$60USD, far less than commercial gang programmers.

Granted, the commercial units are faster, can program more devices, but I saved a lot of money making a unit suited to my needs myself – and using a $20 Raspberry Pi Model A with open source software, adding a uSD card, WiFi stick, prototyping board and a handful of parts.

I probably won’t be able to stop myself from tinkering with it, and improving the programming speed and software, and if I do, I will update this article.

p.s.

I invite you to join the Mikronauts forums!

Article Index:

  1. Why am I building a gang programmer?
  2. The Hardware
  3. The Software

Related Links:

Pages: 1 2 3

If you liked this article, please help us grow! "Like" us and let your friends know with the Twitter and Facebook buttons at the top left - We appreciate your support!