Electronics > Projects, Designs, and Technical Stuff
Help me with USB hub layout
roli:
Hi!
Not too long ago I got this brilliant idea that I want to make a custom mechanical keyboard. And of course that idea is now pretty much close to reality with one issue hanging there. I want my dream keyboard to include a USB hub. Nothing fancy - USB 2.0 - mostly used to plug in a mouse receiver or a USB key here and there.
I have some minor experience drawing PCB boards and soldering them together, but I am still just a hobbyist. So I never dealt with differential pairs and high speeds before.
After a bit of searching here and there I decided to go with the USB2514 USB hub controller from Microchip. I managed to find a working design somewhere, so I more or less copied the schematic from that. Sadly the layout is a different story. Included in the PDF is the schematic and the current board layout that I came up with. The hub is located in the upper right corner of the PCB. It has a micro USB connector for input and two standard USB A outputs, plus another output that goes to the main keyboard controller. So three outputs together.
I will use elecrow or JLCPB to manufacture the board, and it's gonna be a standard 1.6mm 2 layer board with 1oz copper. The USB lines here are 30mil wide with 5.3mil spacing. Except where possible - near the chips and micro USB connectors it tapers down to 10/15mil (as was suggested by the application note for the USB hub chipset). According to some online calculators the differential pair impedance for this board should be roughly 100 ohms. Now, I know that for USB you need 90, but I don't think I can get that here.
Can somebody please look this over and tell me if it is going to work or not? And if possible... how can I improve this to give it a higher chance that it will work?
Yansi:
I would highly suggest to not use the twists in the high speed bus pairs. Go around the connector, instead of placing a via in just one of the traces. Make sure the impedance is correct (guessing a 2l board hence they are that thicc) and they are length matched according to the specification.
Either use vias in both highspeed traces similarly (to introduce similar/same signaly delays/distortion in both lines) or just don't use them.
Swapping the pins using a via for the USB lines to the MCU, I wouldn't care much, it is just 12mbps data. Slow noncritical stuff. You would likely get away even with much higher impedance traces there.
Haven't checked anything further, I guess you have done your homework in that area.
//EDIT: Also, as a side note: Your USB hub is already USB non-compliant, due to not providing downstream power supply switching and overcurrent protection. Adding it is easy and beneficial. Stuff like STMPS2141 is dirt cheap and easy to use.
roli:
Awesome, thank you.
I will try to get rid of the twists by going around the connectors as suggested. Not sure what to do with the micro-usb input one though. No easy way of going around it there. So, next best thing is just placing vias that don't go anywhere just to get that symmetry?
As for power switching... didn't know it needs that. Especially since it's powered by the host only (no external power supply). One thing that I was debating though is wether or not I should place a schottky diode on the power input or not.
TheUnnamedNewbie:
--- Quote from: roli on March 25, 2020, 06:37:15 am ---Awesome, thank you.
I will try to get rid of the twists by going around the connectors as suggested. Not sure what to do with the micro-usb input one though. No easy way of going around it there. So, next best thing is just placing vias that don't go anywhere just to get that symmetry?
--- End quote ---
A think I seem to remember seeing done is to simply send both traces to the bottom layer. Then, when you get back to the MCU, you can simply have one switch to top before the other to do the crossing. This way, the length remains matched, and if you do it right, the length difference will also not be too big.
(but hey, I am not a baseband PCB designer so don't quote me on this)
Yansi:
--- Quote from: roli on March 25, 2020, 06:37:15 am ---Awesome, thank you.
I will try to get rid of the twists by going around the connectors as suggested. Not sure what to do with the micro-usb input one though. No easy way of going around it there. So, next best thing is just placing vias that don't go anywhere just to get that symmetry?
As for power switching... didn't know it needs that. Especially since it's powered by the host only (no external power supply). One thing that I was debating though is wether or not I should place a schottky diode on the power input or not.
--- End quote ---
No! Vias in the signal have to be symmetrical in both lines. If the DP line has two vias in it, DM line should have also two and go through them. Do not create stubs.
Schottky in series? No. USB has a rather tight spec on power supply voltage range. One diode drop lower and you are almost out of spec even if you get 5V input exactly.
Not sure if the power switching is required by the spec (never done any USB hubs), but it helps at least as an overload/short protection. Otherwise one faulty device plugged to the hub will likely bring the whole hub down, due to the upstream port going into overload.
The USB spec is available for free, download it and have a read or two in there.
https://www.usb.org/document-library/usb-20-specification (top right link)
Navigation
[0] Message Index
[#] Next page
Go to full version