logo elektroda
logo elektroda
X
logo elektroda

CH341 à la Bus Pirate - cheap and moderately useful

ostrytomasz  10 7407 Cool? (+54)
📢 Listen (AI):

TL;DR

  • A CH341-based multi-tool turns the chip into a Bus Pirate-like interface for I2C, SPI, smart batteries, sensors, displays, and other electronics.
  • It uses the CH341 as a physical interface and adds loosely related modules for device detection, raw read/write, and protocol-specific support.
  • Version 1.04 supports BME280, BMP280, Si7021, SSD1306, DS1307, ADS1115, LAN8742, and more, with Windows x86/x64-only binaries.
  • It reads smart-battery parameters, but battery programming proved more complicated than expected, so full battery support is postponed.
  • CH341 limits such as slow SPI and irregular UART at higher speeds make 1-wire and WS2812 impractical, and the app requires the CH341PAR driver.
Generated by the language model.
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..
Attachments:
  • CH341A_tool_1_4_0_bin.zip (543.51 KB) You must be logged in to download this attachment.
  • CH341A_tool_1_4_0_src.zip (687.54 KB) You must be logged in to download this attachment.

About Author
ostrytomasz wrote 488 posts with rating 211 , helped 82 times. Been with us since 2004 year.

Comments

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]

FAQ

