MustafaMulla29/usb-pd-motherboard

4-layer USB-C PD hub motherboard with 20 V USB-C input, Linux T113-S3 computer, CH338F USB hub, four individually controlled 5–20 V PD outputs, USB data/camera ports, regulated rails, and hardware watchdog/E-stop safety interlock.

Version
1.0.24
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/usb-pd-motherboard  # download the package files into ./usb-pd-motherboard
tsci add MustafaMulla29/usb-pd-motherboard    # add it to your project as @tsci/MustafaMulla29.usb-pd-motherboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

docs/via-migration-status.md

# 0.3 / 0.45 mm via migration — status (paused 2026-11-28 01:55)

Work copy: this folder (package `...-via045`). Main (`motherboard/`) is untouched except the 20 V change (RPDCFG1 120k, built, not pushed).
Plan when done: copy this folder's design + routing over to main, build, push.

## Done
- Board rule: minViaHoleDiameter 0.3 / minViaPadDiameter 0.45 (index.circuit.tsx, tests/port.circuit.tsx, power-copper vias).
- Motor-port template re-routed at 0.45 (tools/gridroute2.py on tests/port.circuit.tsx; cross nets routed first so they keep an exit):
  UM?CC rotated 180 deg; eFuse DVDT/ILM/ITIMER parts moved next to their pins; RM?ILIM / RM?MODE rotated 180; RC/CC column x 26.0.
  The port template owns all 23 local nets (routing/ports.ts, routing/index.ts filter, routing-plan.tsx phaseOf).
- Plane links: all ordinary PLANES stubs removed; 199/200 plane pads linked by via + small pour (tools/plane-links.py ->
  circuit/power-copper.json zone "planelink"); 5 thin original stubs kept in routing/inputs/PLANES.saved.json
  (UM1-4BB PGND2, UMPU AGND). Missing: UM4BB.VIN (VIN_SYS).
- Signals: 164 nets (routing/inputs/via-migration/viafix-nets-global.json) re-routed in phase 18 VIAFIX;
  best result routing/inputs/via-migration/VIAFIX-best.hand.json = 384/431 connections.
- Router fixes: gridroute2 untagged-via size bug fixed; --deadline, --safe-rips, --seed, --ckpt options.

## Left (needs part moves: pins cannot escape at 0.45 mm vias; more layers/orders did not help)
Failing pins of the best run (47 pins):

| net | pin | at |
|---|---|---|
| PDIN_VHV | CPDVHV.pin1 | (-30.6, 39.4) |
| PDIN_VHV | RPDVHV.pin2 | (-32.0, 40.7) |
| AVCC_1V8 | CAVCC.pin1 | (-21.7, -9.3) |
| AVCC_1V8 | UMPU.HPVCC | (-22.1, -12.3) |
| AVCC_1V8 | UMPU.LDOA_OUT | (-9.9, -26.1) |
| SD_D1 | JSD.DAT1_RSV | (-29.7, -13.5) |
| SD_D1 | RSD1.pin1 | (-42.7, -30.0) |
| PD_IN_PG | RPDPG.pin1 | (-30.1, 34.1) |
| PD_IN_PG | USUPA.PA11_PA9_ | (-39.2, 6.2) |
| SD_D0 | JSD.DAT0_D0 | (-29.7, -14.6) |
| SD_D0 | RSD0.pin1 | (-44.0, -30.0) |
| CAM_PWREN | UCAMPWR.EN | (-28.8, 19.1) |
| OTG_VBUS_SNS | RPCVB2.pin1 | (-28.6, 28.6) |
| OTG_VBUS_SNS | RPCVB1.pin2 | (-29.9, 29.6) |
| M4_IMON | UM4BB.CDC | (17.4, -27.8) |
| M1D_PWREN | UM1DPWR.EN | (26.4, 30.3) |
| SUPB_PSCL | UM3BB.SCL | (13.8, -6.3) |
| SUPB_PSCL | UM4BB.SCL | (13.8, -28.3) |
| M2_IMON | UM2BB.CDC | (17.4, 16.2) |
| M4_VBUS_SNS | RM4VS1.pin2 | (29.9, -22.8) |
| M4_VBUS_SNS | RM4VS2.pin1 | (29.9, -26.0) |
| M4_BB_INT_N | UM4BB.FB | (17.5, -28.8) |
| VDD | UMPU.VCC_PE | (-6.9, -24.3) |
| VDD | RLEDSTAT.pin1 | (-6.9, -33.0) |
| VDD | RLEDACT.pin1 | (-6.9, -35.0) |
| M4_DISCH | QM4DIS.pin1 | (25.0, -25.1) |
| M4_DISCH | RM4DG.pin1 | (28.6, -26.0) |
| SUPB_TPD_FLT_N | RSUPBTPD.pin1 | (-25.2, -5.1) |
| SUPB_TPD_FLT_N | UM3CC.N_FLT | (33.6, -1.4) |
| SUPB_TPD_FLT_N | UM4CC.N_FLT | (33.6, -23.4) |
| MOTOR_ARM | UMPU.PG1 | (-22.1, -20.7) |
| M4_CC2 | UM4CC.CC2 | (32.5, -24.1) |
| M4_CC1 | UM4CC.CC1 | (32.5, -24.5) |
| M1_IMON | UM1BB.CDC | (17.4, 38.2) |
| SUPA_PSCL | UM2BB.SCL | (13.8, 15.7) |
| MOTOR_HW_EN | UM1AND.A | (24.5, 34.2) |
| MOTOR_HW_EN | UM2AND.A | (24.5, 12.1) |
| MOTOR_HW_EN | USUPB.PA15 | (-29.2, 4.8) |
| V3V3_AON | CSUPB2.pin1 | (-31.2, 5.9) |
| V3V3_AON | CSUPB1.pin1 | (-31.2, 3.7) |
| V3V3_AON | USUPA.VDD | (-38.2, -2.2) |
| V3V3_AON | USUPA.VREF_POS | (-38.8, -2.2) |
| V3V3_AON | USUPA.VBAT | (-39.2, -2.2) |
| V3V3_AON | RSUPASDA.pin2 | (-39.4, -4.1) |
| V3V3_AON | ULATCH.D | (16.9, 24.3) |
| V3V3_AON | CM3AND.pin1 | (26.0, -10.8) |
| V3V3_AON | RLEDHWEN.pin1 | (-6.9, -37.0) |

