Custom design rule for Differential pair

Hello,
i am using kicad version 6.0.2, i am setting custom rule for diffrerntial pair. i want to assign different trace width, diff pair gap & clearence to individual nets.
I have tried this.
(version 1)
(rule "diffpair"
(layer F.Cu)
(constraint diff_pair_gap (min 0.4mm))
(constraint track_width (min 0.1mm))
(constraint clearance (min “0.05mm”))
(condition “A.inDiffPair(‘USB’)”)
)
But i am not getting result for specific net.(condition “A.inDiffPair(‘USB’)”).
How can i assign the constraint to a specific net?

I haven’t tried this myself yet, but maybe the answer is in this thread?

I tried this one also but still it is not working.

don’t use “USB” use “/USB”

1 Like

Trird this one also but still it is not working.

Try the same rule that you put, your problem is the name of the differential pair, if you use “USB_P” and “USB_N”, your selector must be “USB_”

1 Like

Your rules worked for me if I added an (opt <desired value for the router to use>) token to the diff_pair_gap constraint.

min/max are used by DRC only, and opt is the value that the router uses when you’re routing.

So I did:

(version 1)
(rule "diffpair"
	(layer F.Cu)
	(constraint diff_pair_gap (min 0.4mm) (opt 0.43mm))
	(constraint track_width (min 0.1mm))
	(constraint clearance (min "0.05mm"))
	(condition "A.inDiffPair('/usb_')")
)

With those rules the router automatically put the traces 0.43mm apart, regardless of what I had set in the netclass DP settings, and DRC was clean. I found the Constraint Resolution tool to be really helpful here - initially I had the diff pair name wrong and it told me that my rule was not applied to the selected trace, which tipped me off to the problem.

P.S. I didn’t check the track width and clearance but I think those would also be set automatically by the router if you put in an opt token to those constraints.

2 Likes

Thank you for the reply.
I tried same thing but it is still not working.
I am using kicad in ubuntu, so is there any issue regarding OS?

I doubt this is OS-specific. Could you share your design, stripped down if necessary?

At least sharing a screenshot of the traces and net names would be helpful.

Alternatively you could assign your differential pairs to a dedicated net class and then substitute
(condition "A.inDiffPair('/usb_')")
with
(condition "A.NetClass == 'your_netclass'")

1 Like

Thank you @Kharar
I tried this one & this is working properly.
(version 1)
(rule “diffpair”
(layer F.Cu)
(constraint diff_pair_gap (opt 0.1mm))
(constraint track_width (opt 0.1mm))
(constraint clearance (opt 0.1mm))
(condition “A.NetClass == ‘Diff_100_OHM’”)
)

You are welcome @Jay_Khandekha

Now for the mystery of why the other approach didn’t work for you:

image

As you can see above I have a differential pair named TD0_N and TD0_P that are defined from a sub sheet named LAN, so in order to use the name correctly I would have to include the path prefix.
Like this: (condition "A.inDiffPair('/LAN/TD0_')")

If this doesn’t help can you maybe find your net and post us a screenshot of that, like the above?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.