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-motherboardIn 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/verification-2026-11-26.md
# Verification of the Codex-routed board (2026-11-26)
Build verified: `ROUTING_REPLAY_ONLY=1 tsci build index.circuit.tsx --pcb-png --schematic-png` (exit 0, 2 min 11 s).
Board 90 × 98 mm, 6 layers, 402 parts, 1,146 traces, 1,419 vias.
## Passed
| Check | Result |
| --- | --- |
| `tsci check netlist` | 0 errors, 0 warnings |
| `tsc --noEmit` | pass |
| `tsci check placement` | placement DRC 0 errors, 0 warnings (37 rotate-180° suggestions only) |
| Routed build DRC | 0 PCB errors, 0 disconnected ports |
| Plane connections | 458 saved, 0 unrouted, replay guarded by `ROUTING_REPLAY_ONLY` |
| `tsci check shorts` (Gerber, all layers) | no shorts |
## Not passed / needs work before fabrication
### 1. Power paths are far too thin (critical) — improved, see "Power-path fix" below
DRC checks clearance, not current. Measured from the routed copper:
| Net | Current (design) | Copper found |
| --- | --- | --- |
| VBUS_IN (PD in, 28 V) | up to 5 A | 0.5 mm traces, plus 10 mm of 0.1 mm; JPD VBUS2 leaves on 0.1 mm |
| VIN_SYS (eFuse out) | up to 5 A | inner4 plane, but each UIN OUT pin reaches it by one 0.1 mm stub + one 0.2 mm via |
| Mx_VBB / VBB_PRE / VBUS | up to 3 A per port | 0.5 mm with 0.3 mm sections (15 mm of 0.3 mm on each VBB) |
| Mx_SW1 / SW2 (switch nodes) | ~4 A peak | 0.5 mm |
| UMxBB.VIN, PGND, EP; UIN/U5V EP | A-level | one via each, 0.1 mm stubs |
| VDDCORE (T113) | 0.8 A | 0.3 mm with 15 mm of 0.1 mm |
| V5V0 (5 V bus) | up to ~4 A total | 0.5 mm traces (206 mm), some 0.1 mm |
A 0.1 mm outer trace carries roughly 0.3–0.5 A; a single 0.2 mm via about 0.5–1 A. As routed, the input and
motor power paths would overheat or fuse well below the 140 W input / 3 A per-port design.
Fix: top/bottom copper pours (or ≥1.5–2 mm traces) for VBUS_IN, VIN_SYS near UIN, every motor VBB/VBB_PRE/VBUS
and switch node, the 5 V buck output; via arrays (≥4–8 vias) on every high-current pin, ground pin and thermal pad;
VDDCORE ≥0.5 mm.
### 2. USB 2.0 high-speed pairs are not matched — fixed, see "USB pairs re-routed" below
Intra-pair skew: OTG 13.3 mm, M1D 13.7 mm, USBH 5.8 mm, CAM 3.5 mm, M2D 3.1 mm, M3D 2.1 mm, M4D 0.2 mm;
DM sides use up to 10 vias vs 2 on DP. USB HS wants roughly <1 mm skew, coupled 90 Ω pairs, matched via counts.
Fix: reroute the 7 pairs as coupled pairs with length matching.
### 3. Routing style
`tsci check pcb-style`: 92 staircase runs (worst: 734 alternating bends) and 16 long off-45° segments, from grid
routing. Electrically harmless at these speeds, but untidy; worth cleaning when re-routing.
### 4. Supply data not verified (offline)
211 footprint-vs-supplier mismatches (generic 0402 pads vs JLC pads, IoU 0.77: acceptable), 87 availability and
47 part-not-found warnings because this machine could not reach the supplier APIs (one part, C48996769, is not
in the EasyEDA library). Re-run with network before ordering.
## Power-path fix (same day)
Rebuilt with `ROUTING_REPLAY_ONLY=1 tsci build index.circuit.tsx --pcb-png --schematic-png`: exit 0,
**0 errors**, 0 disconnected ports, `tsci check shorts`: no shorts, `tsc --noEmit`: pass.
Board now 1,146 traces and 1,561 vias (+142 power vias).
What changed
- `circuit/power-copper.tsx` + `power-copper.json` (generated by `tools/power-copper.ts`): 35 top-layer pours and
142 vias of 0.6/0.3 mm. Per motor port: pours on SW1, SW2, VBB_PRE, VBB, VBUS, the high-side VIN_SYS area and a
GND fill; vias from FET drains/input caps into the VIN_SYS plane and from FET sources, controller PGND and
output caps into the GND planes. Input corner: VBUS_IN pour (PD connector → TVS → eFuse IN), VIN_SYS pour
(eFuse OUT → bulk caps) with 10 plane vias, 5 V buck switch-node pour, V5V0 pour, GND fill and vias at the
eFuse/buck thermal pads. Via sites were searched against all layers of the routed board, so they touch no
other-net copper.
- `circuit/planes.tsx`: inner4 V5V0 now has a strip (x −14..−1, y 10..33.5) under the 5 V inductor and output
caps, so the buck output reaches its plane directly (VIN_SYS keeps everything else; 1 mm split gap).
- Wider hand-routed wires where clearance allows (`tools/widen.ts`): VBUS_IN 11.7 → 24.9 mm², BUCK5_SW
8.2 → 16.8 mm², VDDCORE 15.3 → 22.6 mm² (VDDCORE has no 0.1 mm run longer than 1 mm; the rest are pin necks).
- `circuit/saved-routing.ts`: PLANES replay now accepts a board whose only changes are added obstacles, reshaped
planes or wider earlier wires, and re-matches saved pad ids by position (new `<via>` parts renumber pad ids).
Final DRC/connectivity is what proves the replay; it passed.
Top-layer copper added (mm², per port M1–M4): SW1 25–29, SW2 14–17, VBB_PRE 17–21, VBB 9–12, VBUS 2–3;
VBUS_IN 61, VIN_SYS 118, BUCK5_SW 29, V5V0 60. No floating pour islands (9 GND slivers < 0.01 mm² total).
Still limited (needs part moves, not just copper)
- Motor **VBUS** (eFuse OUT → USB-C): the eFuse and connector pins are 0.3 mm wide and boxed in by small parts;
only 2–3 mm² of pour fits. The existing 0.5 mm trace remains the main path (fine to ~2 A, marginal at 3 A).
- Motor **VBB** sense resistor → eFuse IN runs between rows of 0402 parts; pour helps but is broken up.
- ~~5 V buck (U5V)~~: fixed, see "5 V buck re-placed" below.
- Controller PGND vias: M2 got 0, M1 3, M3 2 (signal vias occupy the space); the top GND fill carries it.
## 5 V buck re-placed (same day)
Final build `ROUTING_REPLAY_ONLY=1 tsci build index.circuit.tsx --pcb-png --schematic-png`: exit 0, **0 errors**;
`tsci check shorts`: no shorts; `tsci check placement`: 0 errors / 0 warnings; `tsc --noEmit`: pass;
`bun tools/plane-connectivity.ts`: GND 598, VIN_SYS 136, V5V0 57 pads each one copper component, 0 isolated pours.
Board: 1,122 traces, 1,528 vias.
| | Before | After |
| --- | --- | --- |
| Input cap → U5V VIN pin | ~8 mm, other side of the chip | 0.9 mm, directly above VIN |
| U5V SW → inductor | ~9 mm of 0.5 mm wire on inner2, 2 vias | one 37 mm² top copper area, no vias |
| Catch diode cathode → SW | ~5 mm wire | same copper area, 2.7 mm below SW |
| Output caps → inductor | 14 mm away | 1.5 mm, beside L5V's output pin |
| 5 V into its plane | long trace to the V5V0 area | inner4 V5V0 now under the buck output (10 vias) |
What changed
- `circuit/power-input.tsx`: U5V turned 270° (VIN/BOOT up, SW/GND down); C5VIN1/2 above VIN; C5VBT beside the
chip; L5V (upright) and D5V share the SW area; C5VO1-3 next to L5V pin 2; FB/COMP parts bottom-left, RT/EN
top-left; CAONI beside UAON. All courtyards clear; checked against every other net's copper before moving.
- New routing phase 15 `BUCK5` (`routing/buck-nets.json`, `routing/BUCK5.hand.json`): the 7 buck signal nets
plus OTG_VBUS_SNS, M1_CC1 and M1_BB_INT_N, whose old wires crossed the new footprint; grid-routed
(17/17 connections, each re-checked with `tools/freemap.py`). One MOTOR_HW_EN layer hop in FIX was moved
4.4 mm so its via no longer sits under the diode.
- `circuit/planes.tsx`: inner4 V5V0 covers the buck's output side (x −28..−14 below y 27); VIN_SYS keeps the
input side.
- `tools/power-copper.ts`: input-area pours/vias redrawn for the new layout (searched against
`routing/inputs/board-buck-baseline.circuit.json`, a build with `POWER_COPPER_PORTS_ONLY=1`); two
signal-size (0.35 mm) vias where only microamps flow (FB divider top) or a GND pin's fill was cut off.
- PLANES replay drops the 24 saved plane wires whose pads moved; those pads now reach their planes through the
new fills and vias (checked by `tools/plane-connectivity.ts` and the build's connectivity check).
Verdict: connected, DRC-clean and short-free; power copper much improved and the 5 V buck now has a tight
layout. Before fabrication: relieve the motor eFuse output area (item 1 remainder) and fix item 2 (USB pairs).
## USB pairs re-routed as coupled, length-matched pairs (2026-11-27)
Final build `ROUTING_REPLAY_ONLY=1 tsci build index.circuit.tsx --pcb-png --schematic-png`: exit 0, **0 errors**;
`tsci check shorts`: none; `tsci check placement`: 0 / 0; `tsc --noEmit`: pass; `bun tools/plane-connectivity.ts`:
GND 598, VIN_SYS 136, V5V0 59 pads each one copper component, 0 isolated pours. Board: 1,122 traces, 1,568 vias.
Long runs (host pin -> ESD host-side pin; USBH: SoC -> hub upstream), 0.1 mm lines with a 0.1 mm gap (about 100 ohm
differential on top over the inner1 GND plane by the usual microstrip estimate; USB 2.0 allows 90 ohm +-15 %;
confirm with JLC's impedance calculator for the chosen stack-up), via pairs side by side, equal via counts:
| Pair | D+ (mm) | D- (mm) | Skew before | Skew now | Vias D+/D- |
| --- | --- | --- | --- | --- | --- |
| OTG | 58.41 | 58.39 | 13.27 | 0.01 | 3/3 |
| USBH | 35.05 | 35.39 | 5.85 | 0.35 | 3/3 |
| M1D | 61.26 | 61.34 | 13.65 | 0.08 | 5/5 |
| M2D | 52.88 | 52.84 | 3.14 | 0.04 | 6/6 |
| M3D | 55.94 | 55.92 | 2.10 | 0.02 | 5/5 |
| M4D | 64.49 | 64.44 | 0.20 | 0.06 | 2/2 |
| CAM | 29.71 | 29.71 | 3.52 | 0.00 | 2/2 |
("Skew before" was measured over the whole net; the short ESD -> connector stubs were not changed.)
How
- `tools/pairroute.py`: routes each pair's centre line as one fat trace (A* on a 0.05 mm grid, top/inner2/inner3),
then offsets it into the two lines; breakouts may run straight apart and/or drop each line on its own via to clear
an ESD chip's middle pin and its via; ESD chips are entered from their host side only. Every segment and via is
re-checked with exact geometry (>= 0.1 mm). Low-speed signal nets of later phases were "soft": the pairs could
cross them, and the 36 nets crossed were ripped up (`routing/rip-nets.json`).
- New phase 16 `RIPUP` (`routing/RIPUP.hand.json`, grid-routed): 97/97 connections re-routed, 94 on the three signal
layers; the last 3 use 119 mm of bottom layer (short cuts in the bottom GND fill; inner1 GND stays solid).
Nets that kept failing after a rip (port power-switch enables, eFuse PG) are never ripped.
- One extra 0.35 mm V5V0 via at CAONI (a re-routed wire cut its V5V0 fill strip).
- `routing/index.ts`: REPAIR/BUCK5 net filters now exempt RIPUP (they had dropped LNX_WDI's new copper).
Remaining before fabrication: confirm 90 ohm geometry against the fab's stack-up; the motor eFuse VBUS area (item 1).