CH341A Mini Programmer
CH341A is an USB interface chip that can emulate UART communication, standard parallel port interface, parallel communication and synchronous serial (I2C, SPI). The chip is manufactured by Chinese company Jiangsu QinHeng Ltd.
CH341A is used by some cheap memory programmers. The IC is somehow limited in this configuration, because the programmer makes use only of the SPI and I2C interface. A popular device is the so-called "CH341A MiniProgrammer" that you can buy for 2 to 5 USD.
The problem is that this device comes as-is, without any documentation or software. Drivers are available from manufacturer's website (but the site is written in Chinese). Also, some source codes are available from manufacturer. But, first of all, let's have a look at the hardware.
A quick look at the board reveals the main electronic parts used: CH341A, a 12 MHz crystal required by the chip, a 3.3V regulator, two 7 pin headers and the ZIF (zero insertion force) socket. As you can see, the device also comes with a SMD adapter and some pinheaders for it.
If you search, you will find a schematic, apparently for this programmer. But a closer look at the PCB revealed that my programmer does not follow it exactly. So, I analyzed the PCB and came up with the following schematic.
|CH341A Mini Programmer Schematic|
Further searching lead me to WAVGAT store (on AliExpress). Their product page offered a the PCB design of the device (only top side, however).
|CH341A Mini Programmer PCB (WAVGAT)|
Now, let's return to the schematic and analyze it a bit. The chip is powered from 5V, so its I/O ports will also use 5V. Basically this is a 5V device. The problem is that any memory you fit in the socket will be powered from 3.3V. And this seems to be the only function of the 3.3V regulator (besides the 3.3V pin on the SPI connector). I don't know why the designer even used a regulator, if it didn't provide a switch to choose 3.3V or 5V levels and supply.
By reading the datasheet, we can see that the manufacturer recommended to connect a 0.47uF capacitor between RSTI (pin 2) and VCC for improved stability. They also forgot this one.
Even so, I used the device with I2C EEPROMS (3.3V and 5V) compatible and also SPI FLASH memories (3.3V devices) without any issues. For improved reliability, I would recommend using a level shifter.
In order to turn this programmer into a 3.3V device, you could cut the 5V line from VCC pin (28) and tie it to the 3.3V output from regulator. You will also need to connect V3 pin (9) to VCC (3.3V). Note that the device works as a programmer only if ACT# pin is connected to ground via a resistor. That's why you should put a jumper across pins 1 and 2 of the UART connector. Otherwise the device will be recognized as a standard USB to serial converter.
first two are the ones you need):
- CH341SER.EXE - self installing archive with USB to serial driver.
- CH341PAR.EXE - self installing archive with multiprotocol interface driver (this one is for the programmer mode)
- CH341SER.ZIP - archive containing driver files and serial API and library (you don't need specific API for standard serial port, but it contains some special functions to get IC version etc.)
- CH341PAR.ZIP - archive containing driver files for interface mode and API (header and library to access the device and use any protocol you want).
- CH341PAR_LINUX.ZIP - archive containing Linux driver source code and Linux API
- CH341SER_LINUX.ZIP - Linux driver source code for serial port (don't need this one, it's already included in kernels)
- CH341EVT.ZIP - some source code and tools written to be used with an evaluation board (may be useful for programming software that can access this device)
- CH341DS1.PDF - datasheet, in Chinese
- CH341DS2.PDF - some additional info and API documentation, in Chinese
- CH341DP.ZIP - contains an ISP programming tool?
- CH341DPS.ZIP - probably similar to the above, but requires login to download