On Wed, May 30, 2018 at 9:03 AM, Yang Hu firstname.lastname@example.org wrote:
I'm trying to rewrite a W24X40AL flash on a Seagate hard drive motherboard. I can successfully read the data, although some weird things happened. (First dumped code is nonsense, second time works fine, third or the rest are just partial corrupted code).
Then I want to flash the code back but get the following error,
parallels@ubuntu:~/Desktop$ sudo flashrom -p buspirate_spi:dev=/dev/ttyUSB0,spispeed=2M -E flashrom on Linux 4.4.0-59-generic (x86_64) flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). Found Winbond flash chip "W25X40" (512 kB, SPI) on buspirate_spi. Erasing and writing flash chip... FAILED at 0x00001000! Expected=0xff, Found=0x7f, failed byte count from 0x00001000-0x00001fff: 0x1 ERASE FAILED! Looking for another erase function. FAILED at 0x00001800! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0x42b ERASE FAILED! Looking for another erase function. FAILED at 0x00002000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0007ffff: 0x6596 ERASE FAILED! Looking for another erase function. Looking for another erase function. Looking for another erase function. No usable erase functions left. FAILED! Your flash chip is in an unknown state. Please report this on IRC at chat.freenode.net (channel #flashrom) or mail email@example.com, thanks!
My connection right now is: the motherboard is not powered, using bus pirate 3.3v directly connects to VCC, /WP and /HOLD. I've tried to add 10k, 20k resistor between 3.3v and /WP, /HOLD pin but the chip won't be recognized then.
I don't have much experience in electronics. Is this do with write protection? Is there anything I can do with this?
Hi Yang, It sounds like your Bus Pirate is backpowering other electronics on the board (e.g. an embedded controller), which in turn try to access the SPI flash and interfere. This happens when the vendor does not isolate the SPI flash circuitry.
Determine what other electronics might be powered by the Bus Pirate and see if you can hold them in reset so that they don't try to access the SPI flash.