Differences between CH340 & CP210X Boards

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
bitninja
Posts: 98
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Differences between CH340 & CP210X Boards

Post by bitninja » Tue May 15, 2018 12:49 am

I have a weird situation where the only difference seems to be the serial chip and it is causing an issue when I try to get to the serial REPL.

The host PC... a Raspberry Pi running Raspbian with minicom as the terminal application.

The two test subjects are a regular Wemos D1 Mini with a CH340 chipset and a Wemos D1 Mini Pro with a CP210x chip.

Both have the same firmware loaded and when I try to connect to them the regular Wemos behaves normally... but the Pro does not seem to respond to any keyboard input. If I reset the Pro, I get the reboot message in minicom and a prompt... but still no response to keypresses.

dmesg shows no errors with either board... and besides, I'm do get output from the Pro... just no input.

I tried both boards on a Windows machine with puTTy and they both worked as expected.

Does anybody have any ideas what I might try next?

Thanks.

Online
User avatar
Roberthh
Posts: 1008
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Differences between CH340 & CP210X Boards

Post by Roberthh » Tue May 15, 2018 5:55 am

It looks like the culprit is the Raspian driver for CP210x, or a combination of driver plus minicom sw. Try to change that, like using picocom, or python miniterm https://github.com/pyserial/pyserial/bl ... initerm.py

bitninja
Posts: 98
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Differences between CH340 & CP210X Boards

Post by bitninja » Tue May 15, 2018 10:20 pm

Good catch sir!

I tried picocom and it had no issues. So I am sure it is a problem with minicom.

Thank you for your help!

User avatar
Mike Teachman
Posts: 25
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: Differences between CH340 & CP210X Boards

Post by Mike Teachman » Sat May 19, 2018 2:11 am

Is there a chance that flow control settings in minicom are affecting the usb->serial device? I bring this up because in Putty I need to set flow control to None for the Wemos d1 mini. Otherwise, I see the exact same symptoms that you describe (resets to the repl prompt, but no keyboard response). Perhaps trying some different flow control settings in minicom would get it working with the Wemos d1 mini pro?

https://www.raspberrypi.org/forums/view ... p?t=109167

bitninja
Posts: 98
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Differences between CH340 & CP210X Boards

Post by bitninja » Sat May 19, 2018 4:48 am

OK, for the record, I just checked and sure enough... when I *Disabled* Hardware Flow Control in minicom it worked without a problem...
20180518_232541_small-min.jpg
20180518_232541_small-min.jpg (179.51 KiB) Viewed 725 times
I did not find any command line options to change it, but simply ran the setup...

Code: Select all

sudo minicom -s
Chose Serial port setup -> and pressed "F" to turn Hardware Flow Control to "No". Saved the settings and it immediately began to work.

Thank you, Mike!

cefn
Posts: 205
Joined: Tue Aug 09, 2016 10:58 am

Re: Differences between CH340 & CP210X Boards

Post by cefn » Mon Jun 11, 2018 5:12 pm

For reference, note this resource which has cross-platform, tested Miniterm invocations to connect to Micropython devices...

https://vgkits.org/blog/connecting-with-miniterm/

I have been investing a lot of time in Miniterm as it addresses the issue of being able to guide people through (more or less) consistent instructions across platform.

Learners working with Micropython boards are by definition interested in python3 so an installation on their desktop makes sense anyway (if they don't already have it).

Since I'm relying on Python anyway, in the end, I also created a PyPI based wrapper around Miniterm to address the complexity of describing all the variations to people and the potential for errors there. The tool auto-detects and resolves most of the differing flags, port identifiers etc. Using the wrapper https://pypi.org/project/vgkits-vanguard/ it should just be a matter of running...

Code: Select all

vanguard shell
...on all platforms.

If you experiment with the tool, let me know if you find any configurations of laptop, os, board that I need to add into the auto-detection wrapper to be able to ensure this simple experience.

fdufnews
Posts: 23
Joined: Mon Jul 25, 2016 11:31 am

Re: Differences between CH340 & CP210X Boards

Post by fdufnews » Mon Jun 11, 2018 5:42 pm

@bitninja
a little off topic, is it an old motorola phone turned into a pocket computer you are using as a terminal?

User avatar
mcauser
Posts: 313
Joined: Mon Jun 15, 2015 8:03 am

Re: Differences between CH340 & CP210X Boards

Post by mcauser » Tue Jun 12, 2018 4:01 am

Also a little off topic - on OSX I have to drop the baud rate on CH340 boards as it seems the OSX driver is buggy.
No issues with the CP210X driver.

Online
User avatar
Roberthh
Posts: 1008
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Differences between CH340 & CP210X Boards

Post by Roberthh » Tue Jun 12, 2018 5:27 am

On device using a Ch340G like the Wemos D1 mini or the Wemos Lolin32 lite I often get transmission errors beyond 230400 baud, using debian Linux. Not problems with CP210x or FT230 devices.

bitninja
Posts: 98
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Differences between CH340 & CP210X Boards

Post by bitninja » Tue Jun 12, 2018 5:57 pm

fdufnews wrote:
Mon Jun 11, 2018 5:42 pm
@bitninja
a little off topic, is it an old motorola phone turned into a pocket computer you are using as a terminal?
No, it's actually a Raspberry Pi Zero W, LCD, USB Hub and battery stuffed into a 3D printed case... in the form factor of an iPhone 4. Then I use a cheap slide-out bluetooth keyboard to complete the "portable terminal". My design can be found here...

https://www.thingiverse.com/thing:2909787

I was looking for a portable device with decent serial terminal capabilities so I could re-program my devices on the go. This was the best idea I could copy. :D

https://n-o-d-e.net/zeroterminal.html

Post Reply