Overview

In your journey hacking, modding and making electronics you will bump into many a FLASH chip. Often times these store program memory, settings, data files etc. Some microcontrollers have built-in flash, but an external flash chip allows for field-updating. Also, fitting a large Flash chip inside a micro or FPGA can increase cost a lot, where-as having it be external lets the customer pick exactly the right size they need. They can range from 256 bytes up to 16 MBytes or even more!

SPI Flash Standardization

The good news is that just about every 8-pin Flash chip has a standard pinout and SPI interface, these tend to have the number 25 somewhere in the beginning of the part number. There are also ones that are only I2C - these will have the number 24 somewhere in the part number. This page is just about SPI flash.

You can pick up any kind/size SPI flash you like over at Digikey

As you can see, SPI flash part numbers tend to start with "MX25" or "W25" or "AT25" or "SST25" etc. The first two letters are the manufacturer name.

The rest of the part number will also contain a 3 digit number that indicates the size in 'kilobits' or 'megabits'. E.g.  010 is 1-Megabit (128 KByte), 080 is 8-Megabit (1 MByte), 016 is 16-Mbit/2MByte. For smaller sizes, all 3 digits are used. E.g. 256 is 256-Kbit (32KByte),

Not only do they have a standard pinout, but there is also a standard-ish set of commands you can use to read and write the data. So, if your flash memory chip has this pinout, chances are you can use a standard command set to program it.

If you want to use an microcontroller...

If you have an Arduino or compatible, check out our libraries (https://github.com/adafruit/Adafruit_SPIFlash or https://github.com/adafruit/Adafruit_TinyFlash) on how to read/write to/from these in a mcirocontroller

HOWEVER

you are here because you do not want to mess with an Arduino - your file that you want to read/write is on your computer, and its big so getting it into a microcontroller is a pain. Instead, in this guide we will use an FT232H as a 'gateway' so that you can use any computer and read/write the SPI flash through the command line.

USB to SPI gateway

You will need the FT232H breakout, and if you have a chip in a package that is not breadboard-able right away you will need a socket or an adapter board.

Adafruit FT232H Breakout - General Purpose USB to GPIO+SPI+I2C

PRODUCT ID: 2264
Wouldn't it be cool to drive a tiny OLED display, read a color sensor, or even just flash some LEDs directly from your computer?  Sure you can program an Arduino or...
$14.95
IN STOCK

3.3V 250mA Linear Voltage Regulator - L4931-3.3 TO-92

PRODUCT ID: 2166
Need a nice little 3.3V regulator? We rather like the very-low-dropout L4931 from ST! This little guy will help you get your 4-20V battery or wall adapter down to a nice clean 3.3V with...
$0.95
IN STOCK

10uF 50V Electrolytic Capacitors - Pack of 10

PRODUCT ID: 2195
We like capacitors so much we made a kids show about them.   They're super handy and it's really helpful to have a variety lying around to pick and choose from....
$1.95
IN STOCK

SMT Test Socket - SOIC-8 Narrow Breakout

PRODUCT ID: 1284
You know those ZIF sockets we have for DIP chips? Well these are just like that but for SMT parts! Yeah, that's right, now you can program and test out your favorite new parts in...
$14.95
IN STOCK

SMT Breakout PCB for SOIC-8, MSOP-8 or TSSOP-8 - 6 Pack!

PRODUCT ID: 1212
Beguiled by a fancy new chip that is only available in a SOIC or MSOP/(T)SSOP pinout? This breakout PCB set will make your life much much easier and get you prototyping faster than ever....
$2.95
IN STOCK

If you're using Windows, you will need to follow these instructions to set up the Zadig tool and replace the default FTDI driver. Make sure you do this step!

Download and compile

We have adapted a helper program for FPGAs. You can check out our version from github.

The easiest way to get started is to just download a zip of the repository:

Uncompress the zip folder. If you are on mac or linux you will need to install the FTDI library and build the executable. Check out the FT232H guide on where to download those files. For Windows, we provide the .exe already

Wiring

Because SPI flash chips run at 3.3V, you will need to regulate the 5V supply on the FT232H down.

Using the L4931-3.3 regulator, make the connections shown in the diagram below.

Make sure to add a 10uF capacitor from the regulator output to ground for stability!

Wire up your FT232H breakout to your flash chip like this (use a socket or an adapter board if it is not a DIP package)

  • D0 on the FT232H to pin 6 on the flash
  • D1 on the FT232H to pin 5 on the flash
  • D2 on the FT232H to pin 2 on the flash
  • D4 on the FT232H to pin 1 on the flash
  • pin 3 (Write Protect) on the flash to 3.3V. If you are only reading from the Flash, you can connect this to ground.
  • pin 4 (VSS ground) on the flash to ground
  • pin 7 (HOLD) on the flash to 3.3V
  • pin 8 (VCC power) on the flash to 3.3v

Run the executable from the folder you downloaded. The argument it takes is the path to the binary file you want to write to the flash. An example might look like this

That's it!

Last updated on 2017-07-03 at 11.43.37 PM Published on 2017-07-03 at 11.43.27 PM