Add in place programmer's flashing "best practices" and refer to ch341a rev 1.6+ / Tigard
tlaurion opened this issue · 15 comments
There is a lot of information out there on ch341a programmer giving too much voltage (5v vs 3.3v). Users reports of having bricked their laptops (SPI chip to motherboards resistors).
One of those example is a recent exchange on slack/matrix accessible at:
https://matrix.to/#/!pAlHOfxQNPXOgFGTmo:matrix.org/$kcFoywTcHgKLIbRP3iJ1bgJ8vRUGZsZcCGvvJsCszgw?via=matrix.org&via=nitro.chat&via=talk.puri.sm
xx20/xx30 chips and motherboard resistors are really resilient and cheap ch341a providing 5v never caused any issue, but this may vary for other SPI chips/motherboard when doing in place programming (with a PAMONA clip connected to the chip on the motherboard.)
General guidelines, depending on motherboard is:
- Make sure that CMOS, AC Adapter and battery is deconnected.
- Make sure to connect the clip on CHIP prior of powering up the programmer (I never followed that even with black programmer and bricked 2 laptops to date because I didn't respect point 1 above.
- Other guides suggest to modify ch341 programmer to make sure voltage provided is 3.3v (https://www.chucknemeth.com/laptop/lenovo-x230/flash-lenovo-x230-coreboot being one of them)
- Other guides suggest unsoldering/resoldering the SPI for extra caution (never did that)
- More expensive programmer (LC Technologies ch341a programmers) were suggested (good general advice)
I would invite people into discussing facts here to be used to create additional flashing best practice page to the wiki.
The general guideline is to make sure that the wiring is conform to chip SPI datasheet (this is a standard generally used by a chip family. Here for xx20/xx30 and SOIC8 chips), making sure that orientation of the chip is good is mandatory. On SPI chips, there is a "dot" which inform the eye that that pin is pin 1:
1- CS / CS#
2- SO1-SIO1 / MISO
3- WP# / N/C
4- GND
5- SI-SIO0 / MOSI
6- SCLK / CLK
7- HOLD# / N/C
8- VCC
For example, those two guides inversed the picture with similar pin names:
- Datasheet : http://j5d2v7d7.stackpathcdn.com/wp-content/uploads/circuits/Macronix/25L3206E-DI1.gif
- Direct link to chucknemeth's picture
All of this should just replace ch341a by ch341a rev 1.6+ based boards which has output voltage selector (5v, 3.3v, 2.5v, 1.8v).
The ch341a v1.6/v1.7 is easily distinguishable from past versions by the voltage switch and additional components put on board, green color of board and smaller size compared to black one:
Green arrow shows easily distinguishable component not present on 1.1/1.2... 1.5 boards revisions.
One can see the differences between old (black, non versioned ch341a) and green clearly stating v1.7:
When flipping v 1.6+ board upside down, one can see on the board the voltage selection switch slots:
Example of readily available kits including proper pictures for visual identification of 1.6 board containing a voltage selector and the same components being easily distinguishable prior of buying:
https://shop.3mdeb.com/shop/modules/ch341a-flash-bios-usb-programmer-kit-soic8-sop8/
Floahazz 1 Metal Ch341A Programmer V1.7 1.8V Level Shift W25Q64Fw W25Q128Fw Gd25Lq64 Parts https://a.co/d/5hr2I5x
1- CS / CS#
2- SO1-SIO1 / MISO
3- WP# / N/C
4- GND
5- SI-SIO0 / MOSI
6- SCLK / CLK
7- HOLD# / N/C
8- VCC
Attacking the w530 today. Clip that came with kit doesn't fit constrained place, needed to rewire my pamona clip with wires that came with my raspberries across the years. They are 10 colors coded, that will help me and probably others replicating.
SPI Chip | Pomona Clip | Adapter Board | CH341A Programmer |
---|---|---|---|
Pin 1 (dot) | Pin 1 (red dot) | VCC (red) | 25XX (red stripe) |
Pin 2 | Pin 2 | GND (black) | GND (black) |
Pin 3 | Pin 3 | CS (yellow) | CS (yellow) |
Pin 4 | Pin 4 | CLK (orange) | CLK (orange) |
Pin 5 | Pin 5 | DO (blue) | DO (blue) |
Pin 6 | Pin 6 | DI (purple) | DI (purple) |
Pin 7 | Pin 7 (brown) | VCC or GND (brown) | NC |
Pin 8 | Pin 8 (white) | VCC or GND (white) | NC |
Then.
1- Connect sopi6/8-dip8 daughter board on ziff connector, making sure the adapter is connected into the closest holes to you when looking at the adapt from the usb connector
2- Then do the wiring pattern above. Looks like that when done:
Will definitely glue all those together with Epoxy they slide way too easily, but that works!
Got my 8mb backup from w530. Now going to make external flashing image that can be flashed only on that exposed 8mb chip which is linuxboot/heads#1189 to the flash whole maximized image internally.
W530 board owners tagged under linuxboot/heads#692
w530 (xx30): @eganonoa @zifxify @weyounsix (dGPU: w530-k2000m) @jnscmns (dGPU K1000M) @computer-user123 (w530 / & w530 k2000 : prefers iGPU) :
What have you done on stock bios for TPM to function correctly to setup TPM DUK?
Can't seem to figure it out n4ru/1vyrain#37 (comment)
Nevermind TPM error of past message! That was linuxboot/heads#1565.
That question popped again under Matrix channel https://matrix.to/#/!pAlHOfxQNPXOgFGTmo:matrix.org/$Y5a44cDMjH-CO96sfpn7ZCHeHkBDrsBjPEatp3mbcLE?via=matrix.org&via=nitro.chat&via=envs.net
To be honest, I think this thread and concerns from end users are mixing two different use cases:
Unbricking / initial flashing/non-development related dev cycles / initial external flashing was made from well testers and platform I well tested
There I actually no need here to anything better/faster /safer then a ch341a even at 5v for most older platforms (thinkpads) if all external power sources are disconnected.
dev cycles / debugging /porting of new platforms / multiple flashing a day is needed / newcomers to coreboot and external flashing / insecure end users
There are way better options then ch341a, different prices ranges, different features across reprogrammers, including some development helper kits (Tigard best of line here) that also provide logic analyser), permits to turn programmer into a coreboot usb debugging helper (through serial over usb) which is possible through beaglebone black and Tigard. So the reason this is not yet in docs is because, depending of goals and needs, there are multiple tools out there.
perplexity.ai discussion (made public) : https://www.perplexity.ai/search/Of-all-in-nfyU4c8tQp2.2GONIONnyA
Extract of markdown table:
Programmer | Cost | Theoretical Speed (16MB) | Voltage Selection | Flashrom Support | Additional Use for Debugging |
---|---|---|---|---|---|
DediProg SF600Plus-G2 | $500-$600 | 16 seconds | Multiple | Not mentioned | No |
DediProg SF100 | $200-$300 | 22 seconds | Multiple | Not mentioned | No |
CH341A | $5-$15 | 480 seconds (8 minutes) | 3.3V (mod needed) | Yes | No |
Raspberry Pi | $35-$80 | 16 seconds | 3.3V (additional hardware needed for other voltages) | Yes | No |
BeagleBone Black | $60-$90 | 16 seconds | 3.3V, some pins 1.8V | Yes | Yes |
REVELPROG-IS | $150-$200 | 16 seconds | Not specified | Not mentioned | No |
Tigard | $69-$89 | 16 seconds | 1.8V, 3.3V, 5.0V, external target voltage | Yes | Yes |
Will buy a Tigard and test across platforms I own. For some reason,s people don't want to commust ordered one ent on github and stay stubborn having sporadic and non permanent/searchable notes given on Heads matrix channel. Point against Tigard at https://matrix.to/#/!pAlHOfxQNPXOgFGTmo:matrix.org/$WDHLHatL2aVLFCxTK3EX9PUAo8t18yx-eufPSCHdQPk?via=matrix.org&via=nitro.chat&via=envs.net
EDIT: if Tigard testing is good:
- faster flash speed (1mb/s) promises met
- logic analysis promises met (maybe order later, will see)
- USB debugging dongle promise met
- maybe even switch usb debugging on all heads coreboot config so that when a brick occurs, logs would give insights to devels here. Would be awesome capability here, to some costs of privacy which might require some scripts provided to anonimize logs prior of submitting, will see.
Then revise promotion of ch341a v1.6+ to tigard/beaglebone black.
Just ordered a Tigard from https://www.crowdsupply.com/securinghw/tigard for 67$USD (to ship to Canada, prices will vary), which is not bad and a nice project giving money to someone that devotes himself changing things for the better here
Ideally, we would be able to propose a refreshed version for the beaglebone black screwdriver so that bricking could give input from testers through EHCI debugging logs, based and improved upon
https://www.coreboot.org/BeagleBone_Black_-_screwdriver
Or a cheaper alternative, providing both flashrom and usb EHCI debug support, ideally permitting to grab the logs, take micro ssd card/launch command on host and be able to upload those logs in a bug report.
Just experienced a n41 bad rom flash from linuxboot/heads@b05fbf6
Points:
- Tigard : 0
- ch341a : 1
Tigard, while faster with default settings, was constantly failing on flashrom verify step, and didn't seem to even check if what was attempted to be written was actually written while verify failed at different addresses.
Flashing with ch341a, while slower, successfully unbricked my nv41 with master rom.
Some pictures.... Scary setup. No I'm not zen enough to stay immobile for more then 8 minutes at a time with frustrating failing attempts.
- vice grip, battery pack for weight, sitting on top of nv41 fan for safety, ch341a + wson probe
- time took to read+erase+write+verify (varies depending of what needs to be written on chip from what was read: diffs applied by flashrom) :
Edit: flashrom loop command added from history: retry until successful. No power source connected (no ac, no battery, no cmos).
Undusted my beaglebone black, but discovered screwdriver is an unmaintained project :(
https://www.coreboot.org/BeagleBone_Black_-_screwdriver
unmaintainted project : https://github.com/lynxis/bbb_screwdriver_builder
Discussions:
-
Discussion with the developer (@lynxis) at https://matrix.to/#/!EhaGFZyYcbyhdSgStq:matrix.org/$qNQ-6PHpv_j4h3mZ6i6WRbvzorACuALvgfJ3h-gi9H0?via=matrix.org&via=sibnsk.net&via=nope.chat
-
@mkc has some ideas https://matrix.to/#/!rsKWMJGPMsyPTTjXuh:matrix.org/$XEHtBtSn__StlD1h__1Io83HsVqli7TNO7-FDaw7IhU?via=matrix.org&via=nitro.chat&via=hackliberty.org