SWHarden.com

The personal website of Scott W Harden

Program SPI Flash with a FT232H

How to use a FT232H breakout board to read/write flash memory

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 to 0, and erasing flash memory sets resets all bytes to 0xFF.

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

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

Bus Pirate Commands

💡 You cannot write to an address multiple times without erasing it first! Programming bytes in flash memory can only flip bits from 1 to 0, and erasing flash memory sets resets all bytes to 0xFF.

Additional Resources