Corners: CH224Q input (PDIN_VHV, PD_IN_PG), SD card (SD_D0/D1 pull-ups 15 mm away in the corner), SoC 1.8 V
(AVCC_1V8), camera/PC corner (CAM_PWREN, OTG_VBUS_SNS), port-4 / supervisor channel (M4_*, *_PSCL, IMON, TPD_FLT).
Then: fix ~47 small clearance errors in fixed copper (tools/via-fix.py), final build, copy to main, push.

## Resume
1. routing/viafix-nets.json = viafix-nets-global.json; copy VIAFIX-best.hand.json -> routing/VIAFIX.hand.json only after
   moving parts (any part move = re-dump VIAFIX: tsci build ... --inject-props '{"dumpPhase":"VIAFIX",...}').
2. Route: python3 -I -u tools/gridroute2.py VIAFIX routing/VIAFIX.hand.json --layers top,inner2,inner3,bottom --rips 0 --deadline 900

## Update 2026-11-28 11:55
- SD D0/D1 pull-ups (RSD0/RSD1) moved next to the socket pins; unfitted RPDCFG2/3 footprints removed.
- Re-route: 383/431, 23 nets / 46 pins fail (PDIN_VHV and SD_D0 now route). VIAFIX-best.hand.json updated.
- Root cause confirmed: the failing pins are fine-pitch chip pins (SoC bottom/top edge, supervisor B, hub PRTPWR,
  CH224Q PG) that cannot place a 0.45 mm escape via. Supervisor B (and A) sit in a band of heavy through-traffic
  (supervisor -> port buses): moving small caps will not open it. Needed: re-arrange the supervisor band (spread or
  move USUPA/USUPB), then re-route that band; similar smaller work at SoC bottom-left and hub bottom edge.

## Update 2026-11-28 15:50 — NOT FAB-READY
All signal nets connect, but build shows ~25 accidental contacts (different nets touching), incl. a GND/V5V0 merge:
PGND2 straps vs CDC escape stubs (ports 1-3), port-3 EF_FLT_N stub over plane copper, port template vs USB pair to
JM4D, pair vias vs connector pads. Cause: parts routed in separate contexts. Fix plan: redo straps + stubs + pair
vias in one context against all copper, then full DRC review. Main is untouched (1.0.7 + 20 V change, not pushed).

## Recommended restart plan (2026-11-28 16:05)
Patching layers routed in separate passes keeps creating contacts. Redo in ONE priority order, each step against all
copper already placed: (1) USB pairs (tools/pairroute.py, now VIA_D 0.45, --vsep 0.3) on the board with parts only;
(2) port template (tests/port.circuit.tsx) WITH the pair copper present; (3) plane links (tools/plane-links.py --trace)
+ 0.5 mm data-port 5 V feeds to plane vias at x=-2.3 (tools/power-fix-input.py); (4) signals: tools/gridroute2.py
--negotiate 1 + tools/viafix-stubs.py / viafix-longstub.py (stubs must be DRC-checked vs fixed copper) + viafix-trim
+ viafix-netcheck; (5) full build, plane-connectivity, DRC review. Placement changes to keep: supervisor B at
(10,-40.8), CSUPAIMA rotated, SUP_IRQ_N on PG12, RPDCFG2/3 removed, UM?CC rotated, eFuse/ILIM/MODE parts moved.

## 2026-11-28 restart status (paused by user)
- Signals: all 433 routed (VIAFIX.hand.json), netcheck 0 bad nets. PLANES.saved.json 467 traces (links, 5 V feeds, straps).
- Builder "pin not connected": 0. Last measured build: 38 DRC errors. Fixes applied since, NOT yet rebuilt:
  CC1/CC2 stub+route joined into one trace (M1_CC1, M1_CC2, M3_CC2); 2 power-copper GND vias nudged (13.1,-9.05)/(13.12,-30.98);
  5 links swapped for main's routes; 7 connector GND links now end as a wire into the shield pad (no via); 1 CAM pair via moved.
- Still open: USB-pair vias at JM1D-JM4D (38.035, PY-10.91) and JPC/JCAM (~-36.3) 0.01-0.04 mm short of 0.1 clearance (need pairroute redo for those breakouts);
  links for UM2BB.DITH, CM1AND.pin2, plane via pair (14.5,16.55)/(14.5,16.7); port-4 GND group CM4VP/RM4DG/RM4VS2 not tied to plane.
- Backups for every step: ../motherboard-old-dist/restart/ (PLANES-*.json, ck-*.json, USB_PAIRS-pre.json).