Hello,

I think, the ch341b in my propgrammer ist broken:

I attached a logic analyzer to the chip and nothing happened. Then I tested the connections between the ch341b and the Textool socket, everything was ok and according to the map in the file ch341b_spi.c (line 275+). If the ch341b were ok, then signals should at least be visible at CS (15), CLK (18) and MOSI (20).

I will buy now a new programmer with ch341a. If anybody is interested in the full patch, I will send her/him a ZIP file :)

Regards
Stephan



Am 10.12.24 um 12:47 schrieb Anastasia Klimchuk:
I think these two lines show the error:

cb_in: error: LIBUSB_TRANSFER_TIMED_OUT
ch341b_spi_spi_send_command: Failed to read 4 bytes

These 4 bytes are supposed to be device ID returned by the chip, and
because of timeout we don't know the ID, and so can't finish the
probing operation. This also explains why none of the chips work -
probably the same timeout for each?

On Tue, Dec 10, 2024 at 10:02 PM S. <b...@uxdx.net> wrote:

Hello,

in fact it was the lack of dependencies, which I have fixed now, on my
PC only libjaylink 0.3.0 is missing (I only have version 0.2.0), but I
don't need j-link.

Now flashrom recognizes the programmer but not the chip, I tested the
follwing chips: Winbond 25Q16DV, Winbond W24X40 and Macronix 25L4005A

xc@pcs:~/flashrom$ flashrom -p ch341b_spi -c W25Q16.V --flash-name -VVV
flashrom v1.5.0 on Linux 6.8.0-49-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org
flashrom was built with GCC 11.4.0, little endian
Command line (6 args): flashrom -p ch341b_spi -c W25Q16.V --flash-name -VVV
Strange: Empty eraseblock definition with non-empty erase function. Not
an error.
Initializing ch341b_spi programmer
Device revision is 3.0.4
Wrote 3 bytes:
   aa 61 00
Wrote 4 bytes:
   ab b7 7f 20
The following protocols are supported: SPI.
Probing for Winbond W25Q16.V, 2048 kB: master_map_flash_region: mapping
W25Q16.V from 0x00000000ffe00000 to 0x0000000000000000
cb_in: error: LIBUSB_TRANSFER_TIMED_OUT
ch341b_spi_spi_send_command: Failed to read 4 bytes
master_unmap_flash_region: unmapped 0x0000000000000000
No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isn't found automatically.
Wrote 4 bytes:
   ab b7 40 20

Regards
Stephan



Am 10.12.24 um 07:05 schrieb Anastasia Klimchuk:
It seems libusb dependency is not recognised, in your case you need libusb.
When you are building from source, in the beginning meson prints lots
of info, find what it says about libusb.
For example, on my environment here I have this line:

Run-time dependency libusb-1.0 found: YES 1.0.27

I suspect you have NO and you need to achieve YES
Check the instructions about libraries, especially section on Ubuntu:
https://flashrom.org/dev_guide/building_from_source.html

For your work to add support for CH341b it would be really good to
have a patch eventually.
Similar thing was implemented for ch347_spi recently, see how now it
knows about two devices IDs and tries each of them:
https://github.com/flashrom/flashrom/blob/main/ch347_spi.c#L60

On Mon, Dec 9, 2024 at 9:26 PM S. <b...@uxdx.net> wrote:

Hello,

I've never programmed in C languages before, but it seemed easy to me
since the only difference between ch341a and ch341b is that ch341b no
longer needs an external crystal
https://www.wch-ic.com/downloads/file/16.html (Chapter 3., Note). I
therefore changed the PID in line 90 of ch341a_spi.c from 5512 to 5523
and added an entry for the ch341b in flashrom_udev.rules :

# Winchiphead (WCH) CH341b based programmer
ATTRS{idVendor}==“1a86”, ATTRS{idProduct}==“5523”, MODE=“664”,
GROUP="plugdev”

The result is that the flashrom call only shows a few programmers, I can
no longer select the ch341:

flashrom v1.5.0 on Linux 6.8.0-49-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org
Please select a programmer with the --programmer parameter.
Valid choices are:
dummy, serprog, buspirate_spi, rayer_spi, pony_spi, linux_mtd, linux_spi.

flashrom 1.2 is delivered with Ubuntu, more programmers are offered:

flashrom v1.2 on Linux 6.8.0-49-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org
Please select a programmer with the --programmer parameter.
To choose the mainboard of this computer use 'internal'.
Valid choices are:
internal, dummy, nic3com, nicrealtek, gfxnvidia, drkaiser, satasii,
atavia, it8212, ft2232_spi, serprog, buspirate_spi, dediprog,
developerbox, rayer_spi, pony_spi, nicintel, nicintel_spi,
nicintel_eeprom, ogp_spi, satamv, linux_mtd, linux_spi, usbblaster_spi,
pickit2_spi, ch341a_spi, digilent_spi, stlinkv3_spi.

Regards
Stephan



Am 09.12.24 um 01:11 schrieb Anastasia Klimchuk:
Hello Stephan,

It's so good that you are trying to do things by yourself!

I understand you have written some code locally, which you are now
trying to make work. Would you be comfortable to share this as a
patch? This way people can look and perhaps give advice.

The instructions how to send a patch are here:
https://flashrom.org/dev_guide/development_guide.html

You can add in the commit title "WIP", "doesn't work yet", or
something like this. And post the link to the patch in this thread.
Thank you!

On Sun, Dec 8, 2024 at 12:14 AM S. <b...@uxdx.net> wrote:

Next errormessage, now he likes the VID 5523:

flashrom v1.5.0 on Linux 6.8.0-49-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using default 2000kHz clock. Use 'spispeed' parameter to override.
linux_spi_init: failed to set speed to 2000000Hz: Inappropriate ioctl
for device
Error: Programmer initialization failed.

Stephan


Am 07.12.24 um 13:58 schrieb S.:
Hello,
now I have tried it myself, the only difference I know between ch341a
and ch341b is PID:VID 1A86:5523 (instead of 1A86:5512). So I changed the
VID in ch341a_spi.c and flashrom_udev.rules. But unfortunately this does
not help, I get the error message “Couldn't open device 1a86:5512” when
starting flashrom, although in the source code PID:VID is now set to
1a86:5523. Strange.
Stephan

Am 25.10.24 um 15:36 schrieb S.:
flashrom supports only programmers with ch341a, but many programmers
sold now have ch341b onboard, pid:vid is then 1a86:5523

tnx in advance
Stephan
_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org
_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org
_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org



_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org



_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org



_______________________________________________
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org

Reply via email to