Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 7 months ago #17611

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
I've been doing some searching on the net and came across the schematic of the cheap CH340 USB adaptor modules reverse engineered by Piotr at Nice Circuits. These modules are nice that 3.3v or 5v operation may be selected by a jumper. I remember Burt's circuit has that feature too but if I remember correctly this looks a little simpler (my apologies to Burt if it's the same circuit - I'm too lazy to go back and look!).

Attachment NiceCircuitsSchematic.jpg not found



Then I found this interesting version at NodeMCU of the CH340 circuit used on their ESP8266 boards. Strangely, it looks to me like the CH340 is configured for 5 volt operation which is surprising because the ESP8266 is a 3.3v chip. I like the Schottky diode on the Vusb line to keep 5 volts from the board (if externally powered) from flowing back into the USB host.

The transistor XOR gate on DTR and RTS is curious. If both those lines are logic 0 or 1, the RST and GPIO0 outputs are both logic 1, but if the state of DTR or RTS are opposite, either RST or GPIO0 is logic 0. I'm not sure why they have this circuit at all. Perhaps DTR and RTS can power up at logic 0 or logic 1 depending on the host settings but you only get an output when one of the lines is toggled. Hmmm...thinking a little more, this arrangement does mean that only one of the RST or GPIO0 signals can be asserted at a time (i.e., there is no setting of DTR and RTS that will make RST and GPIO0 low at the same time. I need to look at what these signals do to the ESP8266 but the cramp in my leg is gone now and I'm going back to sleep :)

Attachment ModeMCUCH340circuit.jpg not found



I have a few of the CH340 USB adapter modules on the way which should be here Tuesday, so I can get a feel for how they work.
Last Edit: 3 years 7 months ago by Jon Chandler.
The following user(s) said Thank You: hop

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 7 months ago #17612

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
Neither of those actually operate with a selectable 3V/5V setting for the chip, just the voltage to the target.

Looks to me like the IO of the CH340G is whatever the VCC is set to, so the second circuit there is going to be using 5VIO to the ESP8266. I can't figure out if the ESP is actually 5V tolerant... there's a lot of conflicting info out there. One thing I have seen from the expressif website: :
We donot recommend you to apply 5V to IO.

@hop
There are several PIC chips that have USB support however, so it would be a matter of code. I wonder why I do not see more posts on this though.
You could always write code to mimic any of the chips, but I think most folks would want it to be "identical" so they could use the same tools/drivers, and for that you endup back in Clonesville.
The following user(s) said Thank You: hop

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 7 months ago #17613

  • be80be
  • be80be's Avatar
  • Offline
  • Senior Boarder
  • Posts: 79
  • Thanks received: 90
The one I posted uses less parts and is about the same as nodemcu board I got the USB chip from there data sheet and the esp part from looking at node and hazzelnut esp.
The esp could be 5 volt but the adc is only good to 1 volt the tx line don't need anything done to the rx line I use a diode drop works great.
It doesn't like lower then 3.3 volts and works much better at higher if you want full speed serial speed.
But I'm like Jerry the esp is five volt the pins have built in lachback that hold to 5.8 volts
And kick out after that.
The following user(s) said Thank You: hop

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 7 months ago #17614

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
I'm pretty sure the ESP8266 itself is a 3.3V device.

I've read about the "snapback" circuit, but the datasheet says Vih = 3.6V max, so I don't know what to believe. The comment about "We donot recommend you to apply 5V to IO" came from the mfg, so take that for what it's worth.

I'd refuse to use the chip just because of the horrible datasheet. A measily 23 pages doesn't cut it (that number needs a zero or two after it if you ask me). Trying to find out real information on the web is just too much of a crap shot, esp since the Arduino crowd seems to like this chip and I wouldn't trust a single word from those folks.

Shame really... seems like it could be a nice chip.

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 7 months ago #17615

  • be80be
  • be80be's Avatar
  • Offline
  • Senior Boarder
  • Posts: 79
  • Thanks received: 90
There buggie chips but I've had good luck with lua on them arduino ide is not that good it wares the chip out with reflashing the whole firmware were as Lua is just loaded from the ram chip and less chance of a flash failure which happens a lot whit arduino ide. The datasheet does suck so does haft the stuff you read it was for older hardware like the esp-01 to 7 the 12 have ram chip changes and you don't no what your getting till you mess with it.
Last Edit: 3 years 7 months ago by be80be.

The Start of a New Project - CH340 USB-UART Chip and ESP8266 WiFi Module 3 years 6 months ago #17616

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
The six developer boards (2 brands) I have are working fine without issue. I program them using Arduino IDE. I haven't really done anything freaky with them yet, but they seem stable enough. One has been running for over two weeks now and still pinging away.

The pings will change to topic messages tomorrow though since I finally got my RPi Mosquitto broker to work, with all my computer gear, even my Samsung S5 using MyMQTT. Tomorrow I try the PubSubClient library on two ESP-12's and try to read temperature and light data while remotely turning on and off status LED's using each other. Then only hardware left to test is the ESP-01's I got that need a firmware upgrade, and my MCP2221's finally showed up so I'll be getting to that soon. I would also like do the broker on a RPi Zero if I can ever find one.

The ESP8266's along with a cheap RPI and home wireless network looks very promising! Once I get the network populated, I'll push it a bit to see how network pressure effects all the systems. I'm excited though.
Time to create page: 0.245 seconds