
Once upon a time I wrote a couple of articles about the FTDI FT232H chip widely known in narrow circles and its various applications. FT232H for DIY was good for everyone, but it also had several drawbacks - the LQFP48 case is relatively unpleasant for manual soldering (for true hardcore fans, there is another option in QFN48, I don’t want to
solder DIHALT ), the price for the original chip is from 250 rubles, the likelihood of
problems with drivers on fake chips and some functional redundancy, for example,
JTAG support is needed not by everyone.
The solution, as usual, came from the Middle Kingdom, in which, after several years of
blunt perking of the creative adaptation of other chips, they finally released their own USB-TTL converter -
WinChipHead CH341A in the SOP-28 package (not DIP, but also soldered without problems).
The chip was launched around 2006, but it came to my attention only in 2014, when I2C / SPI programmers on this chip flooded European EBAY, with sellers offering a price of 3.5 euros along with delivery, which at an average cost A good Chinese programmer like the MiniPro TL866A at 50 euros turned out to be such a tempting offer that it did not work out.
')
If you are still wondering what this Chinese chip can do for $ 1 and whether it is worth paying more, if you don’t see the difference, I ask for cat.
Briefly about the chip
CH341 is a multifunctional converter from USB 2.0 to UART, EPP, I2C and SPI.
In UART mode, not only RX / TX is supported, but also other control signals, so you can make a USB modem on the chip. In the parallel port mode, the EPP interface and printer emulation (allowing to connect printers with LPT interface directly to USB without writing additional drivers) is implemented. In serial mode, I2C and SPI interfaces are supported.
The chip requires minimal additional strapping (external quartz and several capacitors). You can use an external EEPROM to store custom Vendor ID, Device ID, and some chip settings. Power supply from 5 V (via the built-in LDO controller), or from 3.3 V directly.
In addition to the CH341A in the SOP-28, there are two options in the SSOP-20 - CH341T and CH341H, the first one is deprived of support for SPI, in the second one - I2C, therefore I will not consider them in this article.
Possible uses
Described in the
article about FT232H , I will not repeat, just note that on CH341A I checked only the performance of the TX and RX, and not the entire UART interface, if suddenly there were some sudden underwater rakes,
as was the case with I2C on FT232H - write a comment, I will be happy to add it to the article.
Finished goods
The Chinese industry offers a
million and one versions of the universal I2C / SPI programmer on this chip, one another cheaper.

I’ve got a 3.5 euro option, according to the manufacturer’s assurances, can program 24xx (I2C) and 25xx (SPI) series chips, which are supposed to be inserted into a ZIF socket (if they are in a DIP-8-300 package), or press down to the landing pad on the back side of the board (if they are in SOIC-8 or SOIC-16), or connect them with wires. Only UART and SPI are displayed on the comb, and the I2C will have to be taken from the ZIF socket if needed (this flaw has been fixed in newer versions, but they are more expensive).

The scheme of the programmer differs from the reference one from the
datasheet only by using an external LDO controller instead of the built-in one; apparently, the built-in was not very reliable. On my copy, it was saved on everything and except for CH341A on the board 2 LEDs (Power and Run), 2 resistors, 5 capacitors (2 for quartz and 3 for the LDO controller), 12 MHz quartz,
AMS1117 LDO for 1 A and a two-chip ZIF socket in the DIP-8-300 package. From the settings there is a single jumper that switches the programmer between I2C / SPI and USB-UART, while its Device ID changes.


In Windows 8.1, drivers for both modes are pulled automatically from the network, while in Linux they have been in the kernel for several years.

For programming in Windows, Chinese software is used by some SkyGz authorship, which is distributed illegally by most EBAY vendors, but does not stop working from this. Here is a link to it - malthus.mooo.com/download/file.php?id=893 - just do not forget to
feed the parrot and then fix the eye patch .
For Linux, there are open projects
ch341prog (SPI) and
ch341eepromtool (I2C), both work quite well, but it would be nice to add support for both modes in the flashrom (look,
xvilka , popular programmers for the price of dirt, and FR still does not know how ).
I checked the work of the programmer in Windows 8.1 x64 and Xubuntu Core 15.04 x64 on the I2C chip OnSemi 24C16 and the SPI chip Winbond W25Q64CV, working with I2C takes seconds (because on the chip 2 KB of memory and, if desired, you can read and write
almost with hands ), but the eight-megabyte SPI chip reads in a minute, and it is written in two, which, of course, is far from a record, but not too long for a device for $ 5.
Conclusion
If you do not need support for JTAG, tens of thousands of different chips and ICSP, but you need a means of fast backup / restore of firmware of various devices from routers to PCs and servers - I recommend the CH341A programmer for purchase, it works out its 5 bucks. And when his support is added to the flashrom - it will be very good.
On the other hand, I would not embed the CH341A into the design of my devices, since its reliability with constant use raises some doubts, and if there are questions, there will be no one to ask them, because even the
site of the chip manufacturer from outside China opens through time.
Thank you for your attention, and let your firmware never fall.