GithubHelp home page GithubHelp logo

mcmccru / snander Goto Github PK

View Code? Open in Web Editor NEW
204.0 12.0 57.0 17.88 MB

SNANDer - Serial Nor/nAND/Eeprom programmeR (based on CH341A)

License: GNU General Public License v2.0

Makefile 0.96% C 94.27% Shell 0.02% M4 0.99% C++ 3.69% PowerShell 0.04% JavaScript 0.02%
chip-programmer prom-writer

snander's Introduction

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

  Usage:
 -h             display this message
 -d             disable internal ECC(use read and write page size + OOB size - On-die ECC)
 -o <bytes>     manual set OOB size with disable internal ECC(default 0)
 -I             ECC ignore errors(for read test only)
 -k             Skip BAD pages, try read or write in to next page
 -L             print list support chips
 -i             read the chip ID info
 -E             select I2C EEPROM {24c01|24c02|24c04|24c08|24c16|24c32|24c64|24c128|24c256|24c512|24c1024}
                select Microwire EEPROM {93c06|93c16|93c46|93c56|93c66|93c76|93c86|93c96} (need SPI-to-MW adapter)
                select SPI EEPROM 25xxx {25010|25020|25040|25080|25160|25320|25640|25128|25256|25512|251024}
 -8             set organization 8-bit for Microwire EEPROM(default 16-bit) and set jumper on SPI-to-MW adapter
 -f <addr len>  set manual address size in bits for Microwire EEPROM(default auto)
 -s <bytes>     set page size from datasheet for fast write SPI EEPROM(default not usage)
 -e             erase chip(full or use with -a [-l])
 -l <bytes>     manually set length
 -a <address>   manually set address
 -w <filename>  write chip with data from filename
 -r <filename>  read chip and save data to filename
 -v             verify after write on chip

Examples:

1. Get info Flash.

igor@mcmcc-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -i

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xc2, dev_id = 0x22
Get Status Register 1: 0x38
Get Status Register 2: 0x10
Using Flash ECC.
Detected SPI NAND Flash: MXIC MX35LF2G, Flash Size: 256 MB

or

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: Winchiphead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xef, dev_id = 0xaa
Get Status Register 1: 0x81
Get Status Register 2: 0x18
Using Flash ECC.
Detected SPI NAND Flash: WINBOND W25N01G, Flash Size: 128 MB

2. Full erase flash with disable internal ECC check. Without OOB, page size 2112 bytes.

igor@mcmcc-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -d -e

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xc2, dev_id = 0x22
Get Status Register 1: 0x00
Get Status Register 2: 0x11
Disable Flash ECC.
Detected SPI NAND Flash: MXIC MX35LF2G, Flash Size: 256 MB
ERASE:
Set full erase chip!
Erase addr = 0x0000000000000000, len = 0x0000000010800000
Erase 100% [276824064] of [276824064] bytes
Elapsed time: 3 seconds
Status: OK
igor@mcmcc-GL553VE:~/Soft/SNANDer-bin/Linux$

3. Write and verify flash with disable internal ECC check. Without OOB, page size 2112 bytes.

igor@mcmcc-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -d -v -w ecc_2Gb_2K_64_flashimage_rfb1_ac2600.bin 

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xc2, dev_id = 0x22
Get Status Register 1: 0x00
Get Status Register 2: 0x11
Disable Flash ECC.
Detected SPI NAND Flash: MXIC MX35LF2G, Flash Size: 256 MB
WRITE:
Write addr = 0x0000000000000000, len = 0x000000000E5A9D6F
Written 100% [240819567] of [240819567] bytes
Elapsed time: 4184 seconds
Status: OK
VERIFY:
Read addr = 0x0000000000000000, len = 0x000000000E5A9D6F
Read 100% [240819567] of [240819567] bytes
Elapsed time: 2047 seconds
Status: OK

4. Read Microwire EEPROM Atmel 93C46 and save file.

igor@igor-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -E 93c46 -r test.bin

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
Microwire EEPROM chip: 93c46, Size: 64 bytes, Org: 16 bits, fix addr len: Auto
READ:
Read addr = 0x0000000000000000, len = 0x0000000000000080
Read_EEPROM_3wire: Set address len 6 bits
Read 100% [64] of [64] bytes
Read [128] bytes from [93c46] EEPROM address 0x00000000
Elapsed time: 0 seconds
Status: OK

5. Write and verify Microwire EEPROM Atmel 93C46 from file.

