Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Add CH340G USB to UART Converter #814

Merged
merged 5 commits into from
Oct 3, 2018
Merged

Add CH340G USB to UART Converter #814

merged 5 commits into from
Oct 3, 2018

Conversation

GrantM11235
Copy link
Contributor

@GrantM11235 GrantM11235 commented Aug 11, 2018

Unofficial CH340G translated datasheet: www.datasheet5.com/pdf-local-2195953
Official CH340 English datasheet (no CH340G): http://wch-ic.com/downfile/79
Official CH340 Chinese datasheet (including CH340G): http://www.wch.cn/downloads/file/79.html
Screenshot (updated for commit bc12df2)
screenshot
The layout is based on the unofficial datasheet with a few modifications to make it more consistent with other KiCad symbols:

  • VCC and GND on top and bottom
  • UD+ and UD- to D+ and D-
  • D+ and D- near center of left side
  • D- above D+
  • R232 configuration pin on left side

V3 is meant to be connected to VCC when VCC is 3.3V, or simply a decoupling capacitor to ground when VCC is 5V. I set its electrical type to "passive", but I am not sure if that is right.


Thanks for creating a pull request to contribute to the KiCad libraries! To speed up integration of your PR, please check the following items:

  • Provide a URL to a datasheet for the symbol(s) you are contributing
  • An example screenshot image is very helpful
  • Ensure that the associated footprints match the official footprint library
  • If there are matching footprint PRs, provide link(s) as appropriate
  • Check the output of the Travis automated check scripts - fix any errors as required

@CLAassistant
Copy link

CLAassistant commented Aug 11, 2018

CLA assistant check
All committers have signed the CLA.

@GrantM11235
Copy link
Contributor Author

Travis CI doesn't like that I didn't add a datasheet, but I couldn't find one that is official, includes the CH340G, and is in English. Should I add one? If so, which one? I am leaning towards the official Chinese one.

@GrantM11235
Copy link
Contributor Author

I put D- above D+ because that is what I saw in some of the other Interface_USB symbols, but now I see there are other symbols with D+ above D-, including all the USB connector symbols other than USB3_* and USB_C_*. Which way is preferred?

@GrantM11235 GrantM11235 mentioned this pull request Aug 31, 2018
5 tasks
@evanshultz evanshultz self-assigned this Sep 3, 2018
@evanshultz
Copy link
Collaborator

First, thanks for adding this IC and for keeping an eye out when another PR was submitted. We really appreciate the community making sure desirable parts are in the library.

You've made good reference of other parts in the library. Some of them are old symbols, and the latest guidelines for the library are at http://kicad-pcb.org/libraries/klc/, if you hadn't found that already.

Ugh. There isn't a good choice of datasheet. We need an English one but I don't find anything better than the options you showed above. Perhaps we include both WCH links above. I have emailed WCH about this to see. @poeschlr ?

Since V3 cannot source current (that I can find), Passive type should be fine.

Review feedback:

  • Put the ref des at top left and PN at top right.
  • Use USB serial converter, UART, SOIC-16 for the description to make it unique and extensible.
  • Place pin 4 at the top.
  • Pins 5 and 6 can be named UD[+|-] to match the datasheet pin names.
  • Moving V3 to the top should allow pins 7 and 8 to space apart so a crystal symbol can fit there nicely.
  • I think it's more salient to put pins 9-14 in order top to bottom. The KiCad library expressly does not make the logical symbol look like the physical package. But if you like it this way it's OK too.

@GrantM11235
Copy link
Contributor Author

I hope WCH gets back to you, it would be great to have an official updated English datasheet!

In the mean time, I made all of the other changes you suggested. This is what it looks like now:
ch340g

@G-Pereira
Copy link
Contributor

Why is V3 passive?

@evanshultz
Copy link
Collaborator

Pin types are used for the ERC engine to help identify mis-connection. There is no other reason for pin types in KiCad.

In any configuration, V3 is only connected to a passive component and not other pins where the ERC engine could help catch issues.

The pitiful documentation means we can't be too sure what the pin really does and connects to in the die, but we can see there are two states:

  1. Connected to the 3.3V power source, along with VCC, when the IC is powered by 3.3V. One might think that an external 3.3V supply may be required for the IC and this pin sinks current.
  2. Connected to a cap to ground if VCC is powered by 5V. In this mode, the cap of a specific value would make one think it may be a regulator output but that wouldn't work with the condition above. One might imagine this pin is a logic input that does something (?) to the operation of the IC when powered by only 3.3V, but with just a capacitor on the pin there's nothing to fix the DC level on the pin and paying for a cap when a resistor or tying the pin high or low is cheaper doesn't make sense.

