ESP32 and CH340 (3.3v vs 5v) - Page 1
Forum section: electronics / projects

author: okw
author_rank: Frequent Contributor
timestamp: April 14, 2025, 03:10:20 pm
content: I have a question about the CH340. My ESP32-C3 project is battery powered, and charged and firmware updated over USB.I just recently discovered that the CH340 outputs 5V, not 3.3V. I was under the impression the CH340 would have IO=3.3V by powering the CH340 with 5V (VCC pin 16), and decouple V3 (V3 pin 4) with 100nF to start it's internal 3.3V LDO. But it still outputs 5V. I thought it was internally level shifted when the internal LDO was activated, but no.Most ESP32/CH340 designs I see does not address this level issue. But I also read that the ESP32 won't be damaged by low current 5V on the IO (the IO's are zener protected, and CH340 outputs only 3mA which the ESP32 should handle well).I do not want the CH340 to be powered unless on USB, that's why I didn't power it from the 3.3V regulator (eats battery).I could use a 3.3-3.6V(?) zener on the outputs (TX, DTR, CTS), level shifters, or even run the CH340 on 3.3V, but transistor switch it at 5V presence?Should I worry about this level issue? My project will probably be charged for hours, probably overnight every second day. So if not, the ESP will be subject to 4.7-4.8V for a long period of time.

author: globoy
author_rank: Frequent Contributor
timestamp: April 14, 2025, 03:51:32 pm
content: I didn't risk it. I used a schottky diode and pull-up to 3.3V as an isolator and level shifter in recent design. Here's the relevant parts of my schematic.

author: okw
author_rank: Frequent Contributor
timestamp: April 14, 2025, 04:05:08 pm
content: Quote from: globoy on April 14, 2025, 03:51:32 pmThanks. I'll probably do this instead of risking it.By the way, your IO0 signal (for bootloader mode) will also be 5V in this design.

author: tooki
author_rank: Super Contributor
timestamp: April 14, 2025, 05:39:11 pm
content: Quote from: okw on April 14, 2025, 03:10:20 pmWhy not use the CP2102N USB-UART bridge that Espressif uses on the original dev boards? It has a built-in 3.3V regulator and thus avoids this problem entirely.

author: okw
author_rank: Frequent Contributor
timestamp: April 15, 2025, 04:14:15 pm
content: Quote from: tooki on April 14, 2025, 05:39:11 pmWell, for starters, it's over 8 times more expensive (at least from my sources).And while I agree it makes for a better design to choose the appropriate parts, it does not make me a better engineer. Overcoming obstacles and solving problems gives me more tools in my bag, and makes me more aware of potential problems for later projects. If everything just works out of the box, I learn nothing.

author: xvr
author_rank: Frequent Contributor
timestamp: April 16, 2025, 12:09:12 pm
content: QuoteESP32-C3 integrates USB controller (USB Serial/JTAG), and doesn't require externsl USB chip (like CH340)Quote

author: okw
author_rank: Frequent Contributor
timestamp: April 16, 2025, 01:53:54 pm
content: Quote from: xvr on April 16, 2025, 12:09:12 pmWhile that's technically true, it's not recommended. The native USB pins can be configured as general GPIO, and with one bodged upload you can disable the USB interface. Then you have no way of updating your firmware again (and enabling USB), unless you hook up an external USB-to-serial to the RX/TX/RESET and GPIO9 pins. That's why most recommend putting an external USB to serial chip to your product/project. I guess the native USB could be fine if you plan to never update it. Or at least have some backup plan yourself. But sending it to a customer who expects updates (not OTA) with only the native USB is a terrible idea.

author: xvr
author_rank: Frequent Contributor
timestamp: April 16, 2025, 02:02:46 pm
content: QuoteBut you can't disable USB interface from boot loader of ESP chip itself:QuoteSo it is enough have 2 buttons (resetandGPIO9) to activate USB download mode from any bogus upload.QuoteCan you point me to this recomendations? I never see one.

author: globoy
author_rank: Frequent Contributor
timestamp: April 16, 2025, 02:18:06 pm
content: By the way, your IO0 signal (for bootloader mode) will also be 5V in this design.Yup although briefly and very low current (~1V over 10k) so I felt it was safe and let the ESP32 pad clamps handle it. But one could redesign this part too.

author: okw
author_rank: Frequent Contributor
timestamp: April 16, 2025, 02:47:54 pm
content: Quote from: xvr on April 16, 2025, 02:02:46 pmI think you can choose to enable or disable USB in for example Arduino IDE. Whatever caused it to fail, it happened to me several times, and each time I had to flash it with an external USB-serial and USB worked again.Quote from: xvr on April 16, 2025, 02:02:46 pmThat's not a professional product, to have the customer open the box and press buttons, if you can avoid the failure altogether with a CH340.Quote from: xvr on April 16, 2025, 02:02:46 pmI don't remember, but I read about the problems and suggestions in forums from many users. It's also probably a good hint when even the most dirt cheap Chinese boards have added this extra cost of a CH340 (or similar).