Kicad upgrade: push & shove and freerouting revisited

Kicad PCB toolset changed a lot over last two years. Great contribution from CERN is merged with stable release on one hand, new library format and projects migration necessity on the other. Meantime Freerouter cooperative tool disappeared and my reluctance to move was justified. Until recently when I gave migration a try.

Time saving push-and-shove capabilities that I tried long time ago are now part of regular bundle. Whole bunch of new convenience functions is impressing so that moving to latest-gratest version of Kicad is natural. It is also zero-effort task as long as you do not have your own components and footprint libraries. I have my own where I keep tens of items that were missing in Walter’s library, the library I use almost exclusively since the beginning of my Kicad adventure.

First I made a backup copy of current Kicad BZR4022 version and installed BZR6032 latest version at a time to start discovery of new approach to library. Component for eeschema looked similar but footprints management were moved to new level. New approach allows reference to online libraries (github), quite handy. As I prefer offline version I took copy of Walter’s library that was already migrated to new format. As the legacy libraries are also supported I decided to use my assets in read-only mode and create new footprints in new format when necessary (no other options in fact), successively migrating old ones if time permits. At this point I found the minor bug manifesting in ERC dialog box. Few weeks later Kicad community fixed it in BZR6177.

Design migration

For next phase I took logger part of WLS project as it is most complex PBC design I had to migrate. The process looked roughly like this:

  1. Loading schema and performing ERC check. At this point Kicad tries to migrate components.
  2. Reassinging footprints. Components in eeschema can have now assigned footprints (back annotated). I prefer old way using .cmp mapping file.
  3. Regenerating net list.
  4. Loading net list in PCB editor. I do not use “dry run” since I alway have my projects backed up in versioning system. Watch out for red-marked errors.
  5. Checking for missing footprint assignments circling between schema editor and pcb editor  generating and loading net list.
  6. Performing DRC check.
  7. Verifying no parsing errors by reopening all pcb boards.
PCB broken by mispelled footprint

PCB broken by mispelled footprint

The only serious problem was slash (/) in footprint names, character that became illegal. For such footprint net list loading produces “No footprint defined for element” error. What is worse PCB design saved cannot be reopened again as pcbnew gives fatal error on board loading.

