Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back to the "Hardware Surgery" module.
In our last session, you successfully performed the initial disassembly of your x230 and located the two BIOS chips. The patient is prepped and on the operating table. Today, we shift our focus to preparing the surgical instruments. We will assemble the flashing apparatus that will allow us to communicate directly with the firmware chips.
Introduction
This lesson covers the assembly of your flashing tool, which consists of a Raspberry Pi and a SOIC8 clip. You will learn about the communication protocol used, how to prepare the Raspberry Pi, and how to correctly wire the clip to the Pi's GPIO (General-Purpose Input/Output) pins. This is a critical step that requires precision; a correct physical connection is the foundation for all the software steps that follow.
This lesson directly addresses the learning outcome: Assemble the flashing apparatus by correctly connecting the SOIC8 clip to the Raspberry Pi's GPIO pins.
- Estimated time to complete: 60 minutes.
- Brief recap: In the previous lesson, you opened your x230 and identified the 4MB and 8MB BIOS chips on the motherboard. You now have physical access to the target of our operation.
1. Understanding the Communication Protocol: SPI (10 minutes)
Before we connect a single wire, it's essential to understand how the Raspberry Pi will talk to the BIOS chip. Given your background in designing complex systems, you'll appreciate that this isn't magic, but a well-defined protocol: the Serial Peripheral Interface (SPI).
SPI is a synchronous serial communication interface used for short-distance communication, primarily in embedded systems. Think of it as a highly disciplined, four-wire conference call between a "master" (your Raspberry Pi) and a "slave" (the BIOS chip).
The key signals are:
- SCLK (Serial Clock): The metronome. The master generates this clock signal to synchronize data transfer, ensuring both devices are on the same page.
- MOSI (Master Out, Slave In): The master's "talk" line. The Pi sends data to the BIOS chip on this wire.
- MISO (Master In, Slave Out): The slave's "talk" line. The BIOS chip sends data back to the Pi on this wire.
- CS (Chip Select): The "attention" line. The master uses this to select which slave it wants to talk to. It's like addressing someone by name before you speak. In our case, we'll connect this to the chip we want to flash.
- VCC and GND: These are the power and ground lines that provide the necessary electrical reference for the signals.
This protocol is what allows a tool like flashrom on the Pi to read, erase, and write the contents of the firmware chip.
For a good visual overview of these signals in action, you can refer to the following video. It deals with a different board, but the explanation of SPI is universal.
2. Preparing the Raspberry Pi (15 minutes)
Out of the box, the Raspberry Pi's GPIO pins designated for SPI are not active. We need to explicitly enable them so the operating system knows how to use them.
Activity (15 minutes):
You will need to boot up your Raspberry Pi and log in to a terminal to perform this step.
Please read the section "Enable the SPI port" in the following guide and follow its instructions.
How to install coreboot on a Lenovo x230 - stafwag Blog (Prepare Raspberry Pi)
In essence, you are editing the /boot/config.txt file to add or uncomment the line dtparam=spi=on. This dtparam (Device Tree parameter) instructs the Linux kernel on boot to load the necessary drivers to activate the SPI hardware.
After saving the file, reboot your Raspberry Pi for the change to take effect. Your Pi will now be ready to act as an SPI master.
3. The Wiring Diagram: Mapping Pins (25 minutes)
This is the most intricate part of the lesson. A single misplaced wire will cause the connection to fail. The process involves mapping the pins from the BIOS chip, through the SOIC8 clip's cable, to the correct GPIO pins on the Raspberry Pi.
The Three Components of the Connection
- BIOS Chip: You've already located this. The small circular indentation on the chip marks Pin 1. Pin numbering proceeds counter-clockwise around the chip.
- SOIC8 Clip: Your clip is attached to a ribbon cable. Typically, the wire with a red stripe corresponds to Pin 1 of the clip. You must align this with Pin 1 on the BIOS chip when you connect it later.
- Raspberry Pi GPIO Header: This is the double row of pins on your Pi. The pin numbering is specific and can be found in diagrams online.
The Definitive Wiring Plan
We will use the wiring diagram provided in the stafwag blog, as it is clear and tested for the x230. It cross-references the chip's SPI signals with the physical pin numbers on the Raspberry Pi's GPIO header.
Activity (25 minutes):
Your task is to connect the female ends of your jumper wires to the Raspberry Pi's GPIO header according to the table below. The other end of the wires should be connected to your SOIC8 clip, ready for the next lesson.
First, study the wiring table from the guide:
How to install coreboot on a Lenovo x230 - stafwag Blog (Wiring)
Here is a more detailed version of that table, explaining the role of each connection. The "RPI Physical Pin" is the number you'll count to on the header itself.
| Chip Pin | Signal | RPi Physical Pin | GPIO Function | Purpose |
|---|---|---|---|---|
| 1 | CS | 24 | SPI0_CE0_N |
Chip Select: The Pi will use this to activate the BIOS chip. |
| 2 | MISO | 21 | SPI0_MISO |
Master In, Slave Out: BIOS chip sends data back to the Pi. |
| 3 | WP | - | - | Write Protect. We leave this unconnected for now. |
| 4 | GND | 25 | Ground |
Ground: Common electrical reference. |
| 5 | MOSI | 19 | SPI0_MOSI |
Master Out, Slave In: Pi sends data to the BIOS chip. |
| 6 | CLK | 23 | SPI0_SCLK |
Serial Clock: The Pi provides the timing signal. |
| 7 | HOLD | - | - | Hold. We leave this unconnected for now. |
| 8 | VCC | - | - | Power. Read the critical note below. |
Critical Note on Power (VCC - Pin 8)
As the stafwag guide astutely points out, the 3.3V power supplied by the Raspberry Pi's GPIO header is often not stable or powerful enough to drive the BIOS chip while it is still soldered to the motherboard. This is a very common point of failure.
Do not connect the VCC pin (Pin 8) to your Raspberry Pi.
Instead, we will use the workaround described in the guide: power the chip using the laptop's own, more stable, standby power. In a later step (when we connect the clip), you will plug in the x230's AC adapter (with the battery still removed). This provides the necessary 3.3V to the chip without needing to power the laptop on.
Visualizing the Connections
Connecting jumper wires to a GPIO header can be confusing. To get a feel for the physical process, watch the following segment. The pinout is for a different project, but it clearly shows the process of identifying pins and making the connections.
Now, carefully connect your jumper wires to the Raspberry Pi header according to the table above. Double-check each connection.
Conclusion
You have now successfully assembled the hardware interface for flashing your firmware. You've moved beyond simple disassembly and into the realm of electronics and data protocols. By understanding the role of SPI, preparing the Raspberry Pi, and meticulously wiring the SOIC clip, you have built the bridge that will allow you to take control of your machine's deepest-level software.
Key Takeaways:
- The Raspberry Pi communicates with the BIOS chip using the Serial Peripheral Interface (SPI) protocol.
- The SPI port on the Raspberry Pi must be enabled in the OS configuration before it can be used.
- Wiring the SOIC clip to the GPIO header requires absolute precision. The pin mapping must be followed exactly.
- A common failure point is unstable power. We will mitigate this by not using the Pi for power, and instead using the laptop's own standby power.
Next Lesson
Your flashing apparatus is built and ready. In the next lesson, "Use the 'flashrom' utility to test the connection to the BIOS chip," you will physically attach the SOIC8 clip to one of the BIOS chips on the x230's motherboard. Then, you will run your first flashrom command to verify that your wiring is correct and that the Pi can successfully communicate with the chip. This is the final verification step before we attempt to read the contents of the original firmware.