Nets connecting Kicad components get their names in three different ways, each treated slightly differently by Kicad-to-HAL.
The simplest case happens with a Global Label attached to the net, as with the All-home
signal on the right, which can be referenced anywhere in the schematic :

The XML file carries the Global Label text as the net name:
<net code="154" name="All-home">
<node ref="joint.3.100" pin="20"/>
<node ref="joint.2.100" pin="20"/>
<node ref="joint.0.100" pin="20"/>
<node ref="joint.1.100" pin="20"/>
<node ref="dbounce.100" pin="2"/>
</net>
The order of the nodes within the net depends on which one Kicad encounters first, so Kicad-to-HAL sorts the destination references in ascending order:
net All-home <= dbounce.0.out => joint.0.home-sw-in joint.1.home-sw-in joint.2.home-sw-in joint.3.home-sw-in # dbounce.100
The ASCII-art arrows around the HAL source reference set it off from the rest of the clutter, with the comment (off-screen right for you) giving the original Kicad source component reference.
Kicad generates a name for anonymous nets, like the one between the 5I25 GPIO pin and the debouncer, from the first component it encounters:
<net code="617" name="Net-(dbounce.100-Pad1)">
<node ref="hm2_5i25.0.gpio.013.100" pin="2"/>
<node ref="dbounce.100" pin="1"/>
</net>
Kicad-to-HAL replaces those names with a less noisy one in an ascending sequence:
net N_159 <= hm2_5i25.0.gpio.013.in_not => dbounce.0.in # hm2_5i25.0.gpio.013.100
The anonymous Kicad net between the parameter setting the debounce delay starts with a similar name:
<net code="127" name="Net-(mux2.100-Pad1)">
<node ref="parameter.106" pin="1"/>
<node ref="mux2.100" pin="1"/>
</net>
Kicad-to-HAL extracts the source and destination nodes from the net to produce a HAL setp
command for each destination:
setp dbounce.0.delay 3 # parameter.111
Kicad nets can get a name from a Local Label accessible only on that particular schematic sheet:

Those Kicad net names include the sheet name as a prefix:
<net code="130" name="/Jog Speed/Angular-Motion">
<node ref="mux2.100" pin="3"/>
<node ref="or2.112" pin="3"/>
</net>
<net code="132" name="/Jog Speed/Vel-Per-Second">
<node ref="scale.104" pin="1"/>
<node ref="mux2.100" pin="4"/>
</net>
<net code="138" name="/Jog Speed/Vel-Per-Minute">
<node ref="scale.101" pin="1"/>
<node ref="scale.104" pin="4"/>
<node ref="scale.100" pin="1"/>
</net>
It’s not clear which characters HAL regards as valid, so KIcad-to-HAL smashes the Kicad name flat:
net _Jog_Speed_Angular-Motion <= or2.12.out => mux2.0.sel # or2.112
net _Jog_Speed_Vel-Per-Minute <= scale.4.out => scale.0.in scale.1.in # scale.104
net _Jog_Speed_Vel-Per-Second <= mux2.0.out => scale.4.in # mux2.100
Kicad-to-HAL sorts the HAL net list by name to make a specific net easier to find.
The XML netlist file contains a zillion single-node nets, one for each unconnected pin in the schematic. If the Kicad net name doesn’t start with Net-
, KIcad-to-HAL will include a note in the HAL file:
#* Named net with single pin: hm2_5i25.0.100 read_gpio
Prefix the pin name (when you create the symbol) with an asterisk to suppress that message. This will be most useful for HAL function pins intended for an optional thread connection:

Kicad-to-HAL does not generate HAL nets for Kicad nets with -thread
in their names, as those generate addf
commands.
One thought on “Kicad-to-HAL: Naming Nets”
Comments are closed.