Thursday, December 31, 2020

KiCAD - Sonnet interop flow

I've been using KiCAD as my PCB design tool of choice for years, and as my designs grew in complexity I began using Sonnet for EM field simulation prior to manufacturing boards.

Unfortunately, interoperability between these tools was less than ideal.

KiCAD export formats

  • Gerber/Excellon: Stable and reliable
  • DXF: Generates one file per layer. Drill hits can be plotted as Xs, but there's no obvious way to plot hole boundaries. Seems to sometimes generate polygons which are not closed (missing the last vertex).

Sonnet import formats

  • DXF: Standard feature with all (paid) Sonnet editions. Expects one file, with a separate pen type for each conductor or drill layer. Minimal tolerance to malformed files.
  • GDSII: Extra-cost option, but reasonably priced (about 25% of the cost of L2 Basic)
  • Gerber/Excellon: Extra-cost option, absurdly priced (five digits). Only runs on Windows, not available in the Linux edition at all. Apparently this is because it's a third-party conversion tool they license as a binary, so they have no ability to port it or offer less extravagant pricing.

I spent a while tinkering and came up with a flow using KLayout that seems to work well, so I thought I'd do a quick writeup so other folks could benefit from it. This might be of interest to users of other PCB CAD tools as well. Although KLayout is nominally an IC mask layout editor, it can also read Gerber!

Step 1: Gerber generation

Nothing special here. Export your gerbers just like you would for manufacturing a board.


Step 2: KLayout import

Launch KLayout and select File | Import | Gerber PCB | New Project - Free Layer Mapping. Specify the location of the exported gerbers.


On the next page, if asked to automatically populate the project, say "no". Answering yes will result in all of your soldermask, silkscreen, etc files being imported as well, which you probably don't want.

Click the plus sign button in the top right of the dialog and select all of the copper and drill layers of interest for your simulation.


On the next page, you should see one GDS layer generated for each of the files you're importing. There's no need to touch any settings.

 
On the next page, map gerber files to GDS layer IDs in a logical order. I suggest top to  bottom with blind/buried vias in sequence and through-board vias at the end. Each gerber file should be mapped to exactly one GDS layer.

Leave all settings on the next page as default.

On the next page, make sure the database unit is 1.0 micron. Coordinates are rounded to multiples of the database unit internally, so it needs to be small enough to avoid round-off errors. Microns are the most convenient unit to use with Sonnet's DXF importer.

Check the "merge polygons" box. This flattens all overlapping polygons, which is important because KiCAD likes to generate extra gerber flashes in vias and zone fills.

While not merging, or merging in Sonnet, will ultimately produce the same simulation result, Sonnet's geometry editor (xgeom) gets really slow if your geometry has too many polygons. Flattening before Sonnet sees the board avoids this.

Now the gerber conversion is done! Click "import" and you should see the PCB in the KLayout editor view.

Step 3: KLayout export

Select File | Save As. Choose file type DXF and pick a file name. Select "no compression", scaling factor 1.0, database unit 1 micron, and polygons as POLYLINE.

Step 4: Sonnet import

Create a new, empty Sonnet project and configure your desired stackup so that all layers and metal types are available for import. Select File | Import | DXF and choose the generated DXF file.
 
Choose "Import using present project as template".

On the next page, enter the layer mappings you selected in KLayout.

On the next page, select units as microns.

For the remainder of the Sonnet import wizard, enter settings as appropriate for your design. Converting vias to rectangular greatly reduces memory requirements for simulation and is normally OK as long as the vias are electrically small.

If you have large via fences, coplanar waveguides, or similar, the "simplify via arrays" option may be of use as well. This one needs to be used with caution because it sometimes merges more vias than desired. I generally prefer to import individual vias and merge manually to avoid unexpected results.



Wednesday, July 22, 2020

Experiments with RF cables

Introduction


Over the years I've grown to have quite the collection of RF cables in my lab, some with better datasheets than others. But how good were they really? I decided to fire up the VNA and collect some data to see how a few of them really performed.

Experimental setup:
  • Data was collected on a Pico Technology PicoVNA 106 with current traceable calibration, at a controlled 21C ambient temperature with 45% RH.
  • SOLT user calibration was performed immediately before data collection.
  • All SMA connections were torqued to 5 lbf-in.
  • SMA female-female couplers were used between the VNA cables and the DUT cables. These were not de-embedded as I don't have a VNA cal kit with SMA male terminations.
All cables were SMA male at both ends. If available, I tested two identical cables of each type to see how well matched they were.

4001 S-parameter points were collected at even intervals from 10 MHz to 6 GHz. I used Sonnet's S-parameter viewer for analysis of the collected data,

Cables tested (all SMA male-male)

Insertion loss

Results were mostly as expected - longer cables had higher loss, and higher quality cables had lower. I was a little disappointed to find that the Crystek semi-rigid cable didn't outperform the Mini-Circuits, though.

S21 of cables under test

After normalizing to cable length, results were:
  • Mini-Circuits .086: 0.71 dB/foot
  • Crystek Microwave .086: 0.76 dB/foot
  • CD International RG-188: 0.78 dB/foot
  • CD International RG-174: 1 dB/foot

Return Loss

Better quality cable assemblies definitely won here.

S11 of cables under test
It's a bit hard to see since the graph is so busy, but the CD International cables (red, blue, black) had consistently higher return loss than the Crystek (pink, cyan) and Mini-circuits (green).

The CD International RG188 cable got as high as -17 dB S11 at 4.77 GHz. The worst Crystek cable hit -25.1 dB at 2.63 GHz, and the worst Mini-Circuits cable hit -25.4 dB at 1.51 GHz.

Propagation Velocity

Nothing too surprising here.

Group delay of cables under test
Everything was pretty flat, and longer cables had longer delay. Calculated propagation velocities (assuming all cables were exactly the nominal length):
  • Crystek .086: 1.68 ns/foot (0.61 C)
  • Mini-Circuits .086: 1.53 ns/foot (0.66 C)
  • CD International RG-188: 1.49 ns/foot (0.68 C)
  • CD International RG-174: 1.60 ns/foot (0.64 C)

Phase Matching

For the cables I tested two of, I zoomed in to compare how tightly the propagation delays were matched.

Most of these measurements are a bit noisy because I'm pushing limits of phase resolution on my VNA.

CD International, 3 foot RG-174. Looks like one is about 50ps shorter?
CD International, 3-foot RG188. Can't see any skew at all.
Crystek Microwave 1-foot .086. Maybe 50ps of skew?
Mini-Circuits 2-foot flex .086. No observable skew.

Conclusions

There's a few takeaways from this little experiment.

First, at the speeds I currently work at, there appears to be no need to worry about buying expensive phase-matched cables. While different types of coax had significant skew between equal-length cable assemblies, skew between two units of the same SKU ranged from "at the edge of my ability to measure" to entirely undetectable.

Given that my oscilloscopes sample at 20 Gsps when not doing channel interleaving, the maximum skew between any of the identical cables tested would result in a single sample of phase error. This shouldn't be enough to cause problems with my measurements.

Second, all of my cables have non-negligible loss. Even the high-quality Mini-Circuits cables have 0.8 dB of loss at the 2 GHz bandwidth limit of my current flagship scope, and 1.1 dB at the 4 GHz bandwidth limit of the new one I have on the way. I'm definitely going to start thinking more seriously about de-embedding cables from my measurements moving forward.