pcb-rnd knowledge pool

 

Automatic routing (builtin router, freerouting_cli and external freerouting gui)

freerouting by Erich S. Heinzle (VK5HSE) on 2017-02-04

Tags: howto, autoroute, routing, freerouting, freerouting_cli

node source

 

 

Abstract: Howto for pcb-rnd and the external autorouters freerouting_cli and freerouting

  Automatic routing of PCBs is an interesting topological problem and various approaches exist for doing it.

pcb-rnd support simple autorouting of selected rats with the "Connects->Auto-route selected rats" menu option.

The "rats" are simply the flying wires indicating connectivity in the absence of copper trackwork, polygons or pours to complete the connection.

We begin with an example of automatic tracks laid down by the default autorouter in pcb-rnd.

We start with a layout showing the components and rats

After running the built in autorouter, we get the following

As can be seen, the autorouting gives a functional result, although arcs and forty-five degree corners are not supported.

Since release 3.0.0, pcb-rnd includes full support for Specctra DSN file save and load, as well as continuing to support .SES session file import.

The Specctra import and export code allows pcb-rnd to work with external autorouters such as the standalone Java GUI application "Freerouting", written by Alfons Wirtz, as well as a new headless version of Freerouting, freerouting_cli.

Option A: "single click"

The "single click" method offers a dialog box (and an action for CLI/automation) that can drive an external autorouter. It requires pcb-rnd > 3.0.0 (or svn > =r35666). The installation path and executable file name of the external autorouter can be configured in conf subtree plugins/ar_extern/ (e.g. from the preferences dialog tree view).

The new headless cli version of Freerouting, called freerouting_cli, can be found at http://www.repo.hu/projects/freerouting_cli/ . The headless version allows the java application to be called from within pcb-rnd with user defined parameters, with the results of the autorouting then automatically imported back into the layout.

freerouting_cli can be built from source using the simple makefile provided, and installed in /opt/freerouting_cli (or with suitable pcb-rnd configuration, to another preferred directory) which can then be launched by pcb-rnd using the system installed java runtime environment.

Alternatively, pre-built x86-64 binaries are available that do not require system installation of a java runtime.

The interface for freerouting_cli is found under the "Connects-> External Autorouter" menu. The external autorouter interface allows the number of postroute optimisation passes, autoroute passes, and pre-route fanout to be configured.

The "Connects-> External Autorouter" menu also supports the traditional GUI version of Freerouting, installed in /opt/freerouting.net by default, but also supported elsewhere with suitable configuration of pcb-rnd. The difference being that the freerouting GUI is launched, and the autorouting progress can be watched in real time before the results are imported back into pcb-rnd.

The process of autorouting with the new external autorouter interface is shown in this video

Option B: manual export/import

Then manual process works with older pcb-rnd versions as well but requires more steps to complete.

The standalone GUI version of "Freerouting" has been used for some time by users of KiCad's pcbnew application for autorouting in preference to its in built autorouter.

The following short video demonstrates how to use the standalone version of Freerouting with pcb-rnd, using "java -jar FreeRouting.jar" ( desktop file ) downloaded from https://github.com/Engidea/FreeRoutingNew:

"Specctra" is simply a proprietary name for a set of file formats that allow interchange of electronic designs between applications, and is not uncommon as an interchange format for autorouters. Specctra files are essentially an s-expression format description of a PCB layout.

A Specctra .DSN file describes an entire layout, whereas the .SES (session) file describes the incremental change over and above a reference or initial .DSN described design.

Freerouting was obtained from the following github repository, which includes a precompiled .jar file which can be run easily from the command line if a Java virtual machine is installed.

https://github.com/freerouting/freerouting

Quirks in the Freerouting code include an improperly escaped " character, i.e.

(pcb notnamed

  (parser

    (string_quote ")

    (space_in_quoted_tokens on)

    (host_cad "pcb-rnd")

    (host_version "1.2.0")

  )

and also exporting in mm rather than microns in the .DSN export; although it exports in microns in the .SES export. After these issues were addressed, loading worked without issue.

DSN export from pcb-rnd was tested, and exported files were found to load without difficulty in the Freerouting utility.

Autorouting was initiated in Freerouting, and it proceeded to autoroute the layout without fuss.

The modified .DSN file was then exported from Freerouting and code in pcb-rnd (see  pcb-rnd svn ) addressing the aforementioned quirks allows the .DSN file was able to be loaded into pcb-rnd for comparison with the original layout

Having confirmed the ability to export, process and reload the .DSN file, further testing was undertaken with an existing design to allow a quick comparison with the inbuilt autorouting.

Again, starting with the same simple layout as before, which was used to demonstrate the built-in autorouting...

...a .DSN file was exported with the "File->Export Layout..." menu item

This was then loaded into the java Freerouter and quickly autorouted

A .SES session file was then exported with the "File->Export Specctra Session File" menu item in Freerouter, which was then loaded in pcb-rnd using the ":LoadDsnFrom(filename)" command

...at which point the newly created routes appeared on the existing layout, along with the rats

After hitting "o" to sort out the remaining rats, the layout looked like this:

As can be seen, the Freerouting software generates 45 degree angles by default, unlike the built in autorouter. Freerouting can also work with free angles and other options selectable in its menu system.

Further testing is encouraged, and time spent with Freerouting will likely allow more if its features to be utilised.

The small autorouted example board was actually made with the gEDA toolchain prior to the new autorouter support. Being a fairly simple design, the layout was hand-routed, and the resulting layout can be seen in gerbv:

And here's the board, as delivered

KiCad users may recognise some of the footprint silkscreen elements, which were ported from KiCad modules with the translate2geda and kicadModuleToGEDA utilities.

Of course, pcb-rnd can load and save KiCad Layouts with embedded modules, and has built in support for loading and saving KiCad modules, as well Eagle binary and XML footprints, as well as BXL footprints and gEDA PCB footprints which can then be saved in pcb-rnd format if desired.