🛡️ Secure your IP with 100% Air-Gapped Labs & Signed NDAs
WhatsApp: +86 18928482768 | sales@pcbdesignlab.com

Summary

SPI flash firmware extraction step by step — using a programmer and clip to read, back up, and analyze firmware from SPI flash chips.

SPI flash firmware extraction is the single most common firmware-recovery task in the lab. That’s because a huge number of networked and embedded products keep their firmware not inside the main processor but in a small eight-pin serial flash chip sitting right next to it. Routers, IP cameras, set-top boxes, IoT gateways, industrial HMIs, and many Linux-based boards store a bootloader, a kernel, and a whole filesystem in one of these devices. Reading that chip out with a programmer and a test clip is inexpensive and, done carefully, completely non-destructive — it gives you a bit-exact backup that can be analyzed, archived, or written to a replacement. This guide is a practical, step-by-step procedure for extracting firmware from an SPI flash chip, from identifying the part to verifying the dump.

What an SPI Flash Chip Is

The device is a NOR flash memory with a Serial Peripheral Interface: four shared signals — SCK (clock), SI/MOSI (data into the chip), SO/MISO (data out), and CS# (chip select, active low) — plus a write-protect pin (WP#), a HOLD# pin, and the two power pins. The most widespread family is the Winbond W25Q series, but the same procedure applies to Macronix MX25L, Cypress/Spansion S25FL, and Micron N25Q parts, which are largely command-compatible. Densities are quoted in megabits, so it’s worth converting: a W25Q32 is 32 Mbit, which is 4 MB of storage; a W25Q128 is 128 Mbit, or 16 MB. The physical package is usually SOIC-8 for through-mount work, with WSON and USON used on denser, newer boards.

The Tools

You need three things: a programmer, a way to connect it to the chip, and software to drive it.

  • Programmer. Anything from a low-cost CH341A USB adapter to a TL866/Minipro universal programmer, up to production-grade systems from Dediprog or Total Phase. All of them speak the standard SPI flash command set.
  • Connection. An SOIC-8 test clip (such as the Pomona 5250) clamps onto the chip in-circuit without soldering. For leadless WSON/DFN packages, or when an in-circuit read is unreliable, the chip is desoldered and placed in a socket adapter.
  • Software. The open-source flashrom supports a very wide library of parts and programmers on Linux; vendor utilities and tools such as AsProgrammer or NeoProgrammer are common alternatives on Windows.

Step-by-Step Extraction

1. Identify the chip and its pinout

Read the markings on the package and pull up the pinout from the datasheet. For a W25Q-series SOIC-8 device, pin 1 (marked with a dot or chamfer) is CS#, pin 2 is SO/MISO, pin 3 is WP#, pin 4 is GND, pin 5 is SI/MOSI, pin 6 is SCK, pin 7 is HOLD#, and pin 8 is VCC. Getting pin 1 orientation wrong is the most common cause of a failed detection, so confirm it against the board silkscreen and the datasheet before clipping on.

2. Decide: in-circuit clip or desolder

Try the clip first — it’s faster and avoids rework. The catch with in-circuit reading is that other devices on the same SPI bus, usually the main processor, can load or drive the lines and corrupt the read. With the board unpowered and the flash powered by the programmer, the processor’s pins may still pull the bus around. If detection is flaky or reads don’t verify, the reliable fix is to desolder the flash and read it in a socket, isolated from the rest of the board.

3. Attach the clip and connect the programmer

Clip the adapter squarely onto the package so every jaw makes contact, aligning pin 1 to pin 1. Connect the programmer to the host over USB. Hold WP# and HOLD# high (inactive) — most clips and adapters handle this, but a held-low WP# can block operations on some parts.

4. Detect the chip

Issue the JEDEC ID command (0x9F). The chip returns a manufacturer ID, a memory type, and a capacity byte — Winbond’s manufacturer ID is 0xEF, for example — and the software matches this against its database. If the part isn’t detected, don’t guess: re-seat the clip, check pin-1 alignment, confirm the supply voltage (most are 3.3 V), and check for bus interference from other chips. A correct, confirmed ID is the foundation of everything that follows.

5. Read the full chip — twice

Read the entire array to a raw binary file, then read it a second time to a separate file and compare the two byte-for-byte. Two identical reads are the minimum proof of a reliable dump; a mismatch means a marginal clip contact or bus interference, and the read must be repeated — often at a lower SPI clock frequency, which cures most instability. The parameters the chip reports through its SFDP table (the Serial Flash Discoverable Parameters defined by the JEDEC JESD216 standard) describe its geometry and erase sizes, so the programmer reads the array with the correct layout.

6. Verify and back up

Compute a CRC or SHA checksum over the image and record it alongside the chip’s JEDEC ID, the date, and the source board. Store the image in at least two places. This checksum is what lets you confirm, months later or on a replacement chip, that a copy is still bit-exact. Never write to a chip without first holding a verified backup of its original contents.

The SPI Command Set in Brief

Under the hood the programmer drives the chip with a small, standard command set. Knowing it helps when a read misbehaves:

CommandOpcodePurpose
JEDEC ID0x9FRead manufacturer, type, and capacity to identify the part
Read / Fast Read0x03 / 0x0BStream data out of the array
Write Enable0x06Arm the chip for a program or erase operation
Read Status0x05Poll the write-in-progress and protect bits
Page Program0x02Write up to a 256-byte page
Sector / Block / Chip Erase0x20 / 0xD8 / 0xC7Erase a 4 KB sector, a 64 KB block, or the whole device

Analyzing the Image After Extraction

A raw dump is just bytes until you carve it up. The standard first move is to run Binwalk over the image: it scans for an entropy plot (compressed regions show as high-entropy plateaus, empty erased flash as solid 0xFF) and for known signatures, identifying the bootloader (often U-Boot), the kernel, the device tree, and the root filesystem — typically SquashFS or JFFS2 on embedded Linux devices. Binwalk can then extract the filesystem so you can inspect the actual files: configuration, scripts, web pages, and sometimes hardcoded credentials or version strings that reveal exactly what the firmware is and how old it is. This analysis step is what turns a backup into intelligence, whether the goal is recovery, a security audit, or understanding a protocol.

Writing Back and Modifying

Restoring a backup or writing a modified image reverses the process: erase the relevant sectors (or the whole chip), program the new image page by page with write-enable between pages, and verify by reading back and comparing against the source. Two cautions apply. First, preserve the original layout — the bootloader region, calibration data, and any device-unique settings such as a MAC address must not be overwritten by a generic image. Second, always verify the write and keep the original backup intact until the board is confirmed booting from the new image.

The Router That Wouldn’t Boot After an Update

A customer’s industrial gateway stopped booting after a failed firmware update. The device was a Linux-based router with its bootloader, kernel, and root filesystem on a single 16 MB SPI flash. The update had been interrupted by a power glitch, leaving the flash half-written and the board bricked. They had no backup and no way to recover the device.

We clipped onto the flash in-circuit, read the full chip twice with flashrom, and verified the dumps matched. Binwalk showed the layout: U-Boot at the start, then the kernel, then a SquashFS root filesystem. The interrupted update had corrupted the kernel region but left the bootloader and the calibration data (MAC address, serial number) intact. We extracted a clean kernel from an identical unit, merged it with the surviving bootloader and calibration regions, and wrote the merged image back. The board booted on the first try, with its original MAC and serial preserved. The whole recovery took an afternoon.

An SPI flash clip can save a product in an afternoon — but only if the dump is read twice, compared, and archived before anyone writes a single byte back.

Frequently Asked Questions

Do I have to desolder the SPI flash chip?

Not usually. An SOIC-8 test clip reads most chips in-circuit without soldering. Desoldering is the fallback when the clip read is unreliable or when other devices on the SPI bus interfere with the read, in which case isolating the chip in a socket gives a clean, repeatable dump.

Why does my programmer fail to detect the chip?

The usual causes are wrong pin-1 orientation, a clip jaw not making contact, an incorrect supply voltage, the write-protect or hold pin held active, or another chip on the bus loading the lines. Re-seat the clip, confirm the JEDEC ID against the datasheet, and if it stays flaky, read the chip desoldered.

How do I know the extracted image is complete and correct?

Read the chip twice and confirm the two dumps are byte-identical, then record a CRC or SHA checksum over the image. Any later copy can be validated against that checksum, and a verified double-read catches marginal contacts that a single read would miss.

Can I read a firmware that’s encrypted?

You can read the bytes — SPI flash has no read protection of its own — but if the contents are encrypted you’ll need the key to make sense of them. The encryption key is usually held inside the main processor, not the flash, so extraction gives you the ciphertext and analysis stops there unless the key can be recovered separately.

From a Clip and a Chip to a Working Image

SPI flash extraction is deceptively simple: the command set is small and the tools are cheap, but the difference between a reliable, verified dump and a corrupt one is pure procedure — correct identification, a clean connection, a double-read comparison, and a recorded checksum. PCBDesign Lab performs SPI flash extraction, analysis, and reprogramming as a documented, verified service, from a single recovered board to production backup and cloning. If you have a device whose firmware lives in a serial flash chip, see our firmware reverse engineering service or contact us with photos of the board and the flash chip’s markings.

References

  1. Serial Peripheral Interface reference: https://en.wikipedia.org/wiki/Serial_Peripheral_Interface
  2. NOR flash reference: https://en.wikipedia.org/wiki/NOR_flash
  3. Winbond serial NOR flash (W25Q family): https://www.winbond.com/hq/product/code-storage-flash-memory/serial-nor-flash/
  4. Pinout reference: https://en.wikipedia.org/wiki/Pinout
  5. flashrom — open-source flash programmer: https://www.flashrom.org/
  6. JEDEC — JESD216 Serial Flash Discoverable Parameters: https://www.jedec.org/
  7. Cyclic redundancy check reference: https://en.wikipedia.org/wiki/Cyclic_redundancy_check
  8. Binwalk — firmware analysis tool: https://github.com/ReFirmLabs/binwalk

Get Weekly PCB Engineering Insights!

Practical insights on PCB design, PCB reverse engineering, IC unlocking and hardware development from PCBDesign Lab.

One email each week. Unsubscribe anytime. Read our privacy policy for more info.

Get Started

PCBDesign Lab Has Helped 100+ Customers Build Their Products

Free Consulting