SPI 101: Serial Peripheral Interface

This blog series is focused on SPI hacking with practical application in hardware analysis, firmware extraction, and embedded device inspection. Understanding this protocol is essential before moving on to hands-on tools and extraction techniques, which will be discussed in upcoming parts.
This post is for the curious: the makers, the tinkerers, and the hackers who want to understand what SPI is, how it works, and why it matters in real-world hardware hacking. We’ll cover everything from the basics of the protocol to how it plays into accessing flash memory chips. Whether you’re trying to dump a router’s firmware or dig into an old motherboard.
SPI stands for Serial Peripheral Interface, a synchronous serial communication protocol used for short-distance communication, primarily in embedded systems. It enables a master device to communicate with one or more slave devices using separate lines for data transmission and clock signaling.
SPI is commonly found in systems involving flash memory, sensors, ADCs, and other digital components. In the context of hardware hacking, it is most frequently used to interface with SPI flash memory chips that store firmware or BIOS data.
The SPI protocol is based on a master-slave architecture. The master initiates communication and controls the clock, while one or more slave devices respond to commands.
Signal | Full Name | Direction | Description |
---|---|---|---|
MOSI | Master Out, Slave In | Master → Slave | Data sent from master to slave |
MISO | Master In, Slave Out | Slave → Master | Data sent from slave to master |
SCLK | Serial Clock | Master → Slave | Synchronizes data transmission |
CS | Chip Select (Active Low) | Master → Slave | Enables specific slave for communication |
Two additional lines, VCC and GND, are required to power the slave device and establish a common ground.
SPI is widely used in flash memory chips found in embedded devices. These memory chips often store the firmware responsible for device operation. Accessing and manipulating this firmware is a critical step in many hardware security assessments.
If you can access that SPI chip physically,you can read or write its contents.
Here are just a few real-world uses:
Most SPI flash chips follow the 25-series standard (like Winbond W25Q64, Macronix MX25L, etc.) and are often SOIC-8 packages – eight tiny legs soldered onto the board.
You’ll find them on:
Most SPI flash chips are in a Small Outline Integrated Circuit (SOIC-8) form factor.
These are small rectangular chips with 8 pins 4 on each side.
Use a magnifying glass or macro camera to read the markings on the chip. Typical identifiers include:
Flash memory is usually placed close to the main processor or system-on-chip (SoC), as it's directly accessed during boot.
Once you identify the part number, search online for its datasheet. This confirms whether it supports SPI and helps you verify the pinout for connection.
SPI is a step-by-step communication protocol between a master (e.g., CH341A programmer) and a slave (e.g., SPI flash chip). Here's how it works:
Activates the target chip. Only the chip with CS pulled low will respond.
The master sends an instruction (e.g., Read, Write, Erase) over the MOSI line.
Example commands:
0x9F
– Read chip ID 0x03
– Read data 0x02
– Write dataThe master sends clock pulses over the SCLK line.
Each bit of data sent or received is synchronized with one clock pulse.
The slave sends data back over MISO (e.g., firmware data, chip ID).
Ends the communication. The chip stops responding and resets its SPI interface.
This process repeats during firmware reading or writing, handled automatically by software tools like Flashrom.
When working with SPI flash chips, always follow proper electrical and handling precautions:
Understanding how SPI works is essential before attempting to read or write firmware. In real hardware hacking scenarios, this knowledge helps you:
In practice, this means you'll be able to confidently interact with SPI flash chips, extract firmware binaries, and analyze them which is the core of many hardware security tasks.
This post introduced the core concepts of SPI communication and how it's used in hardware hacking. We explored how SPI works, how to identify flash chips, and key considerations when handling them. Understanding these fundamentals is essential before attempting to interface with real hardware.
In the next post, we’ll move from theory to practice. You’ll learn about the tools needed to work with SPI flash memory, how to identify the correct chip, make proper physical connections, use appropriate software, and ultimately extract the firmware (bin) file from a device.