To fix it I opened .kicad_pcb original file in text editor at line 2777 as error message instructs. The section was pointing out to quartz component as follows:

  (module crystal_hc-49/smd (layer F.Cu) (tedit 53650385) (tstamp 53634F85)
    (at 95.885 58.42)
    (descr "Crystal, HC-49/SMD")
    (tags QUARTZ)
    ...

Saving the board deisng misnamed the module as shown below. Added semicolon was probable source of parsing error on board loading.

(module smd: (layer F.Cu) (tedit 53650385) (tstamp 53634F85)

When I manually fixed module name to “hc-49_smd” it and tried to open again I succeeded. To avoid further problems I have reviewed and renamed all my footprints having slash in the name.

Interactive router shortcuts

Most shortcuts work same way in all modes, like X to start routing, M to move objects or V to place vias. Other interactive router specific were harder to find. I knew some of them from videos yet I could not find ultimate list of all possibilities in documentation. Chapter 9 of pcbnew documentation did not answer my question, neither shortcut list (invoked by Shift+? in pcbnew) did as it does not change across different modes. What I obviously overlooked was chapter on context menus that could shed some light and help to understand that context menu changes on canvas view mode change. After switching from default mode (F9) to OpenGL (F11) or Cairo (F12) modes, that activates interactive router, right mouse click brings different options and their shortcuts for quick keystrokes. Pay attention that menu changes after you start routing process (pressing X) and gets back when skipped routring (ESC pressed).

Push and shove can save half of time spent on manual routing. Granted. Couple hours of intense work later and what I am missing is ability to interactively drag components i.e. moving component in a way that keeps routes connected to pads pushing things around. Having partially routed board makes you realizing better components placement; moving them though disconnects traces that must be redrawn… no problem for couple discrete elements, pain in the ass for tens to hundreds connections of single IC. I keep fingers crossed CERN team place it on enhancements list 😉

Freerouter

freeroute_disabledFully automated routing is passé among professional EEs. For hobby work it is nice accelerator, especially combined with push-and-shove. Imagine this: for sensitive fragments of PCB (like switching DC/DCs or microwave parts) you do the manual routing job and then spawn Freerouting tool to wire the rest of it more carelessly.

The new Kicad still teases with that option but www.freerouting.net is down so Kicad bundle gives you grayed out button instead. Porting my offline freerouter for from old to new Kicad would be failure as with the advent of JDK8 old JARs stopped working anyway.

Why there is freerouter shortcut in pcbnew then? The answer is in the Kicad source code — pcbnew will enable middle button when it detects freeroute.jar in Kicad binary directory. Since freerouter source code was GPLed, mirrored and modified, now it can be still compiled and run as standalone co-working Java application.

To enable Freerouter in Kicad:

  1. Freerouter enabled

    Freerouter enabled

    Download Freerouter from this mirror — https://github.com/freerouting/freerouting

  2. Extract freerouting-master.zip/binaries/freerouting.jar
  3. Copy JAR to Kicad bin directory and rename it to freeroute.jar
  4. Restart Kicad to enable freerouter middle button in pcbnew. Voila!
This entry was posted in Electronics, Software. Bookmark the permalink.

24 Responses to Kicad upgrade: push & shove and freerouting revisited

  1. Roger says:

    Hi Andy,
    I’m using KiCad to do a project design and I used your trick to enable Freerouter. The middle button is working but when I try to use the application a Java error appears:

    java.lang.Error: illegal character …

    Could you help me please?
    Thanks!

    • andy says:

      Roger, without more details I am just guessing. What was the whole error description: is this illegal character on you path? Was there the whole stack trace printed out? Did you try manually running freerouter (opening command line window, going to directory of freerouting.jar and running “java -jar freerouting.jar”)?

      • Quark66 says:

        Hi, my experience is: I run
        java -jar freeroute.jar -de MyScheme.dsn (-de as input param, router open it imediately) everyth. OK. But if I try to use national char set in filename (not good, my fault), than the same error. Example
        java -jar freeroute.jar -de MůjVýkres.dsn

  2. Roger says:

    Hi! Thanks for your reply. I changed all the possible strange characters on the path and nothing changed. Here is the hole thing when I tried to run it through CMD:

    C:\Program Files\KiCad\bin>java -jar freeroute.jar
    HelpSet helpset/en/Help.hs not found.
    help_broker is null
    java.lang.Error: Illegal character
    at designformats.specctra.SpecctraFileScanner.next_token(SpecctraFileScanner.java:1406)
    at designformats.specctra.ScopeKeyword.skip_scope(ScopeKeyword.java:49)
    at designformats.specctra.Component.read_place_scope(Component.java:353)
    at designformats.specctra.Component.read_scope(Component.java:79)
    at designformats.specctra.Component.read_scope(Component.java:45)
    at designformats.specctra.ScopeKeyword.read_scope(ScopeKeyword.java:110)
    at designformats.specctra.ScopeKeyword.read_scope(ScopeKeyword.java:110)
    at designformats.specctra.DsnFile.read(DsnFile.java:85)
    at interactive.BoardHandling.import_design(BoardHandling.java:1044)
    at gui.BoardFrame.read(BoardFrame.java:180)
    at gui.MainApplication.create_board_frame(MainApplication.java:301)
    at gui.MainApplication.open_board_design_action(MainApplication.java:235)
    at gui.MainApplication.access$200(MainApplication.java:31)
    at gui.MainApplication$4.actionPerformed(MainApplication.java:171)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    • andy says:

      How can you see that error when “trying to run” freerouter? Stack trace shows you are “opening DSN file” which is next step *after* running freerouting user interface… I feel misguided. Precise wording is critical when asking for help, dude 🙂
      I cannot help with Freerouting defects like this one around DSN parsing. Same error was seen here. I tried given DSN file and my freerouter also failed with the same stack trace as yours. In contrast design files I created and exported to DSN can be opened/consumed by freerouter. Reach out to someone with freerouter source code knowledge, maybe maintainer of mirrored code could help.

      • Roger says:

        OK, you’re right, the problem appears when loading the DSN file. I’m sorry. So, it must be some diference between the given design, mine and yours, but which is these diference?
        Thanks for your webpage and for your help!
        Greetings from Spain!

        • andy says:

          Is your DSN file produced by Kicad or you exported it from some other tool? What I see is that my DSN files are ascii (text) while the LPC18XX_43XX_SCH.DSN file from link I mentined before is binary and is not a DSN file at all. In fact it is zip file (sic!) with binary files mentioning Orcad inside, probably full blown project, far from Specctra design file. So first of all check if your file is really DSN. Do your homework and create some other simple Kicad project, export to DSN and see if Freerouter can open it.

  3. Denis Bisson says:

    Sir, you made my day!
    Thank you very much regarding the little procedure to make “Freerouter” working.
    I get used in the past 20 years to used PADS and SPECTRA and recently, for personal projects at home began to use KiCAD. I was tired of routing many traces manually and was unable to find something a low-cost autorouter. I heard about this “Freerouter” but I though it requires to run Linux until I read your page. I followed your procedure and it is autorouting in the backgrand as I am writing this message.
    Thank very much again!
    Dennis.

  4. Robert says:

    Great page, really, really helpful.

    Thanks

  5. siyad says:

    hi

    i was try to autorouting in kicad,if i click “lauch free router via java webstart” option
    it will shows an error
    Unable to load resource: http://freerouting.net/java/freeroute.jnlp

    how to fix it?

    • andy says:

      Button labeled this way was in old version of kicad and support for online freerouter was removed long time ago. I mentioned the about this “disapearance” in first paragraph of article, so read carefully referred topics.
      If you want to use autorouting you have two options: stay with old kicad and read my old article on using offline copy of freerouter, or migrate to latest kicad and follow this article.

  6. Tom says:

    I’m trying this with Linux Mint 17.3 Mate. I have installed version 4.0.2-4 +6225~38~ubuntu~14.04.1-stable release build, but, Autoroute is not working.

    I have renamed the 3.8MB jar file. I’m not sure where the kicad binary file is located, but, I put a copy of freeroute.jar in /usr/bin and /usr/share, restarted kicad, but, it auroroute doesn’t run.

    Is this fix strictly for Windows or am I missing something? Thanks

    • andy says:

      I have only tested on my Win box where I do my uC works. It is more about library loading than operating system you run on. I have already said that […] when it detects freeroute.jar in Kicad binary directory […], so you have to make sure that it is exactly where kicad executable is. I did not try in on Linux though (neither studied source code of Kicad) so I cannot prove it is only way or whether it works on specific linux distro or not.

      In short: find you kicad executable and place JAR next to it, restart kicad and try again.

  7. Gary Levin says:

    Hi Andy,

    Thanks tremendously.
    I was able to follow your instructions and get the autorouter working.
    Starting to bring up my tool chain.

    Always had my boards done by PCB bureaus. Now I need to do them myself as
    a freelancer, developer. Kicad may just fit the bill.

    Gary

    • andy says:

      Gary, glad to hear my scribble did the job 😉 On local market I still find SW job offerings way more lucrative than HW, this is why I keep EE works as a hobby only. I keep fingers crossed for you though!

  8. Damiano says:

    I am pointing out that FreeRouting is not dead, I am actually fixing it and making it more reliable.

    It is on github called Engidea/FreeRoutingNew and I have a cheap web at http://www.freerouting.eu

    If you want to do free angle routing it is still the only one available…

  9. Pingback: KiCad Libraries – Hilo90mhz

  10. Richard says:

    Crazy question, what rev of java should we be using? I noticed that you pointed to JDK8 in your post, I did an apt-get install java* and it looks like I got JDK9 and the following errors:
    java -jar /usr/bin/freeroute.jar -de DUT_Main_Linear_Opto_144V.dsn
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # SIGSEGV (0xb) at pc=0x00007f85e7be1009, pid=12622, tid=12623
    #
    # JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
    # Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
    # Problematic frame:
    # C [libjava.so+0x1d009] JNU_GetEnv+0x19
    #
    # Core dump will be written. Default location: Core dumps may be processed with “/usr/share/apport/apport %p %s %c %P” (or dumping to /home/rhowlett/Dropbox/kicad/lmu/latest/V2_LinearOpto_Isolation/core.12622)
    #
    # An error report file with more information is saved as:
    # /home/rhowlett/Dropbox/kicad/lmu/latest/V2_LinearOpto_Isolation/hs_err_pid12622.log
    #
    # If you would like to submit a bug report, please visit:
    # http://bugreport.java.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
    Aborted (core dumped)

    Then I did an
    apt-get purge java*
    apt-get install openjdk-8-jdk

    Now it works…. just in case anyone runs into the same issues:)

    • andy says:

      Hi Richard,
      I am not sure why you assumed JDK9 is good platform to start with. As of today it is at “early access” stage, whether you look at OpenJDK or Oracle JDK, which is good to play or experiment with if you are early adopter. For non-Java works simply use stable JDK version as a workhorse and it will save your day.

  11. Fabrizio says:

    Ok Dear button active

  12. Robert says:

    Any idea how to re-enable it in versions 5+ (I’m testing 5.0.0-rc2-50-g36504b307, release build on Windows 10)?
    I like it a lot, but apart from some high-speed tracks I have zero interest in manual routing.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.