how best to swap "lane positions" of a differential pair? - Page 1
Forum section: electronics / projects

author: cbc02009
author_rank: Regular Contributor
timestamp: April 24, 2020, 05:20:10 pm
content: I have a project I'm working on where the D+ and D- of the USB port are exactly opposite of the identical pads on the MCU (shown in the attached image). It probably doesn't *need* to be a differential pair, since it's only usb 2.0, but now I'm curious, so I figured I'd ask.Is there a standard way of swapping lanes like this? Or a best way? I was thinking of using a pair of vias to cross one lane over the other via the top layer, but I remember reading that differential pairs should have the same number of vias, so there must be a better way, right?(Sorry if this belongs under the beginners section. I wasn't sure if this was too technical for that forum or not)

author: Gyro
author_rank: Super Contributor
timestamp: April 24, 2020, 05:37:49 pm
content: Not a serious suggestion, but here's how you do itafteryou've got it wrong on the PCB!Edit: Actually, you could use the terminator resistors (properly) to swap the signal pair.

author: cbc02009
author_rank: Regular Contributor
timestamp: April 24, 2020, 07:24:24 pm
content: Quote from: Gyro on April 24, 2020, 05:37:49 pmI'll keep that in mind if I can't figure anything else out...

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 24, 2020, 08:01:32 pm
content: Vias are fine, just match the length (if your EDA tool doesn't calculate routed length correctly, remember to add a board thickness to the route length for every via). Not even a huge deal, it's fast but not bleeding edge fast. (USB standard is free and open -- length and impedance matching specs are in there, take a look.)If you can escape the connector differently, that's another opportunity to swap as well. The one trace will dogleg around taking up much more length which should be balanced with an accordion or whatever on the other line, so remember to allow some space for that.Also a good idea to keep the overall routed length short, so you don't need to worry so much about impedance matching.BTW, lengths should be matched over any discontinuity, say if you're routing between VCC domains and the pair happens to be over said power planes. (A typical 4-layer stackup being signal, GND, VCC, signal, so that would be bottom side routing, and the discontinuity being split planes on VCC.) Anywhere up to the discontinuity, it doesn't really matter where the length tuning (accordions or whatever) goes, near the connector, near the edge, in the middle of the route, whatever.This applies to vias as well, and yes, preferably you'd have them complementary (at matched routing lengths, and in as nearly the same location as possible).Neither of these really matter all that much in practice, with proper design and routing. Entire planes should not be noisy enough (say 10s of mV, at high frequencies say >100MHz) to pick up significant induction, whether from swapping layers (VCC-GND noise) or by crossing planes (VCC1-VCC2 noise). Placing a bypass cap (VCC-GND) near the via(s) can help.This is, however, good reason to avoid local current loops in switching supplies, especially fast, high power ones.Most likely you're routing over one solid plane and neither of these even apply, just FYI to get a feel for the motivation behind it.Note that you'll basically never meet the impedance spec on a 2-layer board, so I'm just assuming you're doing 4. If not, well, the impedances won't be great, putting even more priority on keeping the route short!Tim

author: nctnico
author_rank: Super Contributor
timestamp: April 25, 2020, 12:23:21 am
content: Quote from: cbc02009 on April 24, 2020, 05:20:10 pmHow about routing the differential pairs from the other side of the connector? That way they are in the right order without needing vias.

author: cbc02009
author_rank: Regular Contributor
timestamp: April 25, 2020, 11:57:19 am
content: Quote from: nctnico on April 25, 2020, 12:23:21 amGAH! I can't believe I didn't think of this. This is the easiest solution, considering it's only a 2 layer board. Thanks!

author: cbc02009
author_rank: Regular Contributor
timestamp: April 25, 2020, 11:58:37 am
content: Quote from: T3sl4co1l on April 24, 2020, 08:01:32 pmThanks for the super informative post! It's true that my project is only using a 2 layer board, but you make a lot of good points. Cheers!

author: Siwastaja
author_rank: Super Contributor
timestamp: April 25, 2020, 12:06:11 pm
content: With a 2-layer board, the impedance will be so far off that I would be primarily concentrating on trace lengthminimizationinstead of matching, any length matching pattern is going to increase the trace length which is very bad with a large impedance mismatch.If the connector has to be on the board edge, try to put the MCU near that edge as well. Sometimes vias can help you minimize the length, for example, the connector could be on the opposite side placed so that the MCU pins are just "via away", with just a few mm of trace.