Skip to content

LIB-6 Footprint does not match the MPN's package

Severity Status Implementation
error runs in better_erc mid, depends on CFG-9

Data it needs: graph.

Looks at. Package per MPN (the parts snapshot), the footprint name.

What it catches. A part whose footprint is not the package of the MPN in its BOM fields: a 4x4 mm inductor footprint for a part that is 5x5 mm, a SOD-123 footprint for a SOD-323 diode, a 0603 pattern for an 0805 capacitor.

Why it matters. The board is made and the parts are bought, and only at assembly do they turn out not to fit. Small mismatches still solder, badly (tombstoning, opens, a part sitting on one pad); large ones cannot be placed at all and the batch needs rework or a respin. Neither ERC nor DRC can see it: the schematic and the layout agree with each other, both are wrong against the real part.

Example. On B153A the buck inductor's footprint was "completely wrong" for the part in the BOM: found at assembly, the board had to be reworked by hand and rev B fixes the footprint. The diode case: a BOM line for a SOD-323 Schottky placed on a SOD-123 footprint, whose pads are farther apart than the SOD-323's terminals.

How to check. Decode the package from the MPN (resistor and capacitor part numbers encode the case size; for others the part database holds it) and compare with the footprint name or, better, with the footprint's pad geometry. Report mismatches; report unknown MPNs as not checked (DIAG-2).

better_erc (erc_checks/src/lib/lib_6.rs) reads the chip case from the footprint name (R_0805_2012Metric is 0805) and compares two things with it. The part's Package field, or for a resistor or capacitor without one the board's DEFAULT_R_PACKAGE or DEFAULT_C_PACKAGE text variable, must name the footprint's case: on B153B R701 sits on an 0805 footprint while the board default says 0402, so the finding says write Package 0805. Each MPN's case (case_eia in the parts snapshot) must be the footprint's case, or, where the footprint names none, the Package field's. The Package check runs without a parts snapshot; the MPN check needs one. Each MPN field (Mpn1, Mpn2, ...) of a fitted part is judged on its own, against the facts the parts snapshot (parts.lock.toml, project file [parts]) holds for it. A miss is one finding per part and MPN field (item C4 Mpn2) that names the margin and carries the hash of every input it rests on (the fields, the MPN's facts), so a waiver pinned to it goes stale when any of them changes. A fact the snapshot lacks is never a pass: the part gets one info finding naming each MPN and fact not checked. An MPN the snapshot does not list is BOM-20's.

Fix. Pick the footprint from the MPN's datasheet package drawing, or change the MPN to one in the footprint's package. Keep the package in the library part so the two cannot drift.

References. KLC F4.1 (datasheet recommendations take priority); IPC-7351B; B153 rev B change list (inductor footprint).

Test schematics

Each schematic below is in test_schematics/sources. The block under it is what berc check --only LIB-6 reports on it.

lib-6_package_vs_footprint

The test schematic lib-6_package_vs_footprint The test schematic lib-6_package_vs_footprint

  error      LIB-6 #82h     R1: DEFAULT_R_PACKAGE says 0402, the footprint R_0805_2012Metric is 0805: write Package 0805
                            part R1, item R1 Package
                            DEFAULT_R_PACKAGE = 0402 (pro lib-6_package_vs_footprint.kicad_pro)
                            footprint = R_0805_2012Metric (sch lib-6_package_vs_footprint.kicad_sch)
                            fix: set the Package field to the footprint's case, or place the footprint of the stated package
                            input in1:1f6a0a0ab1564bdc
  error      LIB-6 #912     R2: DEFAULT_R_PACKAGE says 0402, the footprint R_1206_3216Metric is 1206: write Package 1206
                            part R2, item R2 Package
                            DEFAULT_R_PACKAGE = 0402 (pro lib-6_package_vs_footprint.kicad_pro)
                            footprint = R_1206_3216Metric (sch lib-6_package_vs_footprint.kicad_sch)
                            fix: set the Package field to the footprint's case, or place the footprint of the stated package
                            input in1:939aa6a6216657b7
  error      LIB-6 #gcf     R3 Mpn2 RC0603FR-0710KL: case 0603, the footprint is 0402
                            part R3, item R3 Mpn2
                            Mpn2.case_eia = 0603 (partdb parts.lock.toml RC0603FR-0710KL case_eia (manual))
                            fix: pick the footprint from the MPN's package drawing, or an MPN in the footprint's package
                            input in1:2e742e7278dabf13
  info       LIB-6 #bma     C1: not checked: Mpn1 CL05A104KB5NNNC has no case_eia
                            part C1
                            fix: add the facts to the part source and run `berc parts refresh`

LIB-6 also fires on the test schematics of other checks: bom-20_parts_lock, bom-21_mpn_makers.