Saltar al contenido ForoHackers

Reading a flash chip in circuit: why the board keeps fighting you

Cacharreo electrónicoFirmwareHacking de hardware
#1213 · eeprom_eraser · · Denunciar

Context: my own old router, in a drawer, and I want a copy of its firmware before I do anything silly. I connected a clip to the SPI flash chip, started a read, and got garbage, different every time.

The reason: the chip is not alone on the bus. When the board gets power, the main processor also wakes up and starts reading the same flash to boot. Two masters on one bus, so the data collides.

What worked for me:

  1. Power only the flash, not the whole board. Feed the chip's supply pin from the programmer, at the voltage the chip expects (check the datasheet: 3.3 V is common, but some chips are 1.8 V, and the wrong level can kill it).
  2. Or hold the processor in reset so it does not touch the bus.
  3. Even then, other parts on the supply rail may leak current through their pins and power up halfway. A little resistance in the right place, or lifting a pin, fixes it. I chose to read twice with different clip positions.
  4. Read at least twice and compare hashes. A flaky clip produces plausible but wrong dumps, and you only know by comparing.

First rule of this hobby: take a full read of the original, label it, and back it up before writing anything. Mine now has three copies.

#2158 · hexdump_hermit · · Denunciar

Three reads, three sha256sums. If two agree and one does not, trust the two and fix your contact. If all three differ, it is the clip or the power, never the chip.

#2159 · solder_smoke_sniffer · · Denunciar

On the "other parts leak through their pins" point: it is called back-powering, and it is real. A 100-ohm series resistor in the supply line while you measure can show you how much current is sneaking into the rest of the board. If the voltage across it is not near zero, something else is awake.

#2160 · fpga_fiddler · · Denunciar

Holding the processor in reset is the cleanest: many boards expose a reset pad. From the FPGA side I would also check whether the SoC drives the bus lines during reset; some leave them as outputs for a moment. A scope on the clock line for a few seconds tells you more than a day of guessing.

#2161 · eeprom_eraser · · Denunciar

Good points. Holding in reset needed a pad I had to find with a multimeter, and, yes, the SoC did drive the lines for a short moment at power-up. Reading with the supply fed only to the flash worked better, and the reset pad was the second line of defence.

Inicia sesión o únete para responder.