TL;DR: Version 1.04 supports 10+ hardware functions, and one user called it "good for quick component tests." This FAQ helps Windows x86/x64 users turn a cheap CH341A into a Bus Pirate-like tester for I2C, SPI, displays, sensors, RTCs, Ethernet PHYs, and smart-battery reads while avoiding voltage, address, and MAX7219 chain pitfalls. [#21519538]

Why it matters: A low-cost CH341A can cover many bench-test jobs, but only if you match the right board, driver, platform, and protocol limits.

Option Best use Voltage handling Practical advantage Thread verdict
CH341A board with ZIF socket EEPROM/programmer-style use Often needs correction Common and cheap Less ideal as a general tester
Simpler CH341A board without ZIF General component testing 3.3 V / 5 V switching Convenient and safer in practice More suitable as a tester
Native Windows x86/x64 Running this tool Supported Works with CH341PAR Required
Windows ARM or Wine Running this tool Unsupported No thread workaround given Not supported

Key insight: The software is most useful as a fast, practical tester, not as a full-feature programmer. Its strength is broad basic coverage across many chips and buses, with clear limits on speed, platform support, and edge cases like cascaded MAX7219 modules. [#21513592]

Quick Facts

  • Version 1.04 includes I2C device detection, raw I2C/SPI read-write, smart-battery status reading, MDIO Clause 22 + MMD access, and LAN8742 cable-length measurement via TDR + CBLN. [#21513592]
  • The tool runs only on Windows x86 or x64 and requires the CH341PAR driver; it does not run on Windows ARM or Wine. [#21513592]
  • Later updates added an I2C scanner view switch, cascaded MAX7219 support for up to 4 modules, and configurable I2C scan range and interval. [#21569251]
  • The thread highlights two practical voltage rails for tester boards: 3.3 V and 5 V. A simpler CH341A board without ZIF is described as more convenient for component testing. [#21519538]
  • Newer supported hardware includes a CH1115 48x88 px 0.5" OLED, DS3231 RTC, TEA5767 tuner, INA226 power monitor, and VEML7700 light sensor. [#21569251]

How do I install and use the CH341PAR driver so the CH341A tool works on Windows x86 or x64?

Install the CH341PAR driver first, then run the program on native Windows x86 or x64. The application will not start without that driver. 1. Connect the CH341A board to a Windows x86/x64 PC. 2. Install CH341PAR; the author notes it may already be present if you used the board as a programmer. 3. Launch the executable and use the needed module, such as I2C scan or SPI read/write. [#21513592]

What functions does the CH341 Bus Pirate-like tool support in version 1.04, and which interfaces and chips can it test?

Version 1.04 supports a broad set of bench-test functions over I2C, SPI, MDIO, and dedicated device modules. It can detect I2C devices, read and write raw I2C/SPI data, read smart-battery status, handle displays like HD44780, SSD1306, MAX7219, and CH455, and test sensors including BME280, Si7021, MPU6050, VL53L0X, and BMP180. It also supports Si5351A, RDA5807M, DS1302, DS1307, MCP4725, ADS1115, and Ethernet PHY register access with LAN8742 cable-length measurement. [#21513592]

Why doesn’t this CH341A application run under Windows ARM or Wine, and what are the practical alternatives on those platforms?

It does not run there because the author only supports Windows x86 and x64 with the CH341PAR driver. The thread gives no Windows ARM build, no Wine workaround, and no compatibility layer fix. The practical alternative in the thread is simple: run the tool on a native x86/x64 Windows machine. If your goal is serial-memory programming rather than this tester, the author notes that many other CH341A-supported programmer tools already exist. [#21513592]

What’s the difference between list view and i2cdetect-style view for I2C address scanning, and which is more practical when debugging devices?

List view is more practical for this tool, while i2cdetect-style view is better for quick visual mapping. One participant preferred a graphical $00-$7F grid with rows 0-7 and columns 0-F because it shows addresses at a glance, like Linux i2cdetect. The author replied that text form is more practical here, but later added a presentation-style choice so you can use either list or i2cdetect depending on the debugging task. [#21569251]

How can I avoid confusion between 7-bit and 8-bit I2C addresses when scanning or reading datasheets?

Use a scanner that shows the address clearly and keep a binary view nearby when the datasheet uses only bit notation. The author explicitly mentions getting stuck on 7-bit versus 8-bit conventions and says adding a binary display would help. A full scan across $00-$7F also reduces ambiguity, because it shows the actual detected slave address range instead of forcing you to mentally convert from datasheet write/read bytes. [#21514795]

What is MDIO Clause 22 with MMD, and how is it used to read or write Ethernet PHY registers?

MDIO Clause 22 with MMD is the Ethernet PHY management path this tool uses to access standard and extended registers. "MDIO Clause 22 with MMD" is an Ethernet PHY management interface that reads and writes standard Clause 22 registers and extended MMD registers, letting software inspect settings and diagnostics through the CH341-based tool. In practice here, the author exposes read/write access to ETH PHY registers from the application, so you can test and poke PHY configuration directly from the CH341 interface. [#21513592]

What is TDR plus CBLN in the LAN8742, and how does it measure Ethernet cable length?

TDR plus CBLN is the LAN8742 cable-length feature exposed by the software. "TDR + CBLN" is a PHY-based cable-diagnostics function that estimates Ethernet cable length using the LAN8742, exposing a built-in test feature through the tool rather than requiring a separate dedicated cable tester. The thread states that the application supports Ethernet cable length measurement via LAN8742 using TDR + CBLN, but it does not give numeric resolution, distance range, or calibration details. [#21513592]

How do you identify whether an OLED module uses SSD1306, SH1106, SH1107, or SSD1315 by reading its status register over I2C?

Read the OLED status register at address $00 and decode the lower 6 bits. The thread gives these values: $03 or $06 for SSD1306, $07 or $0F for SH1107, and $08 for SH1106. Some newer 128x32 and 128x64 modules return $02 or $04, which the participant says matches SSD1315 behavior and practical compatibility with SSD1306. This method comes from the ss_oled 4.3.1 approach discussed in the thread. [#21514734]

Why can the first read of the OLED status register fail on controllers like SH1106, while the second read returns the correct ID?

Because this detection method can miss on the first transaction, especially with SH1106-class controllers. The thread states that the first read of status register $00 may fail, but the second read always returns the correct value. For practical debugging, treat the first read as a warm-up and confirm the ID on the second attempt before deciding whether a module is SSD1306, SH1106, or SH1107. [#21514734]

What are the limits of the CH341 chip for protocols like 1-Wire, WS2812, high-speed SPI, and fast UART output?

The CH341 is limited enough that the author rules out 1-Wire and WS2812 support in this application. He cites limited SPI speed and irregular UART output waveform at higher speeds as the main blockers. That means the tool works best for moderate-speed testing and basic control tasks, not for timing-sensitive LED protocols or buses that need tighter waveform control. The same speed limits also make CH341 unattractive for high-throughput storage work. [#21513592]

Why do cascaded MAX7219 8x8 LED modules show missing lines or incomplete data during testing, and how do No-Op bytes fix it?

They show incomplete data because bytes still sit in earlier shift registers instead of reaching the last modules. A user testing a 4xMAX7219 chain saw missing lines on the right-hand displays, and the author concluded that an empty byte must be added at transitions. Appending No-Op data, such as 16 zero bits, pushes the pending words farther down the chain so every module receives its intended frame. [#21520135]

How do I test a 4-module MAX7219 display chain with this CH341A software without misdiagnosing a working board as faulty?

Test it by accounting for chain latency before blaming the board. 1. Send the test pattern once and look for missing lines on the rightmost modules. 2. Press Write one extra time so leftover shift-register data reaches the incomplete displays. 3. If the image becomes correct, the board is fine and only needs No-Op padding in software. The thread confirms that a 4-module chain can be tested successfully this way, even before proper cascade support was added. [#21520135]

CH341A programmer board with ZIF socket vs the simpler CH341A board without ZIF — which is better as a general component tester and why?

The simpler CH341A board without the ZIF socket is better as a general tester. A participant says that version is more suitable because switching the tested circuit’s logic and power between 3.3 V and 5 V is correct and convenient. He also notes that the rest of the tester-relevant features are the same as on the more common programmer board, so you lose little while gaining cleaner day-to-day usability. [#21519538]

What are the voltage-safety concerns when using common CH341A boards at 3.3 V or 5 V, and which board modifications are actually recommended?

The main concern is that many common CH341A programmer boards are considered faulty by design and often need correction before safe use. The thread points to corrected boards and favors a tester board with proper 3.3 V and 5 V switching. It also mentions a strong opinion that 3.3 V conversion may be unnecessary because the pins have limited current capacity, but the author explicitly refuses to rely on that claim for all pins and all target circuits. [#21519697]

What is the best low-cost approach for eMMC programming if CH341 is too slow, and why would a USB-SD adapter or microcontroller-based solution work better?

Use a dedicated USB-SD adapter for single-device work, or a faster microcontroller design for a multi-programmer. The author says CH341 is very unattractive for eMMC because of severely limited SPI speed, USB Full Speed limits, and the need for polling. He adds that any dedicated USB-SD adapter would be many times better, while a multi-programmer should use a microcontroller with 4 SD and Ethernet controllers or USB HS. [#21569251]
Generated by the language model.
%}