igor@igor-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -E 93c46 -w test.bin -v

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
Microwire EEPROM chip: 93c46, Size: 64 bytes, Org: 16 bits, fix addr len: Auto
WRITE:
Write addr = 0x0000000000000000, len = 0x0000000000000080
Erase_EEPROM_3wire: Set address len 6 bits
Write_EEPROM_3wire: Set address len 6 bits
Written 100% [64] of [64] bytes
Wrote [128] bytes to [93c46] EEPROM address 0x00000000
Elapsed time: 1 seconds
Status: OK
VERIFY:
Read addr = 0x0000000000000000, len = 0x0000000000000080
Read_EEPROM_3wire: Set address len 6 bits
Read 100% [64] of [64] bytes
Read [128] bytes from [93c46] EEPROM address 0x00000000
Elapsed time: 1 seconds
Status: OK

6. Write and verify SPI EEPROM Atmel AT25640B from file.

igor@igor-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -E 25640 -v -w test.bin

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
SPI EEPROM chip: 25640, Size: 8192 bytes
WRITE:
Write addr = 0x0000000000000000, len = 0x0000000000002000
Written 100% [8192] bytes to [25640] EEPROM address 0x00000000
Elapsed time: 22 seconds
Status: OK
VERIFY:
Read addr = 0x0000000000000000, len = 0x0000000000002000
Read 100% [8192] bytes from [25640] EEPROM address 0x00000000
Elapsed time: 2 seconds
Status: OK

7. Fast write and verify SPI EEPROM Atmel AT25640B from file with use page size.
   (Find out page size from datasheet on chip!!!)

igor@igor-GL553VE:~/Soft/SNANDer-bin/Linux$ ./SNANDer -E 25640 -v -w test.bin -s 32

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.8 by McMCC <mcmcc_at_mail.ru>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
SPI EEPROM chip: 25640, Size: 8192 bytes
Setting page size 32B for write.
WRITE:
Write addr = 0x0000000000000000, len = 0x0000000000002000
Written 100% [8192] bytes to [25640] EEPROM address 0x00000000
Elapsed time: 1 seconds
Status: OK
VERIFY:
Read addr = 0x0000000000000000, len = 0x0000000000002000
Read 100% [8192] bytes from [25640] EEPROM address 0x00000000
Elapsed time: 2 seconds
Status: OK

snander's People

Contributors

bigbigmdm avatar danielkucera avatar hzyitc avatar ksergeyv avatar leo-pl avatar lnikazzzl avatar mcmccru avatar stricted avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snander's Issues

Failed to write or erase when changing chips without reconnecting the programmer.

Erase:

Set full erase chip!
Erase addr = 0x0000000000000000, len = 0x0000000008000000
spi_nand_erase_block : erase block fail, block = 0x0, status = 0x4
spi_nand_erase_internal : Erase Fail at addr = 0x0, len = 0x8000000, block_idx = 0x0
spi_nand_erase_block : erase block fail, block = 0x1, status = 0x4
spi_nand_erase_internal : Erase Fail at addr = 0x20000, len = 0x8000000, block_idx = 0x1

Write:


Write addr = 0x0000000000200000, len = 0x000000000000A363
[spinand_ecc_fail_check] : ECC cannot recover detected !, page = 0x400
spi_nand_read_page: Bad Block, ECC cannot recovery detecte, page = 0x400
[spinand_ecc_fail_check] : ECC cannot recover detected !, page = 0x405
spi_nand_read_page: Bad Block, ECC cannot recovery detecte, page = 0x405

Succeed after unplug & plug the CH341 again

Question on status register and reading consistency

I noticed the status register value would change across different read operation. Is this normal? What does it mean when register 1 = 0x38 vs 0x00, and register 2 = 0x10 vs 0x11?

Also, i am not getting same dump across multiple read, i guess this is due to bad solder join? Should I disable screensaver? I got auto logout in the middle of the reading and wonder if it will interrupt the read by any chance?

Migrate a ROM MXIC

Hey mate,
It's maybe a out subject, but i guess you will have some hints or maybe a useful infos.
I'm wishing to migrate the UEFI bios ROM file from the 128 to a bigger one, so i'm thinking on the 256 to have more room inside, because i need to add some EFI modules insides.
Would it be possible?
My Motherboard is a GA-Z87X-UD3H that have a MXIC MX 25L12873F chip, if it can be possible, what MXIC 256 Chip should i have to use, for power and everything compatibility.
I hope you can answer my question please, have my cheers.
Amine

Adding support for different programmers.

Hi,

I've been looking for a solution for programming SPI NAND chips for a while as flashrom can't do it.

