CH340G + Bluetooth, USB powered switching. - Page 1
Forum section: electronics / beginners

author: AmmoJammo
author_rank: Frequent Contributor
timestamp: March 28, 2021, 09:00:27 am
content: I have the following circuit.It is intended that when the USB cable is plugged in, and powered, that it powers the CH340G chip, and disables the Bluetooth module.Ignore JP2, its removed, that's just there so I can power the Arduino from USB, rather than the external supply.The issue is, that when the Arduino is powered externally, the CPU_RX and CPU_TX pins are pulled up to 5volts, which goes to the CH340G, and bleeds through to the VCC pin, which pulls the USB_5V high, and turns the Bluetooth off.I currently have it assembled exactly as per the diagram, but R13 and R54 really should be more like 22ohm, not 1k. As it is, the USB_5V is still pulled up to about 3volts, which isn't enough to properly enable the Bluetooth module, but this really isn't a viable solution.Other than just sticking a diode on the input of the CH340G, which I won't be able to easily do, are there any other options?Also, before I go any further, is there anything else wrong with my design?Thanks for any input!

author: drvtech
author_rank: Regular Contributor
timestamp: March 28, 2021, 11:09:45 am
content: I had a similar situation with an FT230X. My solution was simply a resistor to bleed off the current flowing out of the Vcc pin. About 47k was enough in my case so I fitted 10k. You could try something similar across C27.

author: AmmoJammo
author_rank: Frequent Contributor
timestamp: March 28, 2021, 11:27:10 am
content: R55 and R56 form a 1.1k pull down on the USB_5V alreadyI've added a 1N4148 to the CH340G, it results in the chip getting about 4.4volts VCC, which is below spec.

author: Ian.M
author_rank: Super Contributor
timestamp: March 28, 2021, 11:38:23 am
content: Its the usual parasitic power problem you encounter when you cant either tristate or drive to ground output signals to a powered down peripheral.EEVblog #831 - Power A Micro With No Power Pin! (forum thread)One can sorta solve it with series resistors and maybe MOSFETs and pullups, but the devil is in the details and the result often closely resemble bodgery!One option that's a conceptually simple guaranteed fix is to use 74LVC1T45 buffers (with grounded direction pin) in the RX and TX lines between the MCU and (a) the USB serial interface and (b) the bluetooth module. They are rated for partial power down applications and tri-state their output if input side power is removed. If there's any risk of a conflict during transitions, 120R to 220R series resistors on their outputs may also be required.A more considered approach is to use an AND gate in each signal line, with the other input to the gate from the target section's Vcc so it goes to logic '0' when that section is powered down. The AND gate needs to be powered whenever any section is powered, so should be fed from all the available Vcc supplies via Schottky diodes. If input MUXing controlled by section power is also required add an OR gate powered locally after the AND gates.

author: AmmoJammo
author_rank: Frequent Contributor
timestamp: March 30, 2021, 12:01:14 pm
content: The fix simply ended up being to power the CH340 off the same regulator as the Arduino.I think this is how I'd bench tested it before I designed the PCB.The Bluetooth module doesn't care about having its RX/TX lines connected to the CH340's pins, as that's how people often add BT to an Arduino anyway.USB supply is only connected to the Bluetooth disable mosfet, and nothing else!