Hi,
I have a new prototype development board here, with an 512 MBit Flash chip, Micron N25Q512 (precise type is N25Q512A11G40). I managed to create a config [1] that reads fine, but fails to write [2].
I understand that flashrom cannot access chips larger than 16 MBytes, but the chip should still be able to work in 3-byte addressing mode for the lower 16 MBytes. This is what I have created in flashchips.c (copy & pasted, then adapted from the part N25Q128, assuming with a bit of good faith and some datasheet comparison that they should behave alike).
Has anyone ever successfully written to a small part of a 4-byte flash chip?
Thanks, David
=========================
[1] new stuff for flashchips.c
{ .vendor = "Micron/Numonyx/ST", .name = "N25Q512..3E", /* ..3E = 3V, uniform 64KB/4KB blocks/sectors */ .bustype = BUS_SPI, .manufacture_id = ST_ID, .model_id = ST_N25Q512__3E, /* .total_size = 65536,*/ .total_size = 16384, .page_size = 256, /* supports SFDP */ /* OTP: 64B total; read 0x4B, write 0x42 */ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, .tested = TEST_OK_PREW, .probe = probe_spi_rdid, .probe_timing = TIMING_ZERO, .block_erasers = { { /*.eraseblocks = { {4 * 1024, 16384 } },*/ .eraseblocks = { {4 * 1024, 4096 } }, .block_erase = spi_block_erase_20, }, { /*.eraseblocks = { {64 * 1024, 1024} },*/ .eraseblocks = { {64 * 1024, 256} }, .block_erase = spi_block_erase_d8, }, { /*.eraseblocks = { {65536 * 1024, 1} },*/ .eraseblocks = { {16384 * 1024, 1} }, .block_erase = spi_block_erase_c7, } }, .printlock = spi_prettyprint_status_register_n25q, /* TODO: config, lock, flag regs */ .unlock = spi_disable_blockprotect_n25q, /* TODO: per 64kB sector lock registers */ .write = spi_chip_write_256, /* Multi I/O supported */ .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ .voltage = {2700, 3600}, },
=========================
[2] output from flashrom trying to write, and failing:
# /root/flashrom -p ft2232_spi:type=232H,divisor=8 -c 'N25Q512..3E' -V -w flash.rom flashrom v0.9.7-r1711 on Linux 3.13.6-1-ARCH (x86_64) flashrom is free software, get the source code at http://www.flashrom.org
flashrom was built with libpci 3.2.1, GCC 4.8.2 20140206 (prerelease), little endian Command line (7 args): /root/flashrom -p ft2232_spi:type=232H,divisor=8 -c N25Q512..3E -V -w flash.rom Calibrating delay loop... OS timer resolution is 1 usecs, 1588M loops per second, 10 myus = 9 us, 100 myus = 117 us, 1000 myus = 1005 us, 10000 myus = 10324 us, 4 myus = 4 us, OK. Initializing ft2232_spi programmer Using device type FTDI FT232H channel A. Disable divide-by-5 front stage Set clock divisor MPSSE clock: 60.000000 MHz, divisor: 8, SPI clock: 7.500000 MHz No loopback of TDI/DO TDO/DI Set data bits The following protocols are supported: SPI. Probing for Micron/Numonyx/ST N25Q512..3E, 16384 kB: probe_spi_rdid_generic: id1 0x20, id2 0xba20 Found Micron/Numonyx/ST flash chip "N25Q512..3E" (16384 kB, SPI) on ft2232_spi. Chip status register is 0x00. Chip status register: Status Register Write Disable (SRWD, SRP, ...) is not set Chip status register: Block Protect 3 (BP3) is not set Chip status register: Top/Bottom (TB) is top Chip status register: Block Protect 2 (BP2) is not set Chip status register: Block Protect 1 (BP1) is not set Chip status register: Block Protect 0 (BP0) is not set Chip status register: Write Enable Latch (WEL) is not set Chip status register: Write In Progress (WIP/BUSY) is not set This chip may contain one-time programmable memory. flashrom cannot read and may never be able to write it, hence it may not be able to completely clone the contents of this chip (see man page for details). Reading old flash chip contents... done. Erasing and writing flash chip... Trying erase function 0... 0x000000-0x000fff:W, 0x001000-0x001fff:E FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00001000-0x00001fff: 0x1000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 1... 0x000000-0x00ffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0x10000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 2... 0x000000-0xffffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x00ffffff: 0x1000000 ERASE FAILED! Looking for another erase function. No usable erase functions left. FAILED! Uh oh. Erase/write failed. Checking if anything changed. Your flash chip is in an unknown state. Please report this on IRC at chat.freenode.net (channel #flashrom) or mail flashrom@flashrom.org, thanks!
On Wed, 19 Mar 2014 01:00:41 +0100 David Madl flashrom.org@abanbytes.eu wrote:
Hi,
I have a new prototype development board here, with an 512 MBit Flash chip, Micron N25Q512 (precise type is N25Q512A11G40). I managed to create a config [1] that reads fine, but fails to write [2].
I understand that flashrom cannot access chips larger than 16 MBytes, but the chip should still be able to work in 3-byte addressing mode for the lower 16 MBytes. This is what I have created in flashchips.c (copy & pasted, then adapted from the part N25Q128, assuming with a bit of good faith and some datasheet comparison that they should behave alike).
Has anyone ever successfully written to a small part of a 4-byte flash chip? […] Erasing and writing flash chip... Trying erase function 0... 0x000000-0x000fff:W, 0x001000-0x001fff:E FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00001000-0x00001fff: 0x1000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 1... 0x000000-0x00ffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0x10000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 2... 0x000000-0xffffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x00ffffff: 0x1000000 ERASE FAILED! Looking for another erase function. No usable erase functions left. FAILED! Uh oh. Erase/write failed. Checking if anything changed. Your flash chip is in an unknown state. Please report this on IRC at chat.freenode.net (channel #flashrom) or mail flashrom@flashrom.org, thanks!
Hi David,
it is almost 2am here, so I wont write a long reply. The log looks to me as if you were not connecting the write protection pin correctly. Maybe that's all what's wrong :)
PS: It would probably be worthwhile for you to look at how patch files work and how you can create them. That eases the communication of changes dramatically.
Hello Stefan,
thank you for the quick reply in the middle of the night :)
I have just checked the WP# pin connection again [1].
Here's a patch on top of flashrom v0.9.7, SVN r1767 (I didn't really expect anyone to have the chip ready to test though).
The first 0x200 bytes got written correctly, they have changed from the readout before to the correct data I want there.
The erase worked on the first 0x1000 bytes (equal to my setting of eraseblocks size for spi_block_erase_20), because before, I had at address 0x200:
00000200 04 02 00 10 00 02 1a 24 01 02 00 10 00 00 00 00
But now it is changed, 0x200-0xFFF is all FF (this is not the data I tried to write there):
00000200 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff * 00001000 21 28 60 02 09 f8 20 03 21 30 20 02 10 00 bc 8f
Another piece is changed (was blanked to FF), at 0x6b00-0x6bff, which is not any special boundary I'd expect. It isn't even any erase size! All other contents have stayed the same like in the readout before I tried to write.
Thanks, David
[1] WP# is connected to pin 6 (grey) on C232HM, like in http://wiki.openwrt.org/doc/howto/generic.debrick#write.flash.chip.by.usb
I did not connect a pull-up resistor, but I've measured the voltage levels before and it's 3.3 V all the time. I've also just tried writing again, with an oscilloscope connected to WP#, it never triggers on a falling edge, so the signal really stays 3.3 V (inverted logic, meaning WP should be off).
On 19.03.2014 01:50, Stefan Tauner wrote:
On Wed, 19 Mar 2014 01:00:41 +0100 David Madl flashrom.org@abanbytes.eu wrote:
Hi,
I have a new prototype development board here, with an 512 MBit Flash chip, Micron N25Q512 (precise type is N25Q512A11G40). I managed to create a config [1] that reads fine, but fails to write [2].
I understand that flashrom cannot access chips larger than 16 MBytes, but the chip should still be able to work in 3-byte addressing mode for the lower 16 MBytes. This is what I have created in flashchips.c (copy & pasted, then adapted from the part N25Q128, assuming with a bit of good faith and some datasheet comparison that they should behave alike).
Has anyone ever successfully written to a small part of a 4-byte flash chip? […] Erasing and writing flash chip... Trying erase function 0... 0x000000-0x000fff:W, 0x001000-0x001fff:E FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00001000-0x00001fff: 0x1000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 1... 0x000000-0x00ffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0x10000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 2... 0x000000-0xffffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x00ffffff: 0x1000000 ERASE FAILED! Looking for another erase function. No usable erase functions left. FAILED! Uh oh. Erase/write failed. Checking if anything changed. Your flash chip is in an unknown state. Please report this on IRC at chat.freenode.net (channel #flashrom) or mail flashrom@flashrom.org, thanks!
Hi David,
it is almost 2am here, so I wont write a long reply. The log looks to me as if you were not connecting the write protection pin correctly. Maybe that's all what's wrong :)
PS: It would probably be worthwhile for you to look at how patch files work and how you can create them. That eases the communication of changes dramatically.
Here's a patch on top of flashrom v0.9.7, SVN r1767.
On 19.03.2014 01:50, Stefan Tauner wrote:
On Wed, 19 Mar 2014 01:00:41 +0100 David Madl flashrom.org@abanbytes.eu wrote:
Hi,
I have a new prototype development board here, with an 512 MBit Flash chip, Micron N25Q512 (precise type is N25Q512A11G40). I managed to create a config [1] that reads fine, but fails to write [2].
I understand that flashrom cannot access chips larger than 16 MBytes, but the chip should still be able to work in 3-byte addressing mode for the lower 16 MBytes. This is what I have created in flashchips.c (copy & pasted, then adapted from the part N25Q128, assuming with a bit of good faith and some datasheet comparison that they should behave alike).
Has anyone ever successfully written to a small part of a 4-byte flash chip? […] Erasing and writing flash chip... Trying erase function 0... 0x000000-0x000fff:W, 0x001000-0x001fff:E FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00001000-0x00001fff: 0x1000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 1... 0x000000-0x00ffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0x10000 ERASE FAILED! Reading current flash chip contents... done. Looking for another erase function. Trying erase function 2... 0x000000-0xffffff:E FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x00ffffff: 0x1000000 ERASE FAILED! Looking for another erase function. No usable erase functions left. FAILED! Uh oh. Erase/write failed. Checking if anything changed. Your flash chip is in an unknown state. Please report this on IRC at chat.freenode.net (channel #flashrom) or mail flashrom@flashrom.org, thanks!
Hi David,
it is almost 2am here, so I wont write a long reply. The log looks to me as if you were not connecting the write protection pin correctly. Maybe that's all what's wrong :)
PS: It would probably be worthwhile for you to look at how patch files work and how you can create them. That eases the communication of changes dramatically.