logo elektroda
logo elektroda
X
logo elektroda

CH341 à la Bus Pirate - cheap and moderately useful

ostrytomasz 
Screenshot of the CH341 application displaying measurement options .

I would like to present an application that is a collection of test tools using CH341 as a physical interface.

The original purpose of this application was to repair laptop batteries.
However, I had to familiarise myself with the CH341 chip beforehand, I started with more elementary functions like I2C support and the application took the form of a collection of loosely related modules.
Programming the smart battery turned out to be more complicated than I expected and, given that I only have a few such batteries, I stopped at reading their parameters for the time being.
Screenshot of CH341A Tool application showing smart battery information. .

What emerged from this, however, was a tool with a wider range of functions, reminiscent of Bus Pirate.

Currently (version 1.04) funcionality includes:
- detection of I2C devices
- writing/reading raw data using I2C, SPI
- smart battery status reading
- sensor support: BME280/BMP280, Si7021, BMP180, SHT11, LM75, AHT10/AHT20, AS5600, APDS-9960, L3G4200D, BMI160, MPU6050, VL53L0X
- support of displays: HD44780 directly and via PCF8574, SSD1306, MAX7219 8x8 LED, CH455 LED from a DVB-T decoder
- support for Si5351A generator
- support for FM tuner RDA5807M
- support for RTC DS1302 and DS1307
- support for the MCP4725 DAC and ADC ADS1115
- read/write of ETH PHY registers via MDIO interface (Clause 22 + MMD)
- support for Ethernet cable length measurement function via LAN8742 (TDR + CBLN)

Some screenshots and photos:

Screenshot of the CH341 tool application interface for managing I2C devices. .
CH341 module with OLED display showing text. .
8x8 LED matrix controlled by MAX7219 with application on screen .
Test application interface with CH341 chip supporting AS5600/AS5600L sensor .
Screenshot of the CH341 tool application with user interface. .

I found out about the CH455 LED and keypad controller from the topic https://www.elektroda.pl/rtvforum/topic4066595.html, but in my case the "donor" was a WIWA HD-102 (burnt out power supply even before switching to DVB-T2) in which the display with the controller is placed on a separate board connected by tape.
Black WIWA HD-102 set-top box with power button and channel buttons on the front panel. .
Close-up of a circuit board controller with a ribbon cable. .
LED display module with buttons and electronic components. .
Close-up of a circuit board with an integrated circuit and tracks. .
Close-up of a circuit board with attached wires. .
Curiosity: clearly "burnt" segments of the display where "C" was displayed as "CHANNEL":
Segmented LED display and application interface with segment settings. .

This is already most of the electronic trinket I have that can be handled.
I have omitted the typical use of the CH341A as a serial memory programmer, as there is already quite a selection of software supporting this.
To the best of my knowledge, the limitations and shortcomings (limited SPI speed, irregularity of the UART output waveform for higher speeds) of the CH341 will not allow the implementation of 1-wire or the WS2812 protocol.
Support for a given chip is most often limited to basic or selected functions, allowing testing but not necessarily giving access to all capabilities.
Much of the source code comes from other open source projects, but I stick to licences that would not introduce problems for commercial use.

For a slightly longer description: https://tomeko.net/software/CH341A_tool/.
Attached: source code (Turbo C++ 2006, one of the ancient versions of C++ Builder) and executable file.
The application only works under Windows x86 or x64, it does not work with Windows ARM or Wine.
It is required to install the driver "CH341PAR" (if the CH341 was used as a programmer, this driver is probably already installed), the application will not run without it..

About Author
ostrytomasz wrote 464 posts with rating 178 , helped 77 times. Been with us since 2004 year.

Comments

Add a comment
RomanWorkshop 10 Apr 2025 20:13

A simple, small, multi-purpose and multi-purpose programmer - these are the kind of tools that prove most useful. I have suggestions for changes/improvements: 1. the scanner could scan the entire address... [Read more]

ostrytomasz 10 Apr 2025 20:48

. It does indeed fit very nicely on a small graphical display (and the Linux i2cdetect presents it similarly), but I think the text form is more practical in this case. As I look at it now, it would... [Read more]

RomanWorkshop 10 Apr 2025 21:50

. You could always add a switch of how the detected devices are presented, as both can be useful in practice. . Detecting a particular chip just based on its address is not possible, because many... [Read more]

mrtip 11 Apr 2025 08:26

. Number of unique IC models with I²C interface , i.e. how many different chips (EEPROMs, sensors, RTC clocks, etc.) have been created with I²C support . 📌 How do you estimate this? ... [Read more]

rb401 15 Apr 2025 03:55

. Right. Your program is good for quick component tests, without the need to compile examples from Arduino for example. Just now I checked a 4xMAX7219 display I bought from the Chinese with your program... [Read more]

ostrytomasz 15 Apr 2025 09:33

. I haven't thought about series bonding unfortunately - I only have one piece for now. Looks like an empty byte needs to be added on the transitions. . I plan to add one to my next order from... [Read more]

rb401 15 Apr 2025 16:34

. This is not a nuisance. You only need to additionally press the Write key once so that those words left in the shift registers of the previous cubes reach those cubes displaying the incomplete image... [Read more]

Michal2002 20 Apr 2025 00:01

Cool toy :) Merry Christmas Resurrection. [Read more]

George54351 04 Jun 2025 03:08

I am wondering about CH341 if it could do some EMMC programming as an alternative and cheap solution to large,professional and a lot more expensive programmers.Maybe i am totally wrong since i dont have... [Read more]

ostrytomasz 04 Jun 2025 08:55

If speed is what matters, it would be very unattractive due to the severely limited SPI speed, limited USB Full Speed and the need for polling. Any dedicated USB-SD adapter would be many times better.... [Read more]