Enforcing nonzero skew between traces with custom design rule

I’m trying to write a custom design rule to enforce a specific, nonzero skew between different traces on my PCB. The reason for the nonzero constraint is that my PCB needs to compensate for the skew introduced by another board.

Let’s say I want to enforce that net /one is 2 mm shorter than net /two. I tried this rule:

(version 1)
(rule NonzeroSkew
	(constraint skew (min 1.9mm) (opt 2.0mm) (max 2.1mm))
	(condition "A.NetName == '/one' || A.NetName == '/two'")
)

If the two tracks /one and /two have length 9 mm and 10 mm (wrong skew), I get the following two DRC errors:

Error: Skew between tracks out of range (rule 'NonZeroSkew' min skew 1.9000 mm; actual -1.000 mm; target net length 10.0000 mm (from /two); actual 9.0000 mm)
    Pad 2 [/one] of NT1 on F.Cu
Error: Skew between tracks out of range (rule 'NonZeroSkew' min skew 1.9000 mm; actual 0.000 mm; target net length 10.0000 mm (from /two); actual 10.0000 mm)
    Pad 2 [/two] of NT3 on F.Cu

If the two tracks have length 9 mm and 10 mm (correct skew), I should get no DRC error. Instead, I still get one error:

Error: Skew between tracks out of range (rule 'NonZeroSkew' min skew 1.9000 mm; actual 0.000 mm; target net length 10.0000 mm (from /two); actual 10.0000 mm)
    Pad 2 [/two] of NT3 on F.Cu

See also screenshot below:


My understanding is that, with my custom rule above, KiCad enforces that both nets /one and /two have a skew of 2 mm with respect to the longest trace. But that’s not possible, since one of the two traces will be the longest and will always have a skew of 0 mm.

Basically, I have two questions:

  1. Is this the expected behavior, or is this a bug?
  2. Is there a way of modifying my custom rule to achieve the goal of enforcing a nonzero skew between two traces, without spurious errors?

I think it’s best to set pad lengths on the connector that connects to the other board in this case.

2 Likes

Perfect, that solves both this problem and some follow-up questions I was going to have.

Thank you!


Edit: To make it clearer for someone else reading this thread, the solution is to use the “Specify pad to die length” setting in the properties of the footprint pads for the board-to-board connector.

1 Like