Author Topic: Adding TX and RX LED to CH340G  (Read 11754 times)

0 Members and 1 Guest are viewing this topic.

Offline cdev

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Re: Adding TX and RX LED to CH340G
« Reply #25 on: December 29, 2017, 02:43:54 pm »
You probably already know this because you want to use the USB-UART for power which makes it very convenient and also is likely to cause fewer problems with many small device setups than anything else..

I find the CP-2102's power adequate for many small devices..

But for the benefit of others reading - its always good to remember, if the other thing you are plugging into has its own power, make sure the common ground is solid, and then only use three wires.. TxD Rxd and that Gnd.

Unless you are absolutely sure it wont cause problems- especially if one of the wires- like the ground is momentarily lost -  if your ground is solid, that is quite helpful-  Its also helpful if there is only one PS -

don't have multiple power supplies feeding into something.. if you can use the same USB for power thats quite helpful. Alternatively, use separate supplies but have a strong common ground that wont accidentally come undone and then just use the UART lines for the signal and not power

Or you could conceivably fry your device or even your computer.

« Last Edit: December 29, 2017, 02:49:36 pm by cdev »
"What the large print giveth, the small print taketh away."
 

Offline bson

  • Supporter
  • ****
  • Posts: 2283
  • Country: us
Re: Adding TX and RX LED to CH340G
« Reply #26 on: December 29, 2017, 08:36:21 pm »
$0.40 + crystal + large package + dealing with no usable datasheet + no signed drivers vs $1.33 with no crystal, convenient package, a proper datasheet, and signed drivers. Yep, CP2102's a fail..
Don't forget it has an internal EEPROM, too.  And the over-USB customization software actually exists.  Not to mention the driver installer actually works (and doesn't have a Win3.1 look-and-feel) on Win10.
 

Offline boffin

  • Supporter
  • ****
  • Posts: 1027
  • Country: ca
Re: Adding TX and RX LED to CH340G
« Reply #27 on: December 29, 2017, 09:05:52 pm »
Hey guys!

I am still working on a few modifications to my AIO programmer, and I want to add LED to the Power, TX and RX. I have seen them wired every which way from Sunday, so I am a bit lost as to why you would wire one way over another, and when.

So for power I get the following, with no resistor, since I should be able to get a red 3.3V 0603 LED:




Serial is active low, do there's data when it's at 0 volts and idles at 5v (or 0/3.3 or, -12 / +12 for real RS232), so you want the LED hooked from power to the pin, not from the pin to ground.

VCC -> Resistor -> LED -> TX
VCC -> Resistor -> LED -> RX
VCC -> Resistor -> LED -> GND (power)

You need to limit the current through the LED to a couple of mA (say 1.5mA), and as the LED will drop about 2V (a little more for blue), the resistor needs to drop the other 3v
Ohms law:  R = V/I
= 3/0.0015
= 2k (probably anything from 1k to 3k3 would work just fine, I personally would use 2k2 because I like sticking to the 10/22/47 E3 series)

EDIT: fix math
« Last Edit: December 29, 2017, 09:31:37 pm by boffin »
 

Offline bson

  • Supporter
  • ****
  • Posts: 2283
  • Country: us
Re: Adding TX and RX LED to CH340G
« Reply #28 on: December 29, 2017, 09:22:01 pm »
Uhm, but the CP2102 has separate TXT/RXT pins exactly to drive activity LEDs.

OP: you want a resistor to control the LED brightness - some will be exceedingly bright at even 2-3mA.  Put a pot in series and just see where you find a good brightness; dial it in then measure the pot and pick a close resistor value.  LEDs that are too bright are just annoying, as are ones so dark they're barely visible.  Each make and color of LED will need a different value.  It's pointless to sink 20mA through a LED that's annoyingly bright, when 1mA is perfectly good.  (I have ultra-bright 0603 LEDs bought off eBay that are at perfect indicator brightness at 0.3-0.5mA!)
 
The following users thanked this post: cdev

Offline gertux

  • Contributor
  • Posts: 27
  • Country: be
Re: Adding TX and RX LED to CH340G
« Reply #29 on: December 29, 2017, 10:44:42 pm »
I should also mention that in another thread a guy reported that he had found on Ali Express a CH340 version that doesn't require a crystal.  I don't know if that's a genuine CH part or a knockoff, but that would be a nice upgrade for the CH340 - no crystal, and no caps for it.
That's correct models CH340B C and E don't use an external crystal. Never used one of those however.


Sent from my iPad using Tapatalk
 

Online Peabody

  • Super Contributor
  • ***
  • Posts: 2036
  • Country: us
Re: Adding TX and RX LED to CH340G
« Reply #30 on: December 29, 2017, 11:15:14 pm »
You probably already know this because you want to use the USB-UART for power which makes it very convenient and also is likely to cause fewer problems with many small device setups than anything else..

I find the CP-2102's power adequate for many small devices..

But for the benefit of others reading - its always good to remember, if the other thing you are plugging into has its own power, make sure the common ground is solid, and then only use three wires.. TxD Rxd and that Gnd.

Unless you are absolutely sure it wont cause problems- especially if one of the wires- like the ground is momentarily lost -  if your ground is solid, that is quite helpful-  Its also helpful if there is only one PS -

don't have multiple power supplies feeding into something.. if you can use the same USB for power thats quite helpful. Alternatively, use separate supplies but have a strong common ground that wont accidentally come undone and then just use the UART lines for the signal and not power

Or you could conceivably fry your device or even your computer.

Yes indeed.  And it turns out that this issue of which power source should be used can be tricky.  For example, if you power up the device being flashed from its own supply, and limit the USB adapter's connections to TX, RX and GND, you still have the issue of what voltage the device's Vcc is set to.  if it's 3.3V or 3.6V, then that should be no problem.  But if you're running a low-power MCU at 2V, then you're going to be feeding TX to it at 3.3V, because that's what the adapter outputs, and that may violate the MCU's absolute rating for voltage applied to any pin relative to Vcc, and smoke may escape.

There can be a similar issue related to which device gets powered up first.  If you power up the adapter via USB before you power up the device, then you're applying 3.3V from TXD to a processor whose Vcc is still at ground.  Some processors are designed to deal with that well, but not all.

So I would agree that in general it's less likely to cause problems if you can power the device from the adapter's regulated 3.3V output, and leave its normal supply switched off.  Everything comes up at the same time, and the voltages are always right.  But if you can't do that, then you need to think through exactly how this is going to happen, and check the datasheet for those absolute ratings for the device you're flashing.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf