question on USB routing

Status
Not open for further replies.

lzzzam

Member
Hi everybody :)!
I've been following this community for the last six month since I discovered the Teensy board and started to learn as much as possible to get my ideas realized and now I am here to ask some questions about the last part of my project: creating a custom PCB!!!
After creating the schematic and choosing the proper footprint and 3d model for each of the components I am finally ready to start the PCB layout from a "blank page" in KiCad with, hopefully, all the background settings OK!
All my schematic is based on the following Teensy reference schematics:
-Teensy 3.2 ref. : https://www.pjrc.com/teensy/schematic.html
-Audio Board(ver1): https://www.pjrc.com/store/teensy3_audio.html

I will use the USB port only as Power input for the board, except for the first program flashing session.

My question is: how should I deal with USB tracing? Which rules of thumb should I follow to get it work properly?

Can someone suggest me good Guideline references for USB routing?
 
My question is: how should I deal with USB tracing? Which rules of thumb should I follow to get it work properly?

First, here's the same advice you'll find pretty much everywhere: Keep the D+ & D- traces close together and approximately the same length. Place the two 33 ohm resistors together, closer to the chip if you have more than an inch or two of trace length. If not using a ground plane (4 layer PCB), route a ground trace together with the signals. Either side is fine, though next to D+ is probably the most convenient since it's nearest to D+ in the USB connector.

Now here's some advice you probably won't see much: don't stress this too much. With these chips it's only 12 Mbit/sec. Layout and PCB specs matter more with 480 Mbit/sec speed, and especially with USB 3.1 superspeed. If you search enough you'll find lots of sites with all sorts of dire sounding advice. You generally don't need to worry about controlled impedance PCBs, special surface flatteness specs, exotic signal simulation/verification software, or other stuff that's done for multi-gigabit signals. A couple small vias in the routing aren't a big deal. 90 degree trace routing isn't going to have any significant effect. With only 12 Mbit speed, you still do need to keep the traces together and similar length, but a lot of that advice you'll find is overkill and just not worthwhile for only "full speed" USB.
 
It's very easy to get overly fixated on 1 particular part, to the point of not investigating other stuff.

Last week there was a thread about a PCB design being unreliable (most failed, but a couple boards worked), with ~20 messages about the crystal layout. I don't recall if we ever heard what the problem really was, but it sounded like something about the board's power supply was oscillating with the USB cable or power from USB host (or something else... we never saw the schematic or layout on that one), making too-high voltage that blew the chip. But it took a *lot* of conversation about the crystal before anything else could be imagined wrong.

Of course the crystal layout is important and the MKL02 page has a section about it because several people had trouble in the early days. Likewise USB matters. But it's a very natural human tendency to focus too much on one thing, to the point of neglecting other seemingly easy stuff that also matters.
 
First, here's the same advice you'll find pretty much everywhere: Keep the D+ & D- traces close together and approximately the same length. Place the two 33 ohm resistors together, closer to the chip if you have more than an inch or two of trace length. If not using a ground plane (4 layer PCB), route a ground trace together with the signals. Either side is fine, though next to D+ is probably the most convenient since it's nearest to D+ in the USB connector.

Now here's some advice you probably won't see much: don't stress this too much. With these chips it's only 12 Mbit/sec. Layout and PCB specs matter more with 480 Mbit/sec speed, and especially with USB 3.1 superspeed. If you search enough you'll find lots of sites with all sorts of dire sounding advice. You generally don't need to worry about controlled impedance PCBs, special surface flatteness specs, exotic signal simulation/verification software, or other stuff that's done for multi-gigabit signals. A couple small vias in the routing aren't a big deal. 90 degree trace routing isn't going to have any significant effect. With only 12 Mbit speed, you still do need to keep the traces together and similar length, but a lot of that advice you'll find is overkill and just not worthwhile for only "full speed" USB.

Hi Paul!!
Thank you for the super fast and accurate answer :cool:!
Are there any particular suggestions regarding the D+ and D- traces distance and width?
I've read somewhere that the traces should act as 90 ohm impedance in order to avoid reflections phenomena on the TL, so I wonder if I should follow some particular dimension guidelines about these two traces.

Regarding the bootloading procedure, considering I will use a MK04, Is the following thread the official reference I should follow to get MK20DX256VLH7 correctly bootloaded? ----> https://forum.pjrc.com/threads/27497-MINI54-Bringup

I'd like to share some usefull informations I've collected from around the Web that I am currently using to create the PCB starting from "Blank" project. Hope this can be usefull for someone.
View attachment Synth_Reference_Projects.pdf
 
Are there any particular suggestions regarding the D+ and D- traces distance and width?

Yeah, my recommendation is to not worry and just use whatever trace size you have for the rest of the board.

As a general guideline, you should concern yourself with characteristic impedance when a wire is longer than about 1/10th of the shortest meaningful wavelength. To compute the wavelength for a digital signal, two useful rules of thumb are to multiply the expected frequency by 5 or 7 (square waves have odd harmonics, 5th harmonic is usually plenty) and assume electricity propagates along the wire at half the speed of light.


Regarding the bootloading procedure, considering I will use a MK04, Is the following thread the official reference I should follow to get MK20DX256VLH7 correctly bootloaded?

Got the pre-programmed MKL04 or MKL02 from PJRC and use it with a blank MK20 chip.

If you can't find any MK20 chips (lately they've been out of stock), email Robin to see if she can sell you a small quantity.
 
Yeah, my recommendation is to not worry and just use whatever trace size you have for the rest of the board.

As a general guideline, you should concern yourself with characteristic impedance when a wire is longer than about 1/10th of the shortest meaningful wavelength. To compute the wavelength for a digital signal, two useful rules of thumb are to multiply the expected frequency by 5 or 7 (square waves have odd harmonics, 5th harmonic is usually plenty) and assume electricity propagates along the wire at half the speed of light.

wavelenght = v/f = (1.5*10^8) / (5 * 12*10^6) = 2.5 m

So in this case 1/10 of wavelength would be equal to 0.25 m ==> Max_usb_trace_lenght = 9,84252 inch.
So remaining under this upper threshold the USB routing should not be considered as a TL, would you confirm this?

Got the pre-programmed MKL04 or MKL02 from PJRC and use it with a blank MK20 chip.

If you can't find any MK20 chips (lately they've been out of stock), email Robin to see if she can sell you a small quantity.

Perfect, I will!

I have another doubt about crystal, I know this is a super popular question that has been already answered many many times but it looks like still unclear to me:
Crystal Guideline PJRC---->https://www.pjrc.com/store/ic_mkl02.html
In this page it is suggested to use a 16 MHz crystal with 8pf/10pf load capacitance, but
in the reference schematic for 3.2 (https://www.pjrc.com/teensy/schematic.html) this cap is not reported.
Should I strictly follow the schematic?
Can you suggest a crystal that will work?
 
Last edited:
Ok, very good news! I think it's enough for now,
Could I still use this thread to collect my future doubts/questions :D?

I really appreciate your help, thank you very much Paul.
 
Status
Not open for further replies.
Back
Top