EEPROM Programmer W/ Rapsberry Pi and Flashrom

At the office, they’ve been using a SHARQ DSP chip in one of the products and for years they have been using the SHARQ dev board in conjunction with the SHARQ software to program the product.  Turns out the software costs the company $1000 per year for the license.  GROSS.  $1000/year to program an EEPROM chip.  I was tasked with fixing this issue and as it turns out, the Pi is the perfect candidate.  Simply install Flashrom and some dependencies and viola, EEPROM programmer for under $50.  I’m going to outline the steps for you to create your own.  You can flash dozens of EEPROM and ROM chips with this, potentially saving bricked motherboards from the trash bin.

First:  Get a Pi

Install Raspbian via NOOBS on SD card

If you are new to RPi, then you will need to have a monitor, mouse, and keyboard.  There are ways to enable SSH and configure WiFi and boot headless using PuTTY to access the terminal but I won’t dive into that now.

You need to click on the “START” button at the top left (has the raspberry logo).  Scroll down to Preferences, then click Raspberry Pi Configuration.

Click the Interfaces tab and enable SPI for Flashrom to operate correctly.  I also enable SSH and VNC so that I can access the Pi over the network but those are optional.  You will need to connect to WiFi also.

Next, click the icon at the top that looks like a black square with a >_ on it.  This is the terminal program.  We will be installing Flashrom and dependencies via the command line, don’t be scared.

It’s usually a good idea to update the operating system but not required.  To do this type:

sudo apt-get update

Then hit Enter.  Allow the update to download and install then type:

sudo apt-get dist-upgrade

Then hit Enter and allow the upgrade to happen. You will need to type “Y” when it asks you if you want to continue with the upgrade.

If you’ve never used Linux before, the sudo command means “superuser do” which translates to “run with administrator privileges.” The apt-get command is the installer app, essentially.

Now that the OS is updated, let’s install the dependencies that Flashrom needs.

Type:

sudo apt-get install pciutils libpci-dev libusb-1.0 libusb-dev git

This installs a bunch of things, including git, which we will use to clone the Flashrom files.

Next, type:

git clone https://github.com/flashrom/flashrom.git

This clones the latest version of Flashrom to your Pi from the GitHub repository.

Next, type:

cd flashrom

This moves us into the Flashrom directory that git just created.

Next, type:

make && make install

This configures and installs Flashrom into our system.

That’s it.  Flashrom should be properly installed on your system.  You should be able to run Flashrom commands and program chips once you get the hardware wired up properly.  The command I use is:

sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -w erasethisandputyourfilenamehere.hex

The -p tells Flashrom which programmer to use and the -w command means write to the chip whatever filename that comes next.  It doesn’t have to be a .hex file.  The file extension shouldn’t matter as long as the file is in the correct format.  If you want to read your chip, use -r instead of -w and type in a filename to save the read as.

The pinout is as follows:

RPi pin SPI flash
25 GND
24 CS
23 SCK
21 DO
19 DI
17 VCC 3.3V

Be sure to use short wires or you may run into problems.

Here is a picture of my setup, these wires are actually far too long but it worked for me.

Leave a Reply

Your email address will not be published. Required fields are marked *