3
\$\begingroup\$

At the beginning - I'm a hobbyist not professional so be merciful and expect some basic knowledge holes I'm not aware off ;-)

I have some custom PCB with ESP32 uC powered up from Li-Ion with charging system built in. On the board there's also UART <-> USB translating circuit CH430C. It's used for communication with the chip and flashing. Almost everything at first glimpse works fine. Li-Ion is being charged and discharged nicely. CH340C communication works. RST and DTR signals work. ESP works. Problem is such that UART-USB communication works only for few minutes and then breaks - ESP most likely works tho. Oscilloscope readings suggest huge ground instability(1V). Schematic of the circuit is like this: Circuit schematic p1 Circuit schematic p2 Board looks like that: PCB Physical Board What exactly happens? I connect the device to PC and start communication via picocom on Linux. Device booted normally and started to print regular program logging. After few minutes the communication broke tho with an error:

FATAL: read zero bytes from port
term_exitfunc: reset failed for dev UNKNOWN: Input/output error

Then I started to reset power circuit. Everything woke up(at least if it comes to voltages) but the device was not recognizable anymore. After tinkering few minutes and few resets more I was able to reproduce this behavior again. During circuit investigation with oscilloscope I've discovered that connecting probe's ground automatically fixes the problem. The same happens when I additionally connect ground from some other USB port of my PC to any place on the PCB (so when device is connected with port 1 GND D+ D- and 5V and with port 2 GND). Ground from the oscilloscope is relative to the PC ground - that's how it works - I think so at least. Anyway because of that I had trouble to measure what exactly happens with ground voltage on the board. I had to measure it with disconnecting the ground - voltage levels got shifted but at least the trend was visible.

Oscilloscope showed that when additional grounds are connected voltage on the +Bat is stable with subtle wave from the charger. When it gets disconnected the wave gets blurred and much more noisy with chronically distributed 1V peaks.

Unstable behavior without GND Stable behavior Grid is 200mV

Desoldering the charger circuit helps as well so i assume that this is the culprit (or rather some bad PCB design). Can you tell me what actually happens there and how to fix it?

Thank you a lot for spending time over my somewhat long description ;-)

\$\endgroup\$
2
  • \$\begingroup\$ Being a hobbyist doesn't exempt you from using ground planes and a double sided PCB does it. Cost isn't an argument either because what you have doesn't work and is causing you hours of frustration. \$\endgroup\$
    – Andy aka
    Commented Dec 31, 2021 at 14:52
  • \$\begingroup\$ I'd also suggest you choose C4 very carefully. You want a 10uF 25V part and that is unlikely ia a 0603 or 0805 footprint. Track down the datasheet for the actual capacitor you used and see if it has a dc bias derating graph. \$\endgroup\$
    – Kartman
    Commented Jan 1, 2022 at 11:32

3 Answers 3

2
\$\begingroup\$

The grounding on that board is pretty poor, yes. The ESP32 has really high ground impedance to everything else.

I´d add a second layer on the PCB for a ground plane, then a (or several) vias close to every ground pin, plus some extra via stitching.

To try and make this board work, I'd start by soldering some thick wire something like these blue lines, reducing ground impedance from ESP32 to CH340C and for the USB. enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ isn't that ESP32 thing actually a sub-PCB with its own (rather sufficient) ground plane? Otherwise, I'd be missing an antenna. If that's the case, solid ground planes aren't that important, but a direct ground return path would. \$\endgroup\$ Commented Dec 31, 2021 at 13:48
  • \$\begingroup\$ Ok. I'll give it a try then and post the results ;-) it's a homemade PCB (termotransfer and dissolving) so vias and double layers are not in the range of my capabilities. I made it only to proove that it's gonna work anyhow. After that I wanted to design and order bilayer PCB. Anyway as I said I'll test it out right away \$\endgroup\$ Commented Dec 31, 2021 at 13:52
  • 1
    \$\begingroup\$ @MarcusMüller That is true, it's not absolutely necessary that it is a ground plane. But adding a ground plane to a single-layer design is a very efficient and unless very large scale production, very cheap way of creating a good direct low impedance ground path. \$\endgroup\$
    – Klas-Kenny
    Commented Dec 31, 2021 at 14:03
  • \$\begingroup\$ Ok, it helped to improve the stability a bit. For sure it's better and communication gets interrupted less often. Still far from perfect tho because some nasty peaks on the oscilloscope remain and it still breaks from time to time. Anyway i guess all the problem is the grounding. If you have any other suspicions or improvement suggestions I'll gladly hear it ;-) Thanks a lot! \$\endgroup\$ Commented Dec 31, 2021 at 14:57
1
\$\begingroup\$

Well... seems it was really something silly. Problem wasn't even with the bad grounding. It's fairly sufficient (surprisingly :D) All the problems were caused by cold solder of the GND pin from USB connector. I have no idea why the hell I didn't check it first.

Thanks everyone for the suggestions!

\$\endgroup\$
0
\$\begingroup\$

The CH340C datasheet says that when using 3.3V supply voltage, both the VCC and V3 pin must be connected to the 3.3V supply for proper operation.

\$\endgroup\$
1
  • \$\begingroup\$ Yeah Thanks for noticing ;-) It's done on purpose. I own a sparkfun devboards of CH340C where it's not connected and works pretty well. The datasheet says opposite so i just decided to check it up via trial and wired potential route to solder them up if neccessary :D If you'll look at the 3V pins, from both of them goes wiring to the noticeable pads where they were meant to be soldered together. So far it works in both configurations if the circuit is properly grounded ;-) \$\endgroup\$ Commented Dec 31, 2021 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.