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.
circuit/supervisor.tsx
import { schematicPlacement } from "../lib/schematic-placement"
import { STM32G0B1CBT6 } from "../imports/STM32G0B1CBT6"
import { C, R, n } from "../lib/common"
import { StandardJstSwdUpward } from "@tsci/tscircuit.standard-jst-programmer"
/**
* Port supervisor: STM32G0B1CBT6 (2x UCPD) -> two independent USB-PD SOURCE ports.
* Runs from the always-on 3V3_AON rail, independent of the Linux MPU and the PMIC.
* Pin functions checked against ST STM32_open_pin_data STM32G0B1C(B-C-E)Tx.xml:
* UCPD1_CC1 = PA8, UCPD1_CC2 = PB15, UCPD2_CC1 = PD0, UCPD2_CC2 = PD2,
* I2C1 = PB8/PB9 (converter bus), I2C2 = PB10/PB11 (system bus to MPU I2C5).
* PA9/PA10 carry the UCPD1 dead-battery function and are left unconnected.
*/
export const Supervisor = ({ id, ports, x, y }: { id: "A" | "B"; ports: [number, number]; x: number; y: number }) => {
const s = `SUP${id}`
const [a, b] = ports.map((i) => `P${i}`)
const P = (port: string, sig: string) => n(`${port}_${sig}`)
// SWD connector spot (group-local mm). A: straight above the SWD pins (the camera port used to sit there).
// B: beside the chip (motor stage 4 is right above it), 4 mm clear of the pin row so those pins can still fan out. Series resistors sit above the SWD pins on both.
const swd = {
...(id === "A" ? { x: -2.5, y: 10.5, r: 180 } : { x: 11.5, y: 0, r: 0 }),
rc: { x: -3.5, y: 6.6, r: 90 }, rd: { x: -1.5, y: 6.6, r: 90 },
}
return (
<group schLayout={{ layoutMode: "relative" }} name={`SUPERVISOR_${id}`} schSheetName={`supervisor_${id}`} pcbX={x} pcbY={y}>
{/* LQFP-48 with rectangular pads. The JLC import's "qfn48_pillpads ... pin1location(bottomside,left)"
generates pads with swapped length/width (neighbouring pins overlap), so it is replaced by the
standard lqfp48 land pattern (pad centres +-4.25 mm, 1.5 x 0.27 mm), rotated 90 deg so pin 1
stays at the bottom-left exactly as before; the 3D model is counter-rotated to match. */}
<STM32G0B1CBT6 {...schematicPlacement(`U${s}`)} name={`U${s}`} pcbX={0} pcbY={0} pcbRotation={90}
footprint="lqfp48_w7.2_h7.2_pl1.5mm_pw0.27mm"
cadModel={{
objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2847904.obj?uuid=a4b96ad857dc48c08dab3d0efdf20aec",
stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2847904.step?uuid=a4b96ad857dc48c08dab3d0efdf20aec",
pcbRotationOffset: -90, modelOriginPosition: { x: 0, y: 0, z: 0.000795 },
} as any}
connections={{
VDD: n("V3V3_AON"), VBAT: n("V3V3_AON"), VREF_POS: n("V3V3_AON"), VSS: n("GND"),
PF2_NRST: n(`${s}_NRST`), PA14_BOOT0: n(`${s}_SWCLK`), PA13: n(`${s}_SWDIO`),
// UCPD source ports (system side of the TPD6S300)
PA8: P(a, "CC1"), PB15: P(a, "CC2"), PD0: P(b, "CC1"), PD2: P(b, "CC2"),
// converter I2C (TPS55288 0x74 = first port, 0x75 = second port)
PB8: n(`${s}_PSCL`), PB9: n(`${s}_PSDA`),
// system I2C slave (MPU I2C5)
PB10: n("SYS_SCL"), PB11: n("SYS_SDA"),
// analog monitors
PA0: P(a, "VBUS_SNS"), PA1: P(a, "IMON"), PA2: P(a, "ILM"),
PA3: P(b, "VBUS_SNS"), PA4: P(b, "IMON"), PA5: P(b, "ILM"),
...(id === "A" ? { PA6: n("VIN_SNS"), PA7: n("IIN_MON"), PA11_PA9_: n("PD_IN_PG"), PA12_PA10_: n("IN_KILL") } : {}),
// controls
PB0: P(a, "BB_EN"), PB1: P(b, "BB_EN"), PB2: P(a, "EF_REQ"), PB12: P(b, "EF_REQ"),
PB13: P(a, "DISCH"), PB14: P(b, "DISCH"),
// status inputs
PC6: P(a, "EF_FLT_N"), PC7: P(b, "EF_FLT_N"), PB3: P(a, "BB_INT_N"), PB4: P(b, "BB_INT_N"),
PB5: n(`${s}_TPD_FLT_N`), PA15: n("PORT_HW_EN"), PD1: n("SUP_IRQ_N"),
PD3: P(a, "EF_PG"), PB6: P(b, "EF_PG"), PC13: n("ESTOP_OK"),
}} />
{/* decoupling: 100 nF at VDD and VBAT/VREF, 4.7 uF bulk (RM0444 / DS13560 power scheme) */}
<C name={`C${s}1`} v="100nF" a={n("V3V3_AON")} at={{ x: -6.2, y: 2.2, r: 90 }} />
<C name={`C${s}2`} v="100nF" a={n("V3V3_AON")} at={{ x: -6.2, y: 4.4, r: 90 }} />
<C name={`C${s}3`} v="4.7uF" fp="0603" a={n("V3V3_AON")} at={{ x: -6.2, y: -0.6, r: 90 }} />
<C name={`C${s}RST`} v="100nF" a={n(`${s}_NRST`)} at={{ x: -6.2, y: -3.4, r: 90 }} />
{/* converter I2C pull-ups */}
<R name={`R${s}SCL`} v="2.2k" a={n(`${s}_PSCL`)} b={n("V3V3_AON")} at={{ x: -2.6, y: -6.6, r: 90 }} />
<R name={`R${s}SDA`} v="2.2k" a={n(`${s}_PSDA`)} b={n("V3V3_AON")} at={{ x: -1.4, y: -6.6, r: 90 }} />
<R name={`R${s}TPD`} v="10k" a={n(`${s}_TPD_FLT_N`)} b={n("V3V3_AON")} at={{ x: -0.2, y: -6.6, r: 90 }} />
{/* TPS55288 FB/INT fault pull-ups and CDC (IMON) ADC filters, placed at the ADC end */}
<R name={`R${s}INTA`} v="10k" a={P(a, "BB_INT_N")} b={n("V3V3_AON")} at={{ x: 1.0, y: -6.6, r: 90 }} />
<R name={`R${s}INTB`} v="10k" a={P(b, "BB_INT_N")} b={n("V3V3_AON")} at={{ x: 2.2, y: -6.6, r: 90 }} />
{/* supervisor A: IMON pin faces the chip (rotated 2026-11-28; the two IMON caps competed for one escape) */}
<C name={`C${s}IMA`} v="10nF" a={P(a, "IMON")} at={{ x: 3.4, y: -6.6, r: id === "A" ? 270 : 90 }} />
<C name={`C${s}IMB`} v="10nF" a={P(b, "IMON")} at={{ x: 4.6, y: -6.6, r: 90 }} />
{/* SWD: tscircuit standard 3-pin JST SH (SWCLK, GND, SWDIO; tscircuit/standard-jst-programmer), upward entry,
with 100 ohm series resistors on the MCU side as that package asks. Replaces the loose probe pads
(2026-11-30 review). The NRST pad stays as a rescue point. */}
<StandardJstSwdUpward name={`J${s}SWD`} pcbX={swd.x} pcbY={swd.y} pcbRotation={swd.r} {...schematicPlacement(`J${s}SWD`)}
connections={{ SWCLK: n(`${s}_SWCLK_J`), GND: n("GND"), SWDIO: n(`${s}_SWDIO_J`) }} />
<R name={`R${s}SWC`} v="100" a={n(`${s}_SWCLK`)} b={n(`${s}_SWCLK_J`)} at={swd.rc} />
<R name={`R${s}SWD`} v="100" a={n(`${s}_SWDIO`)} b={n(`${s}_SWDIO_J`)} at={swd.rd} />
<testpoint {...schematicPlacement(`TP${s}RST`)} name={`TP${s}RST`} footprintVariant="pad" padDiameter={1} doNotPlace pcbX={2.0} pcbY={6.6}
connections={{ pin1: n(`${s}_NRST`) }} />
</group>
)
}