Author Topic: CH340 dropping bytes (and other issues)  (Read 4205 times)

0 Members and 1 Guest are viewing this topic.

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
CH340 dropping bytes (and other issues)
« on: May 14, 2026, 08:42:53 am »
We use UART to communicate with our product.
We switched from FT232 to CH340 based cables a few years ago, and never had any problems before, until the last few months. We tried different vendors on ali, but they all had problematic cables (maybe it's the same under a different name, dunno  :-//)
Anyway, updates failed and after inspection it was because the software received truncated frames from the device.

I finally managed to have a faulty cable here at the office.. they are dispersed around the world and they cost so little it's much cheaper to send a new one. Still, we got some back and they had completely different issues regarding voltage levels i attributed to the shitty USB spec and the VBUS variation (also the MCU is really picky with voltage levels i'm afraid. I wish i could just flip a bit to use TTL inputs)

A faulty cable will reset when attached to a device (windows's unplug-replug sounds) even though the power consumption is modest.
A faulty cable, at 115200bps will read up to 26-28 bytes before not accepting any more for some milliseconds.

I looked at FIFO, buffers, raising priorities, nothing on windows' side.
The scope showed solid voltage levels (other faulty cables would have a higher low level, or would have 3.3V high instead of the expected VBUS) but then it came to me: the interframe space.
Apparently if there isn't enough time after the stop bit, after enough bytes the CH340 will stop receiving.

Setting the UART on the MCU solves the receiving problem, but unfortunately the MCU doesn't let me set different TX and RX stop bits so i have to not use the UART FIFO and write byte -> wait some microseconds -> write again. the Bootloader doesn't report back much data so it's not that big of a problem, however it is a PAIN.

Did anybody ever encounter a simillar issue? Is there some driver magic i don't know about, instead?
 

Offline BennoG

  • Frequent Contributor
  • **
  • Posts: 385
  • Country: nl
Re: CH340 dropping bytes (and other issues)
« Reply #1 on: May 14, 2026, 08:59:00 am »
If the problem is during writing then you can simply set 2 stop bits.


 

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
Re: CH340 dropping bytes (and other issues)
« Reply #2 on: May 14, 2026, 09:23:13 am »
It then expects to receive two stop bits and the problem comes back

Anyway, adding delays worked for about 30 minutes. Then the cable started misbehaving again, receiving corrupted frames.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3383
  • Country: au
Re: CH340 dropping bytes (and other issues)
« Reply #3 on: May 14, 2026, 07:14:44 pm »
Maybe also try newer parts like CH343 and even CH347 or CH346 ?
Not quite as common yet, but supposedly ’better’.
If it takes 30 mins, does cooling it then help ?
Does the MCU use a crystal?
You could also try slight nudge of the baud rate, typically 24MHz/N iirc, so you have ~0.5% steps.
« Last Edit: May 14, 2026, 07:27:16 pm by PCB.Wiz »
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2670
  • Country: us
    • KE5FX.COM
Re: CH340 dropping bytes (and other issues)
« Reply #4 on: May 14, 2026, 07:37:01 pm »
We tried different vendors on ali, but they all had problematic cables (maybe it's the same under a different name, dunno  :-//)

I think you've pretty much answered your own question.  Nothing to do but switch to a completely different marketplace that's more likely to have legitimate parts.
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5382
  • Country: nl
Re: CH340 dropping bytes (and other issues)
« Reply #5 on: May 15, 2026, 02:04:02 am »
I can understand hobbyists buying stuff from ali, but if reliability is of any concern, then buying from ali, ebay etc, is a very bad desicion.

Just analyzing a faulty cable, removing it, ordering a new cable and installing it easily takes up an hour of time. Is that really worth it to buy from such dubious sources?
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6464
  • Country: nz
Re: CH340 dropping bytes (and other issues)
« Reply #6 on: May 15, 2026, 04:52:14 am »
I can understand hobbyists buying stuff from ali, but if reliability is of any concern, then buying from ali, ebay etc, is a very bad desicion.

That's nothing to do with Aliexpress or Amazon who only run a web site and take orders on behalf of numerous vendors.

It's down to which vendor you chooose on those platforms.

Quote
Is that really worth it to buy from such dubious sources?

There is nothing dubious about buying from the official Aliexpress stores of Espressif, WCH, Seeed Studio, Waveshare,  Banana Pi, Sipeed, Orange Pi. Radxa, ...

You perhaps might not like the products or quality or something from those Chinese vendors, but if you buy from their official store on Aliexpress (usually linked to from a "Where to Buy" link on their company site) then you can be sure of getting the genuine product.

 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5382
  • Country: nl
Re: CH340 dropping bytes (and other issues)
« Reply #7 on: May 15, 2026, 05:22:26 am »
I agree, not all aliexpress shops are scams. But often it's hard to distinguish the good from the bad ones. Shops claiming to be the "official shop" for some brand are not always so.

But also: OP mentions he "tried different vendors on aliexpress". No mention of an "official" shop at all.

Quite a while ago the "blue pill" boards were quite nice. Nowadays, it's nearly impossible to buy a "real" blue pill. You can have any of 8 or so different cloned chips on them, often black topped and "stm32" printed on it, regardless of which brand chip it is.

https://en.wikipedia.org/wiki/Race_to_the_bottom
« Last Edit: May 15, 2026, 05:28:37 am by Doctorandus_P »
 

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
Re: CH340 dropping bytes (and other issues)
« Reply #8 on: May 15, 2026, 08:04:05 am »
But also: OP mentions he "tried different vendors on aliexpress". No mention of an "official" shop at all.

Because i do not make the purchases, i'm afraid. I don't know if any store was "official".
What is official in this case anyway?
We are buying UART-TTL cables, not raw chips, and unless we start opening them to make sure the chip is genuine... It's up to the seller to be honest.
« Last Edit: May 15, 2026, 08:05:55 am by JPortici »
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 16031
  • Country: ch
Re: CH340 dropping bytes (and other issues)
« Reply #9 on: May 15, 2026, 10:09:38 am »
I can understand hobbyists buying stuff from ali, but if reliability is of any concern, then buying from ali, ebay etc, is a very bad desicion.

That's nothing to do with Aliexpress or Amazon who only run a web site and take orders on behalf of numerous vendors.

It's down to which vendor you chooose on those platforms.

Quote
Is that really worth it to buy from such dubious sources?

There is nothing dubious about buying from the official Aliexpress stores of Espressif, WCH, Seeed Studio, Waveshare,  Banana Pi, Sipeed, Orange Pi. Radxa, ...

You perhaps might not like the products or quality or something from those Chinese vendors, but if you buy from their official store on Aliexpress (usually linked to from a "Where to Buy" link on their company site) then you can be sure of getting the genuine product.
FWIW, this is why I’m so annoyed that AliExpress stopped listing the vendor in search results.
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3173
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: CH340 dropping bytes (and other issues)
« Reply #10 on: May 15, 2026, 10:26:11 am »
Not CH340, but CH9102 boards I purchased from China once had confusing problems.

The reason was poor decoupling by the board designer, adding 100nF ceramic cap right on the "V3" pin solved all the issues.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: tooki

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5382
  • Country: nl
Re: CH340 dropping bytes (and other issues)
« Reply #11 on: May 16, 2026, 12:51:38 am »
The manufacturer of the CH340 is apparently:

https://www.wch-ic.com/products/productsCenter/mcuInterface?categoryId=1&tName=USB%20to%20UART

And searching for aliexpress or alibaba on their website does not give any results, so apparently this manufacturer does not have an "official aliexpress" store. Apparently they do make over 40 different USB to serial chips. I do know that the CH340 has been cloned. This happens with nearly all popular chips. The "less mainstream" chips probably are not cloned.

FWIW, this is why I’m so annoyed that AliExpress stopped listing the vendor in search results.

It's very typical for china. Instead of playing fair (I.e attempting to keep the average quality of Aliexpress up, squashing down on fake branding) they always choose the sleazy way to make a few bucks in the short term. The whole country is extremely corrupt, and the government seems mostly concerned with manipulating the media so it does not show too much.

I really don't understand why so many people and companies fall into that trap. Look at what happened to google. They went into china some 10 to 20 years ago, attracted lots of chinese employees, and (a few of) the corrupted employees stole / copied all of googles IP, and when they had enough, google was kicked out of the country again. Chine does not have to "educate" spies. They just created an (underground) payment system for anybody who has some interesting IP to sell. Then the opportunist jump in that gap by droves.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6464
  • Country: nz
Re: CH340 dropping bytes (and other issues)
« Reply #12 on: May 16, 2026, 01:49:51 am »
The manufacturer of the CH340 is apparently:

https://www.wch-ic.com/products/productsCenter/mcuInterface?categoryId=1&tName=USB%20to%20UART

And searching for aliexpress or alibaba on their website does not give any results, so apparently this manufacturer does not have an "official aliexpress" store.

They do, and it is here:

https://www.aliexpress.com/store/1100367542

This one is also safe and reliable. It sells a number of other things not only WCH (e.g. ESP32) and appears to be at least an authorised distributor.

https://www.aliexpress.com/store/1102126606

I think both have been linked to from either wch-ic.com or official posts on WCH forums in the past.
 
The following users thanked this post: oPossum, Doctorandus_P

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3851
  • Country: gb
Re: CH340 dropping bytes (and other issues)
« Reply #13 on: May 16, 2026, 07:53:42 am »
We switched from FT232 to CH340 based cables a few years ago, ...

Why did you switch? Cost?
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2545
  • Country: 00
Re: CH340 dropping bytes (and other issues)
« Reply #14 on: May 16, 2026, 08:18:39 am »
We switched from FT232 to CH340 based cables a few years ago

Switch back to FT232.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17818
  • Country: fr
Re: CH340 dropping bytes (and other issues)
« Reply #15 on: May 16, 2026, 04:13:53 pm »
As I already mentioned, if you use a FTDI chip for USB-serial, you should probably largely favor the FT230X which is much more recent and has never been cloned.
The FT232R is now tagged obsolete/NRND and I see zero reason to use it in any new design unless you have large stocks.
Ready-made adapters still sold today using a FT232R are likely from old stocks or possibly even non-genuine chips. FTDI has long removed their infamous "bricking" of cloned FT232R due to a gigantic backlash, and clones are also likely to have evolved to counteract this, so I wouldn't be surprised if there are still tons of FT232R clones out there.

The FT230X is actually cheaper if you buy genuine chips and more easily available now at least in the west.

I have no direct experience with the CH340, but otherwise rather good feedback for WCH products. That said, for USB-serial adapters that I use for debugging or as production tools, I almost exclusively use FT230X-based stuff and have never run into any issue.
 
The following users thanked this post: I wanted a rude username

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
Re: CH340 dropping bytes (and other issues)
« Reply #16 on: May 18, 2026, 03:45:09 pm »
We switched from FT232 to CH340 based cables a few years ago, ...

Why did you switch? Cost?

Mainly, yes. Any ready made cable that was not branded FTDI cost about 1/5th
of course we were dubious at first, but we tested about 50 cables and found no complaints so made the switch. We must have used about a thousand before encountering this problem, and it's only in the later batches

FT230X

Good to know, thanks!
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5382
  • Country: nl
Re: CH340 dropping bytes (and other issues)
« Reply #17 on: May 18, 2026, 07:17:52 pm »
Because I of this thread, I looked at a local shop yesterday, and (at least) both microchip and NXP make USB to Uart converter chips.

Edit: The microchip ones are apparently not good (See JPorici's comment below). I never used them myself though.
« Last Edit: May 18, 2026, 09:19:57 pm by Doctorandus_P »
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3851
  • Country: gb
Re: CH340 dropping bytes (and other issues)
« Reply #18 on: May 18, 2026, 08:17:37 pm »
Well, yeh chips, but what is often needed is complete cables, with good quality [cable, connectors, usb-uart-ic, drivers] at a fair price.
At our low-ish volume we use ftdi, but if you need thousands a year there are savings to be made looking elsewhere. Choose carefully though!
 

Offline JPorticiTopic starter

  • Super Contributor
  • ***
  • Posts: 3914
  • Country: it
Re: CH340 dropping bytes (and other issues)
« Reply #19 on: May 18, 2026, 08:20:31 pm »
Because I of this thread, I looked at a local shop yesterday, and (at least) both microchip and NXP make USB to Uart converter chips.

NEVER use the microchip ones!
 

Offline niconiconi

  • Frequent Contributor
  • **
  • Posts: 388
  • Country: cn
Re: CH340 dropping bytes (and other issues)
« Reply #20 on: May 19, 2026, 10:56:34 am »
The manufacturer of the CH340 is apparently:

https://www.wch-ic.com/products/productsCenter/mcuInterface?categoryId=1&tName=USB%20to%20UART

And searching for aliexpress or alibaba on their website does not give any results, so apparently this manufacturer does not have an "official aliexpress" store.

Getting technical information from WCH for their niche ICs can be a fairly obstructive process, just like Taiwanese LCD controllers. Some ICs have no full datasheets and no official way to purchase, if you're not buying thousands of them.

How did I know? One time, I wanted to use a USB adapter IC, I had to decipher everything from the reference design (apparently they locked the datasheet, but a reference design was casually thrown around on the website), and to purchase it from an unofficial source. Another time, I purchased a less common serial converter IC from an unofficial source, and I found the control lines didn't work, all pins stayed in high-impedance mode forever, making it impossible to reset my devboard using DTR. They later told me that my IC had old firmware and they won't provide any firmware updates to anyone outside their approved custom list. The only option was to buy another IC with newer date codes from another Shenzhen gray market vendor.

But CH340s are too popular to stop, so those are the exceptions. Over the last decade, there have been numerous IC revisions.

Apparently they do make over 40 different USB to serial chips. I do know that the CH340 has been cloned. This happens with nearly all popular chips. The "less mainstream" chips probably are not cloned.

What, people are cloning CH340?! CH340 itself has a reputation of being a cheap alternative to other name-brand serial converters. It's perhaps one of the most famous IC in China of all time, and now the low-cost alternative is getting cloned? |O
« Last Edit: May 19, 2026, 11:02:12 am by niconiconi »
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5382
  • Country: nl
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3851
  • Country: gb
Re: CH340 dropping bytes (and other issues)
« Reply #22 on: May 22, 2026, 02:50:35 pm »
https://github.com/SHWotever/FakeCH340DriverFixer
Quote
Most of the counterfeit chips are showing as USB2.0-Ser! instead of USB2.0-Serial from the USB descriptor (used by this utility to determine if the chip is likely to be fake
The device manager port name is determined by the driver, so maybe in the case of counterfeit device the WCH driver detects fake and puts the ! mark. IDK, not seen this myself.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6926
  • Country: es
Re: CH340 dropping bytes (and other issues)
« Reply #23 on: May 22, 2026, 04:03:11 pm »
I've transfered files using Z-Modem at 3Mbit/s without issues.
Using USB 3.0 ports? Sometimes can be problematic.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3851
  • Country: gb
Re: CH340 dropping bytes (and other issues)
« Reply #24 on: May 22, 2026, 04:09:07 pm »
I assume CH340 is a USB2 only device, so don't think this could be a USB3 problem, since USB3 includes the USB2 hardware. Happy to be wrong though!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->