It's quite reasonable to want to power the IC from 5V since the USB connector can supply it, but that doesn't explain the V3 pin. There's not a combination of both conditions above that I find meshes well together. If I thought a bit more perhaps I could come up with other scenarios, but that's not an official description of the pin anyway. Considering the possible connections of the pin and the reason for setting pin types, Passive is a reasonable choice. If we knew more, perhaps we could choose differently.

A bit long-winded, but does that help?

@GrantM11235
Copy link
Contributor Author

Here is my best guess about what V3 does:
USB signaling is 3.3V, so the USB part of the chip needs that voltage even when the UART part is using 5V. Therefore the chip needs an internal 3.3V regulator which requires a decoupling capacitor on the output. When VCC is 3.3V, the internal regulator will not be able to output 3.3V due to its dropout voltage, so it must be bypassed by tying V3 directly to VCC.

@evanshultz
Copy link
Collaborator

I would agree about the function, but those guesses don't align into a single pin type. Nor does it matter since in neither condition is the pin tied to the pin of another IC or to be used as a current source. So, Passive works and shouldn't cause any false negatives in the ERC engine.

@G-Pereira
Copy link
Contributor

No No No!! USB signaling is 5V!
The thing here is that there are MCUs that you want to use this chip on, for example an STM32H7 which have 3.3V logic. If you want to program it you should use that V3 pin as @evanshultz metioned in the first comment (the second doesn't make sense at all, sorry nothing personal :p ) so as to be powered at 5V and receive the 5V signaling from USB BUT output to the MCU at 3.3V which I am looking for to program an STM32H7.
Hope that gets things more clear :)

@G-Pereira
Copy link
Contributor

In my opinion V3 should be an input since it acts like one.

@GrantM11235
Copy link
Contributor Author

USB VBUS is 5V, but the signaling for low-speed and full-speed is 3.3V https://en.wikipedia.org/wiki/USB#Electrical_specification

@diggit
Copy link
Collaborator

diggit commented Sep 5, 2018

V3 is probably regulator output pin for USB transceiver and core logic. Vcc defines logic levels on UART side. When you power this IC from 5V, internal LDO is used and V3 pin is power output of this LDO. If you want 3.3V levels on UART side, you'll just short V3 and VCC and power whole IC from 3.3V.
IMO passive type should be used here.

@evanshultz
Copy link
Collaborator

@diggit
Thanks for the brief description. I probably was less helpful rather than more by writing too much.

@GrantM11235
If you're OK with everything, let's give it another day or two for WCH to respond and then I'll merge either way. Thanks for making all the updates so quickly!

@GrantM11235
Copy link
Contributor Author

Sounds good to me

@G-Pereira
Copy link
Contributor

Sorry for the wrong info

@GrantM11235
Copy link
Contributor Author

@evanshultz Have you gotten a response from WCH?

@evanshultz
Copy link
Collaborator

Nope. :( Thanks for pinging me.

@poeschlr
I know you're busy, but can you rule on the datasheet question above? We cannot find an English datasheet for this IC, but only similar ICs in the family. So use it, or the Chinese datasheet, or an unofficial English one?

@poeschlr
Copy link
Collaborator

What datasheets to distributors provide? (So digikey, farnell, ...)

@evanshultz
Copy link
Collaborator

That's just it: none of them I can find carry the IC by itself. SparkFun hosts the unofficial English datasheet. Other than that, it's the options above from the vendor, neither of which are great.

Personally, I'd go with the unofficial one so at least it's English and covers this specific IC (the "G" suffix).

@evanshultz
Copy link
Collaborator

@poeschlr
Can you please answer the question about which datasheet you'd prefer so this can get merged?

@evanshultz
Copy link
Collaborator

@poeschlr
Can you pick the option you prefer for the datasheet? You can see more details above.

The options I see are:

  1. Official Chinese for CH340G.
  2. Official English for other members of the family but not the G version created here.
  3. Unofficial English just for the G version.

I prefer the third one.

@evanshultz
Copy link
Collaborator

@poeschlr ?

@poeschlr
Copy link
Collaborator

poeschlr commented Oct 3, 2018

Ok lets go with option 3 here.

@evanshultz
Copy link
Collaborator

Great.

@GrantM11235
Please update the datasheet and I'll merge.

@GrantM11235
Copy link
Contributor Author

Done

@evanshultz
Copy link
Collaborator

Thanks for sticking it out through this saga!

@evanshultz evanshultz merged commit 9ac337e into KiCad:master Oct 3, 2018
@GrantM11235 GrantM11235 deleted the ch340g branch October 3, 2018 18:44
@evanshultz evanshultz mentioned this pull request Oct 8, 2018
5 tasks
@myfreescalewebpage myfreescalewebpage added the Addition Adds new symbols to library label Jan 2, 2019
@gcormier gcormier mentioned this pull request Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Addition Adds new symbols to library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants