Discussion:
[flashrom] Problems with CH341A
potato
2016-06-07 16:59:00 UTC
Permalink
Anybody here have ever used a CH341A with a MX25L6405D?

(my English is not very good, it may sound a little weird)

I'm having problems because it can't find the MX25L6405D.

I know that the programmer works, since I was able to make goods dumps
of a MX25L8006 that was on a old router, but I was not able to detect a
MX25L6405D that was on my Thinkpad X200 (it could not even find a chip).
I know it is not a problem with the SOIC16 clip that I used since I was
able to use it on a rayer_spi device.

I not really sure if this is correct but, I saw that could be a bug on
the code of the program that the CH341A port was based on:
https://blog.danman.eu/ch341a-usb-serial-eeprom-reader-under-linux/

I still didn't tried this version of the ch341prog because right now i
don't have the time, but I will do eventually.

I used the 0.9.9 of flashrom.

Sorry if I caused any problems, Potato
Nico Huber
2016-06-10 17:57:27 UTC
Permalink
Hi Potato,
Post by potato
I know that the programmer works, since I was able to make goods dumps
of a MX25L8006 that was on a old router, but I was not able to detect a
MX25L6405D that was on my Thinkpad X200 (it could not even find a chip).
I know it is not a problem with the SOIC16 clip that I used since I was
able to use it on a rayer_spi device.
The problem is not the flash chip itself but the circuitry surrounding
it. Every device that you flash by ISP is a different story, especially
when the device is not meant to be flashed by ISP. The X200 is one of
those and particularly hard to flash. Presumably because of some capa-
city on the CS line. So you need a programmer that can drive CS pretty
strong, or work around by using a very low SPI clock or hack flashrom
to assert CS earlier (that works for me using a FT2232H based program-
mer). I've seen a Raspberry Pi 2 programming an X200 oob, supposedly it
drives CS strong enough.

Here's a clumsy patch for flashrom that might help:
http://paste.flashrom.org/view.php?id=2802
It adds dummy reads that might kind of pre-charge CS.

Urja, do you know a way to assert CS earlier on a CH341A?
Post by potato
Sorry if I caused any problems, Potato
No problems.

Nico
Urja Rannikko
2016-06-10 19:01:51 UTC
Permalink
Post by Nico Huber
Hi Potato,
Post by potato
I know that the programmer works, since I was able to make goods dumps
of a MX25L8006 that was on a old router, but I was not able to detect a
MX25L6405D that was on my Thinkpad X200 (it could not even find a chip).
I know it is not a problem with the SOIC16 clip that I used since I was
able to use it on a rayer_spi device.
The problem is not the flash chip itself but the circuitry surrounding
it. Every device that you flash by ISP is a different story, especially
when the device is not meant to be flashed by ISP. The X200 is one of
those and particularly hard to flash. Presumably because of some capa-
city on the CS line. So you need a programmer that can drive CS pretty
strong, or work around by using a very low SPI clock or hack flashrom
to assert CS earlier (that works for me using a FT2232H based program-
mer). I've seen a Raspberry Pi 2 programming an X200 oob, supposedly it
drives CS strong enough.
http://paste.flashrom.org/view.php?id=2802
It adds dummy reads that might kind of pre-charge CS.
Urja, do you know a way to assert CS earlier on a CH341A?
Depends on for how long, but yes...
https://github.com/flashrom/flashrom/blob/staging/ch341a_spi.c#L334
repeat that line for a delay of 750ns / line after the assertion, but
reduce the limit
in lines 343 and 344 for the amount usable for delay generation, since that
packet is max 32 bytes (the comment there is pretty good).

For a longer delay than that about 20us, it'd need more complex
mechanisms, but yeah doable.
Post by Nico Huber
Post by potato
Sorry if I caused any problems, Potato
No problems.
Nico
--
Urja Rannikko
potato
2016-06-12 00:32:36 UTC
Permalink
Thanks for the help, the patch did work (the chip was detected),
unfortunately the system was not really reliable. The dumps were note
matching and the chip was only detected on the first run of flashrom,
after that it was needed to remove the USB device and insert-it again,
otherwise the chip would not be find. Since there is no way to set the
speed of the CH341A on flashrom right now, I will see if there is any
way to "boost" the signal (or something like that) from the CH341A (and
look on some other SPI programmers).

Potato
Post by Nico Huber
Hi Potato,
Post by potato
I know that the programmer works, since I was able to make goods dumps
of a MX25L8006 that was on a old router, but I was not able to detect a
MX25L6405D that was on my Thinkpad X200 (it could not even find a chip).
I know it is not a problem with the SOIC16 clip that I used since I was
able to use it on a rayer_spi device.
The problem is not the flash chip itself but the circuitry surrounding
it. Every device that you flash by ISP is a different story, especially
when the device is not meant to be flashed by ISP. The X200 is one of
those and particularly hard to flash. Presumably because of some capa-
city on the CS line. So you need a programmer that can drive CS pretty
strong, or work around by using a very low SPI clock or hack flashrom
to assert CS earlier (that works for me using a FT2232H based program-
mer). I've seen a Raspberry Pi 2 programming an X200 oob, supposedly it
drives CS strong enough.
http://paste.flashrom.org/view.php?id=2802
It adds dummy reads that might kind of pre-charge CS.
Urja, do you know a way to assert CS earlier on a CH341A?
Post by potato
Sorry if I caused any problems, Potato
No problems.
Nico
Continue reading on narkive:
Loading...