Part 2: Board Design – HDMI/DVI Auto Switch
Let’s talk about high speed signals. I am the first to admit routing high speed signals is outside of my training and expertise. In part, this project is meant to help me learn by doing. There is a wealth of information on the internet on this, and plenty of contradicting information. But the datasheet itself provides some good suggestions. Here are the highlights:
- Maintain 100-Ω differential transmission line impedance into and out of the part.
- Keep an uninterrupted ground plane beneath high-speed I/O traces. Remember current always flows as a loop in a circuit. Most of the time, it takes the path of least resistance. High speed traces follow the path of least inductance, meaning they want to return as close as possible to the trace. It is most optimal if there is an unbroken ground plane beneath for several reasons that are beyond the scope of this article.
- Keep ground-path vias as close as possible to provide the shortest current return path. Similar to the above point, if you need to change layers make sure to keep a ground plane nearby and stitch them with vias close to the high speed vias.
- Keep the trace lengths of TMDS signals as short as possible.
- Keep intra-pair skew between positive and negative traces within 5 mils.
To achieve 100- Ω impedance, you typically need a 4-layer board. The top two (and bottom two) layers of a four-layer board are typically very close together. Impedance is a function of trace width, trace spacing, and the distance of both to the ground plane. When traces are the full 1.6mm (typical PCB thickness) apart, it is pretty much impossible to get 100- Ω impedance. I used Saturn PCB Toolkit to do the calculation. There are some online calculators too. Four layer boards are more expensive than two layer boards by quite a bit. I elected to go with a 2-layer board. To get close to the correct impedance, I used 1.0mm boards with 16mil traces at 6mil spaces. Not perfect, but I’m hoping will be good enough to pass video. I am fortunate enough to have access to an HDMI analyzer at work, so I will check them when they’re built and see how much signal degradation we’re looking at.
If this goes well (or probably if it doesn’t) I will make another board revision on a 4-layer board. I can reduce the size of the board quite a bit, and have a more optimal routing. But for now, two layers are much easier to rework if needed.
Laying out a PCB is a complicated subject. I view the process as an art, which is very puzzle like. This isn’t meant to be a tutorial in layout, however one of the most important aspects to a successful layout is the pre-placing of components. Ratsnests help substantially determining orientation, but there is always a tradeoff with parts. These were merely test layouts, before I had fully completed the schematic. I often go back and forth to determine the best parts to choose. You will see the routes are often incomplete, with few traces routed. Here is the progression of the process.
Initially, I hoped to fit everything on a 5cm x 5cm board. This started to get extremely dense quickly.
You can see some of the progression in part selection. The ESD suppression IC’s ended up being too tight to fit.
Starting final layout. Most parts had been finalized by this point (though not many are shown).
First mostly complete full layout without ground fills. I really don’t like running the TMDS through vias if I can help it. This would have worked fine, but is less elegant. Mounting the processor on a diagonal worked pretty well, especially for isolating the crystal. It is in the corner, but it seemed the lesser evil. On the right, you see my initial idea for a solderless programming header; the holes for alignment, and pads fit a specific header I had found.
Final complete route with ground fill. I found a reversed HDMI connector, where the plug faces the opposite way up and flips the pins horizontally. I ended up straightening the microcontroller to fit the dip switch on the edge. I also switched the programming header to a simple 2.54mm header for space. My favorite little touch was the “HDMI Autoswitch” label. I made the dot on the ‘i’ a via with soldermask removed on the top layer. Hope it looks good.
Final bottom layer. Decoupling caps for the HDMI switch had to be on the bottom, as did the HDMI shield caps. I couldn’t get away with all signals on the top, but of course left the ground plane under any high speed signal completely untouched. You will note the second voltage regulator and SDT DC jack on the bottom. I wasn’t sure if I could get away with the smaller voltage regulator without a heatsink, but I added it so I could try it. The DC jack gives me the option to use a standard plug instead of USB. These parts contain the suffix “ALT” indicating only one of them should be populated.
Overall I was very happy with this design. It took a decent time to do, but I was working on this in my spare time. Being a perfectionist doesn’t help finishing quickly either. It went to the fab at the end of September.