2
\$\begingroup\$

I hope you can help review my design-

I'm working on a keyboard PCB design. I thought I was nearly done, but after happening across discussions on USB impedance matching of the data traces (and differential pair routing), I thought I'd better at least try and address this.

Due to design constraints, I'm not able to place the USB plug near the MCU (Atmega32u4) - so I have to route the data traces a loooong way across the board.

enter image description here

From what I read, to attempt to design to match an impedance value, you need to put a copper fill (GND) on the back of the PCB, have no interruptions to that ground plane under the traces, and set your data line traces to be a specific width, and a specific width apart - and - also try and keep the traces the same length.

I've managed to get the ground plane in, uninterrupted from USB plug to MCU. I've also set my D+/D- trace widths and separation, as per this calculation - trying to reach 90 ohms on differential impedance.

enter image description here

(Values picked from the manufacturer: https://jlcpcb.com/capabilities/Capabilities)

Since this is only a keyboard, I don't need high transfer speeds, so I guess that means my design does have to be 110% perfect in this regard... Due to the spacing of the USB connector pins and MCU pins, I had to compromise on trace width and taper it in..

Here are a few close-ups:

enter image description here

enter image description here

Here are the Termination Resistors: In the keyboard design world, it common convention to put in 22 ohm resisters in the D+/D- lines:

enter image description here

These are 0402 package resistors (so, tiny).

Here is another chat about these termination resistors for USB: https://www.eevblog.com/forum/projects/why-usb-data-series-resistors/

Questions:

  1. Do you think I've done a reasonable job at routing those D+/D- traces to try and match impedance? Any obvious things I could improve?
  2. I'm worried about the Termination Resistors - they cause the traces to diverge a bit... I think that will mess up the impedance matching efforts? I don't have JLCPCB specs for min distance for SMT assembly... So I don't know if I can move them closer... Any thoughts on this? Should I just try and make them as close as possible together?
  3. The very value of Termination Resistors is a question... 22 ohm is the usual value cited (also in the atmega32u4 datasheet) but I don't know how that factors into the overall impedance of the D+/D- lines? (I'm still learning...)

Thank you very much :)

\$\endgroup\$
4
  • \$\begingroup\$ What USB rate is this using? High speed, full speed, ... ? \$\endgroup\$
    – The Photon
    Commented Dec 4, 2020 at 16:44
  • \$\begingroup\$ Lower speed USB is far more forgiving than it should seem. I've seen a USB keyboard using a single-sided board -- that was impressive! \$\endgroup\$
    – BB ON
    Commented Dec 4, 2020 at 19:21
  • \$\begingroup\$ You might want to add some ESD protection near that socket. \$\endgroup\$
    – jaskij
    Commented Dec 5, 2020 at 7:51
  • \$\begingroup\$ In case anyone is wondering, I got the boards back, and they worked first time! (after I spent 2h troubleshooting charge-only USB micro cables...). I don't have the means to measure actual impedance, but the above worked. \$\endgroup\$
    – codemonkey
    Commented Dec 24, 2020 at 2:28

2 Answers 2

2
\$\begingroup\$
  1. Yes the theory is correct and I suppose the calculated trace geometries are what pops out of the formulas are correct too. But the problem is that you have a 2 sided board with height of 1.6 millimeters, so based on these input values, the output values, while correct, are quite odd looking. As you can see, the trace width is exceptionally wide and even wider than your power traces, only thing wider is your ground plane. So the result is not practical, as in practice, USB would be implemented on a board with 4 layers, where the ground plane is closer to data tracks, and the data track would then be narrower.

  2. I don't think you should not worry about discontinuity caused by resistors making the tracks to diverge more for a few millimeters. It really does not make any difference since the trace geometry is very odd looking anyway due to the use of 2 layer board with 1.6mm thickness. And it would be more important that the termination resistors are at correct place along the tracks, they should not be in the middle of PCB trace, but right at the MCU pins.

  3. The datasheet says 22 ohms so that's what is necessary for the MCU to drive the lines with correct impedance then, if the MCU internal structures have lower impedance.

\$\endgroup\$
1
  • \$\begingroup\$ Hi @Justme, thank you very much - this certainly gives me the points I need to clean up the design, and some confidence to pull the trigger and get this manufactured. \$\endgroup\$
    – codemonkey
    Commented Dec 4, 2020 at 22:58
2
\$\begingroup\$

The answer by Justme answers most of your questions but I'll add a few points:

  • IF this is a USB full speed (12 Mb/s) design, as would be common for a keyboard, then you have a lot of leeway in the design. You don't need to worry about the small discontinuities formed by tapering the traces at the ends or the divergence to fit the resistors. That said, it's still good practice to make the design "clean" and minimize discontinuities when it costs you nothing.

  • Ideally, the termination resistors should be located near the IC. The long trace you currently have between them and the IC can act as a resonant structure that can cause substantial reflections at specific frequencies (and since the USB data signal is broadband, this means they affect some "parts" of your signal differently from others, making it hard for the USB receiver to compensate for their effects).

  • Where you said, "I'm worried about the Termination Resistors - they cause the traces to diverge a bit... I don't know if I can move them closer", remember that there's no rule a trace has to enter the resistor pads from the center of an edge. You can have your traces enter the pads at the near corners, preserving the trace separation right up to the pad.

\$\endgroup\$
1
  • \$\begingroup\$ Hi @The Photon, thank you very much for the considered reply. Good point on the resistors - I'll fix that!! :D I awarded the mark to the frist response, but I regard your reply as equally correct. Thank you again. \$\endgroup\$
    – codemonkey
    Commented Dec 4, 2020 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.