The SoCs I'm messing around with have a weird SPI over I2C protocol and use a special USB dongle and a Windows tool. (http://linux-chenxing.org/isp/). I want to replace this with something that is open source to remove the need to have windows, use tools that are under NDA etc. flashrom already supports the SPI over I2C part for this but doesn't do SPI NAND.

Do you think it would be difficult for me to add support for using the USB dongle with this instead of the ch341a?
I took a quick look at the code and it doesn't seem like it's really tightly coupled to the ch341a but I'd like to get your opinion before I start on it.

Thanks.

SPI-Nand issue with programmer

I have issues with the following programmer:

https://github.com/McMCCRU/SNANDer/blob/main/Programmer_photos/photo3.jpg

If I use this one

https://github.com/McMCCRU/SNANDer/blob/main/Programmer_photos/photo1.jpg

I get a working connection.

When measuring the voltages I get ca 5 on the black programmer and 3.3 on the green one.

The following page has possible workarounds for this issue:

https://eevblog.com/forum/repair/ch341a-serial-memory-programmer-power-supply-fix/

I tried a spi-nor chip and that worked with 5V signalling. Maybe the spi-nand is more picky.

128mb chip not reading correctly

I have this spi nand:

MXIC MX35LF1G, Flash Size: 128 MB

I have tried to do a read for like 10 times but each time the reading will be different by a few bytes.

I checked the solder joints are good. The CH341A hardware is also good as I used it with other software to read/write SPI NOR and it is fine.

How can I troubleshoot this?

OLD issue new person TC58CVG2S0H

Hello,

I use your SNANDer program to dump a TC58CVG2S0H, thanks for proposing such a tool based on ch341a.

During identification, I get this weird error.

$ ./SNANDer -i

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7 by McMCC [email protected]

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xff, dev_id = 0x98
SPI NAND Flash Not Detected!
spi device id: ff 98 ed 51 98 (98ed5198)
SPI NOR Flash Not Detected!
in the datasheet, I can read:

Byte | Description. | Value
Byte 0 | Manufacture ID (KIOXIA) | 98h
Byte 1 | Device ID. | CDh
The 98h value is present. So the 0xff are dummy bits and 0x98 is the Mfr_id.
But the device ID 0xCD is wrong (0xED instead of 0xCD)

Fyi, I tried with a MXIC and I still get 0xff as manufacturer id.

The workaround is to modify the #define value of MANUFACTURER_ID and the DEVICE_ID to the values above (but it does not correspond to the real ID). Or to adjust the parsing of the read id command

Any suggestion from your side, according to your previous experiments on SPI Nand?

McMCCRU:

Hello I am encountering the same exact issue that you have exactly the same in every way.

I am using a ch341a programmer that I know works, I am using a wson8 adapter as shown

image

what OS are you using?

skxo

Do you have some sort of document you can share and help elaborate on what you did and how you did it to work thank you!McMCCRU:

Hello I am encountering the same exact issue that you have exactly the same in every way.

I am using a ch341a programmer that I know works, I am using a wson8 adapter as shown

image

what OS are you using?

skxo

Do you have some sort of document you can share and help elaborate on what you did and how you did it to work thank you!

McMCCRU

can you show how you are making the TC58CVG2S0H work?
could you at least take a picture of your set up exactly how you have it set up i have a Ch341a eeprom reader.

The read ECC data are all 0xFF, is this normal?

Hello, first of all thank you for your selflessness and hard work, so that we have such a good tool, thank you
I have encountered a problem recently. I have a router that starts normally. It uses SPI NAND and the model is MICRON MT29F2G01. It can be recognized normally with your tool. In fact, it is the only tool that can recognize this chip normally with CH341A. I used the tool you provided to read the content of this chip with -d and saved it. I found that all the contents of the ECC area read out are 0xFF. Is this normal? like this:
7F0:3C1B9FA3277B088C3C1ABFB0AF5B0280
800: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
810: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
820: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
830: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
I used this tool to read several times in a row and got the same data. All ECC data is 0xFF. In order to verify these data, I write the read data into this chip in the way of -d -v. The result The router cannot start normally, TTL display
spi check fail
Ecc cannot recovery detecte
For this reason, I bought the same router, and the ECC data read is the same. Is this chip special or the tool cannot read ECC data normally?

Ecc error?

Hi,

Thanks for publishing this great tool! I just tried to use but it received the following error.. is this normal?

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.6.1 by McMCC [email protected]

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xc2, dev_id = 0x12
Get Status Register 1: 0x00
Get Status Register 2: 0x11
Using Flash ECC.
Detected SPI NAND Flash: MXIC MX35LF1G, Flash Size: 128 MB
READ:
Read addr = 0x0000000000000000, len = 0x0000000008000000
[spinand_ecc_fail_check] : ECC cannot recover detected !, page = 0x0
spi_nand_read_page: Bad Block, ECC cannot recovery detecte, page = 0x0
Status: BAD(-1)

'-a' flag will write to rest space of the whole chip by default.

PS D:\> .\SNANDer-Windows-64bit.exe -i

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.5 by McMCC <[email protected]>
Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xef, dev_id = 0xaa, dev_id_2 = 0x21
Get Status Register 1: 0x7c
Get Status Register 2: 0x18
Using Flash ECC.
Detected SPI NAND Flash: WINBOND W25N01G, Flash Size: 128 MB
PS D:\> .\SNANDer-Windows-64bit.exe -e

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.5 by McMCC <[email protected]>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xef, dev_id = 0xaa, dev_id_2 = 0x21
Get Status Register 1: 0x81
Get Status Register 2: 0x18
Using Flash ECC.
Detected SPI NAND Flash: WINBOND W25N01G, Flash Size: 128 MB
ERASE:
Set full erase chip!
Erase addr = 0x0000000000000000, len = 0x0000000008000000
Erase 100% [134217728] of [134217728] bytes
Elapsed time: 2 seconds
Status: OK
PS D:\> .\SNANDer-Windows-64bit.exe -w GCIS.bin

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.5 by McMCC <[email protected]>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xef, dev_id = 0xaa, dev_id_2 = 0x21
Get Status Register 1: 0x81
Get Status Register 2: 0x18
Using Flash ECC.
Detected SPI NAND Flash: WINBOND W25N01G, Flash Size: 128 MB
WRITE:
Write addr = 0x0000000000000000, len = 0x0000000000000800
Written 100% [2048] of [2048] bytes
Elapsed time: 1 seconds
Status: OK
PS D:\> .\SNANDer-Windows-64bit.exe -w IPL.bin -a 0x140000

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7.5 by McMCC <[email protected]>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xef, dev_id = 0xaa, dev_id_2 = 0x21
Get Status Register 1: 0x81
Get Status Register 2: 0x18
Using Flash ECC.
Detected SPI NAND Flash: WINBOND W25N01G, Flash Size: 128 MB
WRITE:
Write addr = 0x0000000000140000, len = 0x0000000007EC0000
Written 1% [1609728] of [132907008] bytes

And there is no way to turn it off.

ECC Fail Check

Hello I have the following error. Disabling ECC allows me to dump without noticeable issues? Any suggestions? Can the non ECC dump be trusted?

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xc2, dev_id = 0x12, dev_id_2 = 0xc2
Get Status Register 1: 0x38
Get Status Register 2: 0x10
Using Flash ECC.
Detected SPI NAND Flash: MXIC MX35LF1G, Flash Size: 128 MB
READ:
Read addr = 0x0000000000000000, len = 0x0000000008000000
[spinand_ecc_fail_check] : ECC cannot recover detected !, page = 0x0
spi_nand_read_page: Bad Block, ECC cannot recovery detecte, page = 0x0
Status: BAD(-1)

SPI NAND Flash not Detected

Hello,

I use your SNANDer program to dump a TC58CVG2S0H, thanks for proposing such a tool based on ch341a.

During identification, I get this weird error.

$ ./SNANDer -i

SNANDer - Serial Nor/nAND/Eeprom programmeR v.1.7 by McMCC <[email protected]>

Found programmer device: WinChipHead (WCH) - CH341A
Device revision is 3.0.4
spi_nand_probe: mfr_id = 0xff, dev_id = 0x98
SPI NAND Flash Not Detected!
spi device id: ff 98 ed 51 98 (98ed5198)
SPI NOR Flash Not Detected!

in the datasheet, I can read:

Byte     | Description.                      | Value
Byte 0 | Manufacture ID (KIOXIA) | 98h
Byte 1 | Device ID.                           | CDh

The 98h value is present. So the 0xff are dummy bits and 0x98 is the Mfr_id.
But the device ID 0xCD is wrong (0xED instead of 0xCD)

Fyi, I tried with a MXIC and I still get 0xff as manufacturer id.

The workaround is to modify the #define value of MANUFACTURER_ID and the DEVICE_ID to the values above (but it does not correspond to the real ID). Or to adjust the parsing of the read id command

Any suggestion from your side, according to your previous experiments on SPI Nand?

Regards
sk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.