Author Topic: CH340G + Bluetooth, USB powered switching.  (Read 782 times)

0 Members and 1 Guest are viewing this topic.

Offline AmmoJammoTopic starter

  • Frequent Contributor
  • **
  • Posts: 808
  • Country: au
CH340G + Bluetooth, USB powered switching.
« on: March 28, 2021, 09:00:27 am »
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!
 

Offline drvtech

  • Regular Contributor
  • *
  • Posts: 111
  • Country: gb
Re: CH340G + Bluetooth, USB powered switching.
« Reply #1 on: March 28, 2021, 11:09:45 am »
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.
 

Offline AmmoJammoTopic starter

  • Frequent Contributor
  • **
  • Posts: 808
  • Country: au
Re: CH340G + Bluetooth, USB powered switching.
« Reply #2 on: March 28, 2021, 11:27:10 am »
R55 and R56 form a 1.1k pull down on the USB_5V already ;)
I've added a 1N4148 to the CH340G, it results in the chip getting about 4.4volts VCC, which is below spec.  :--
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12879
Re: CH340G + Bluetooth, USB powered switching.
« Reply #3 on: March 28, 2021, 11:38:23 am »
Its the usual parasitic power problem you encounter when you cant either tristate or drive to ground output signals to a powered down peripheral.


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.
« Last Edit: March 28, 2021, 11:43:13 am by Ian.M »
 

Offline AmmoJammoTopic starter

  • Frequent Contributor
  • **
  • Posts: 808
  • Country: au
Re: CH340G + Bluetooth, USB powered switching.
« Reply #4 on: March 30, 2021, 12:01:14 pm »
The fix simply ended up being to power the CH340 off the same regulator as the Arduino.  :palm:

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!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf