Using TopoR to Autoroute a KiCad PCB

Dillon Nichols
My Life as a Tinkerer
6 min readFeb 9, 2018

Here’s a secret that I shouldn’t reveal as an electrical engineer: Of the eight or so PCBs that I’ve laid out, I’ve only manually routed two of them. One was because I wanted it as small as possible, and the other was because I wanted it entirely on one layer so it could be cut out on a CNC machine. My first two boards were designed in Eagle and used the built-in autorouter. Lately, I’ve been using KiCad, so I had to use an external tool to autoroute it. I ran across this blog post which compares various autorouters and determined that TopoR seems to be the best.

My first two PCBs autorouted inside Eagle
Launchpad headers on the outside, AT89 footprint on the inside

My first project that used TopoR was a simple PCB designed in KiCad that adapted the TI Launchpad pinout to the pinout of an AT89S52 microcontroller. I used the schematic to connect the TI’s ports and peripherals to the appropriate pins on the AT89. In the layout, I placed the headers in the desired location and then I exported the design into TopoR and it autorouted the design shown here in a couple minutes. There are no DRC errors, so I was happy to send this circuit off to be manufactured with only a few hours of work.

Josh posted a followup post about TopoR autorouting, where he described a feature in TopoR where you can assign pins to be swapped to make the routing easier. I had a project in mind where a microcontroller drives ten 7 segment displays to show the current Unix time. I took this Super 7 Segment project and removed one of the displays (which didn’t require any additional routing) from one PCB and redesigned the other PCB so it is controlled from an ESP-32 development board. I used TopoR to autoroute the controller board.

I‘ll describe the steps I used to autoroute a PCB designed in KiCad.

Note #1: To move files between KiCad and TopoR, you should use these settings:

  • Export from KiCad: File → Export → Specctra DSN
  • Import into TopoR: File → Import Design → Specctra
  • Export from KiCad: File → Export → Export Design → Specctra (before exporting, click “Settings” and ensure the Target CAD system is set to KiCad) — see GIF below
  • Import into KiCad: File → Import → Specctra Session

Note #2: To manually edit the TopoR project, you can export the design from TopoR as a TopoR PCB (File → Export → Export Design → TopoR).

Note #3: In KiCad’s Pcbnew, Edit→ Global Deletions allows you to delete all tracks, which is helpful when you want to make a major change to the layout.

1. Design the schematic. I recommend using global labels for all connections so it’s easier to manually swap pins later.

Default placement in KiCad, autoplaced in TopoR, and imported back into KiCad
The elusive “rectangles inside rectangle” icon

2. Import the netlist into KiCad’s Pcbnew. You can use the above Export/Import steps to move to TopoR and click the Autoplacement button (shown above) to move all the parts to a reasonable location. If there are any parts that you don’t want to move, you can click on the component in TopoR and in the Property bar, you can click the lock icon to lock it in place. You can also add fixed=”on” to the CompInstance of the part in the TopoR PCB file.

From this point, I moved the parts in KiCad to their required location (for instance, the header had to be in a specific location to mate with the other PCB’s header).

Some simple pin swaps can easily make the routes more direct

3. The next step is autorouting with pin swapping enabled. My design has a microcontroller with all of the GPIOs set as outputs. Six of those pins go to a driver chip which has six outputs that connect to the header. Sixteen microcontroller pins go to resistors which in turn go to specific header pins. In this case, I have four groups of swappable pins: microcontroller outputs, driver chip inputs, driver chip outputs, and resistor inputs. In the TopoR PCB file, change each group’s pins to have a specific pinEqual value (1, 2, 3, etc.).

Setting multiple pins into the same group so they are swappable
In TopoR, you can hit the “Swap equivalent pins” icon to display which pins are swappable. Each color in a different group.

Now we can hit the Autorouting icon to start routing. Ensure that you check the “Pin-swap” box in the settings if you’ve declared pins as swappable. That’s an important detail that I missed initially and left me wondering why it didn’t swap any pins.

Final pin and part placement and routing

4. At this point, I moved back and forth between the KiCad schematic and layout and TopoR. I would let TopoR produce a result and then change the schematic to match the best routes. I also started moving parts around in KiCad to produce more optimal routes. Overall this took a couple hours, but I definitely think this saved time versus doing everything manually in KiCad.

TopoR‘s autoplacement isn’t perfect. Locking every component but the resistors moved the resistors along the edge of the board.

The overall experience wasn’t perfect though. I wish there was a combination autoplace/autoroute. I would love if TopoR would move certain components like resistors to their optimal location based on routing. As seen above, it can move resistors to a central location, but it doesn’t take into account that pins could be swapped. Also, autorouting doesn’t move any components; it just routes wires. Independently these features are helpful, but it would be so powerful if they would work together. One way around this particular issue is to remove the resistors from the design and let it autoroute and later add the resistors back in-line, but this isn’t very practical. I didn’t test this idea during my project, but it may work well on a fresh design to get an initial idea where parts should go.

You know you’re almost finished when not much is moving

In the end, TopoR is still a very powerful and useful tool. Even if you don’t use it for the final routing of your PCB, it can be helpful to find the best placements or pins to use so you can route everything yourself. I’m absolutely going to use it on all of my PCBs from now on.

--

--

Dillon Nichols
My Life as a Tinkerer

Electrical engineer: hardware/firmware; tinkerer; hobbyist; amateur fabricator;