First the small text: the rule syntax WILL CHANGE. What’s there today is a PROTOTYPE. There will be NO TOOLS for migrating today’s rules to later rules. Think of it as a sandbox, not a work-in-progress.
But I’d still like to get some feedback on what it does well, what it does poorly, and what is missing.
If you’ve never use a nightly, our built from scratch, this probably isn’t for you. But if you have…
The rules go in a file in your project named “drc-rules”. You can edit them there in your favourite text editor, or you can edit them in Board Setup > Design Rules > Rules and let Kicad worry about the name, location, etc.
The rule file is in sexpr. The top level is a list; the first expression must be (version x) followed by any number of (selector…) and (rule…) expressions.
Selectors determine what to apply rules to; rules enforce minimums.
Match tokens:
match_netclass
match_type
match_layer
match_all
match_area (not yet implemented with the exception of “$board”, which matches everything)
(selector (match_area "$board") (rule "OSHParkClass3") (priority 100))
(selector (match_netclass "HV") (rule "HV_internal"))
(selector (match_netclass "HV") (match_layer "F_Cu") (rule "HV_external"))
(selector (match_netclass "HV") (match_layer "B_Cu") (rule "HV_external"))
(selector (match_netclass "HV") (match_netclass "HV") (rule "HV2HV"))
(selector (match_netclass "HV") (match_netclass "HV") (match_layer "F_Cu") (rule "HV2HV_external"))
(selector (match_netclass "HV") (match_netclass "HV") (match_layer "B_Cu") (rule "HV2HV_external"))
TODO: pads for connector pins or wire pads have even larger required creepage clearances. How to encode?
User attributes on parent footprint?
(selector (match_netclass "HV") (match_type "pad") (match_netclass "HV") (match_type "pad") (rule "pad2PadHV"))
(selector (match_netclass "signal") (match_area "BGA") (rule "neckdown"))
Type tokens:
track
via
micro_via
blind_via
pad
zone
text
graphic
board_edge
hole
npth
pth
Rule tokens:
allow (not yet implemented)
clearance
annulus_width
track_width
hole
Rule modifiers:
relaxed
(rule "HV" (clearance 200))
(rule "HV_external" (clearance 400))
(rule "HV2HV" (clearance 200))
(rule "HV2HV_external" (clearance 500))
(rule "pad2padHV" (clearance 500))
(rule "signal" (clearance 20))
(rule "neckdown" (clearance relaxed 15))
(rule "allowMicrovias" (allow microvia))
I’m interested to try it out, I’m not sure which version of KiCad should I be using for this, if you can lay down some basic instructions for the setup requirements.
@JeffYoung Ha no router connection yet, I got too excited sorry!
After adding (version 1) to the first line, I’m getting this other warning pop-up:
It is referring to the first rule line, it does have clearance and track_width tokens.
I’m not getting any DRC error on the net other than it is not connected on the other end (I’ve checked the “Report all errors for tracks (slower)” option):
But still getting those errors.
Same thing after removing the “clearance” token from this rule.
However, if I remove the clearance token from the other rule too (inner layer), the DRC markers disappear.
I have yet to see a warning/error for the track width (rule says 0.3mm for outer layer and I routed it with 0.203mm).
Ha! No wonder a bunch of people were putting priority in the wrong place.
Note down in the status bar that the error message says where it’s coming from. In your second screenshot is says “50-OHM_SING_OUTER rule clearance 0.300mm”. When you reduce that to 0.1 does it still report that it’s 0.300mm?
Hmm… I suspect this might be because the pad is on all the layers, and it might not be smart enough to pick out the particular layer in question…