Skip to content

fix(lga): prevent corner pad overlap with derived body size - #796

Open
w1ne wants to merge 1 commit into
tscircuit:mainfrom
w1ne:fix-lga-corner-pad-overlap
Open

fix(lga): prevent corner pad overlap with derived body size#796
w1ne wants to merge 1 commit into
tscircuit:mainfrom
w1ne:fix-lga-corner-pad-overlap

Conversation

@w1ne

@w1ne w1ne commented Aug 11, 2026

Copy link
Copy Markdown

Problem

For LGA footprints where the body size is derived (i.e. w/h are not given explicitly), corner pads overlap with 0mm clearance, tripping pad-to-pad DRC inside the footprint itself and blocking the autorouter.

Repro:

fp.string("lga14").circuitJson() // corner pads 1 & 14 touch (0.00mm clearance)
fp.string("lga8").circuitJson()  // corner pads 1 & 8 touch (0.00mm clearance)

Root cause

In src/fn/lga.ts the default body size was derived as:

const width = parameters.w ?? (grid.y - 1) * parameters.p + 2 * parameters.pl
const height = parameters.h ?? (grid.x - 1) * parameters.p + 2 * parameters.pl

The inner edge of the left/right pads sits at (width - 2*pl) / 2 = (grid.y - 1) * p / 2, which is exactly the center line of the outermost top/bottom pads (and vice versa for height). The corner pads on perpendicular sides therefore overlap by pw/2 in both axes — edge-to-edge clearance is 0.

Measured before (default p=0.5mm, pw=0.28mm, pl=0.7mm):

  • lga14 (4x3 grid): pad 1 at (-0.85, 0.75) 0.7x0.28 vs pad 14 at (-0.5, 1.1) 0.28x0.7 → 0.00mm clearance
  • lga8 (2x2 grid): pad 1 at (-0.6, 0.25) vs pad 8 at (-0.25, 0.6) → 0.00mm clearance

Fix

Add a corner allowance of pw + 2 * 0.2mm to the derived body size when pads exist on adjacent sides, so corner pads get 0.2mm clearance:

  • lga14: derived body 2.40x2.90mm → 3.08x3.58mm; min pad-to-pad clearance 0.00mm → 0.22mm (corner clearance 0.20mm)
  • lga8: derived body 1.90x1.90mm → 2.58x2.58mm; min pad-to-pad clearance 0.00mm → 0.22mm (corner clearance 0.20mm)

Explicitly provided w/h are untouched, and two-sided grids like lga6_grid3x0 (no adjacent-side pads) keep their previous derived size, so no existing snapshots change.

Tests

  • New regression test lga14 and lga8 keep clearance between corner pads asserts min pad-to-pad clearance > 0.1mm for both default footprints, with SVG snapshots per repo convention.
  • Full suite: 522 pass, 0 fail.

The default LGA body width/height were derived as
(grid-1)*pitch + 2*pl, which places the inner edge of the left/right
pads exactly on the center line of the outermost top/bottom pads (and
vice versa). For rectangular grids such as lga14 (4x3) and lga8 (2x2)
the corner pads therefore overlapped with 0mm clearance, tripping
pad-to-pad DRC inside the footprint.

Add a corner allowance (pw + 2*0.2mm clearance) to the derived body
size when pads exist on adjacent sides, giving 0.2mm corner clearance.
Explicitly provided w/h are unchanged, as are two-sided grids
(e.g. lga6_grid3x0).

Adds a regression test asserting pad-to-pad clearance for lga14/lga8
with SVG snapshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant