Program SPI Flash with a FT232H
FTFlash is a Windows application for reading and writing SPI flash memory with a FT232H breakout board. I created FTFlash to be an easy to use click-to-run alternative to existing strategies that use console applications, complex python distributions, or custom USB drivers. FTFlash source code is on GitHub and a zip file containing the EXE can be downloaded from the FTFlash releases page. This page demonstrates interfacing a W25Q32, but the strategies described here should work for any SPI flash chip.

Connection

FT232H | Flash Module | Description |
---|---|---|
D0 | CLK | Clock - Idles low, levels are sampled on the rising edge |
D1 | MOSI | Master Out Serial In - FT232H shifts data to the module |
D2 | MISO | Master In Serial Out - FT232H reads data from the module |
D3 | CS | Cable Select - Idles high, FT232H pulls low to initiate commands |
5V | 3.3V | Use a regultor (like L78L33) to conver 5V to 3.3V |
Screenshots
The test window is used for learning about the connected chip. It can read device IDs, read/write specific memory addresses, and erase the full chip. Use this window to confirm that your device is connected and can be communicated with.
💡 You cannot write to an address multiple times without erasing it first! Programming bytes in flash memory can only flip bits from
1
to0
, and erasing flash memory sets resets all bytes to0xFF
.

The programming window is for reading and writing large amounts of data to and from .bin
files on the local disk. Binary files can be viewed and edited with hex editors such as HxD.


Download FTFlash
- A zip file containing the FTFlash EXE can be downloaded from the FTFlash releases page on GitHub
Read/Write SPI Flash with a Bus Pirate
I use my old school Bus Pirate (v3) any time I start interfacing a chip I haven’t worked with before. The Bus Pirate appears as a USB serial port you can communicate with to send arbitrary SPI or I2C commands. It has a built-in power supply that can deliver 5V and 3.3V too. It’s great way to practice interfacing with unfamiliar chips without having to use a breadboard or write any software.

Bus Pirate Setup
- I’m using RealTerm, display
Ansi
, Baud115200
, Port5
#
- Resetm
- Set mode5
- SPI1
- 30 KHz1
- Clock idle: low2
- Output clock edge: active to idle1
- Input sample phase: middle2
- CS active: low2
- Output type: normal (3.3V/GND)W
- Turn on power supply (3.3V)
Bus Pirate Commands
- reset:
[0x66][0x99]
- read manufacturer and device ID:
[0x90,0,0,0,r:2]
- read unique ID:
[0x4B,0,0,0,0,r:8]
- chip erase:
[6][0xC7]
- write 2 bytes at memory address zero:
[6][2,0,0,0,42,69]
- read 8 bytes from memory address zero:
[3,0,0,0,r:8]
💡 You cannot write to an address multiple times without erasing it first! Programming bytes in flash memory can only flip bits from
1
to0
, and erasing flash memory sets resets all bytes to0xFF
.
Additional Resources
-
W25Q32 (datasheet) - The SPI flash chip with 32Mb / 4MB of memory I used for this project available on Amazon as breakout boards for about $2 each
-
Programming SPI flash with an FT232H breakout (Adafruit) recommends using ftdiflash, a console app I found to be poorly documented and hard to use. Update: The console -h output doesn’t indicate how to write a binary file to the flash device. The linked website does, but not in text, it’s documented as characters in a screenshot of a terminal window. It seems to be as simple as
ftdiflash.exe file.bin
but I didn’t realize this until later. It also doesn’t work with the standard FTDI drivers and requires a third party app “Zadig” to switch the system FTDIBUS driver to libusbK. What a mess. -
Adafruit’s FT232H Breakout page describes actions that require Python 2 which was deprecated at the end of 2019.
-
CircuitPython Libraries on any Computer with FT232H (Adafruit) describes how to program SPI FLASH chips with CircuitPython, but the documentation is fragmented across multiple web pages which I find super unhelpful and this seems like such a simple task that I don’t want to setup a whole Python environment just to pass some bytes.