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/safety.tsx
import { schematicPlacement } from "../lib/schematic-placement"
import { TPS3823_33DBVR } from "../imports/TPS3823_33DBVR"
import { SN74LVC1G11DBVR } from "../imports/SN74LVC1G11DBVR"
import { A_74LVC1G74DP_Q100H } from "../imports/A_74LVC1G74DP_Q100H"
import { SM02B_SRSS_TB_LF__SN_ } from "../imports/SM02B_SRSS_TB_LF__SN_"
import { XKB8080_Z } from "../imports/XKB8080_Z"
import { C, R, n } from "../lib/common"
/** Centre of the on-board stop button on the board (mm). The status LEDs are at x = -4.5, y = -33 / -35 / -37. */
export const STOP_BUTTON_AT = { x: -4.5, y: -44.25 }
/**
* Hardware port-power interlock, independent of Linux and of the supervisor firmware.
*
* KILL_N = ESTOP_OK AND LNX_WDT_OK AND IN_PG (74LVC1G11)
* PORT_HW_EN = Q of a 74LVC1G74 latch: cleared asynchronously by KILL_N low,
* set only by a rising PORT_ARM edge from Linux while KILL_N is high.
* Every PD output eFuse EN = PORT_HW_EN AND supervisor request (per-port 74LVC1G08).
*
* TPS3823-33 watchdog: Linux must toggle WDI (period < 1.6 s typ). WDI has a 10k pull-down so a
* halted/reset MPU (floating GPIO) is a missed kick, not the "watchdog disabled" tri-state case.
* Stop loop (2026-12-01: on-board stop button added; before, the loop was only the JESTOP connector):
* V3V3_AON - RESTSRC 330R - ESTOP_SRC - [JESTOP pins 1-2, bridged by RSTOPEXT 0R] - ESTOP_LOOP
* - [SWSTOP, contact closed while the button is up] - ESTOP_OK - RESTPD 2k2 to GND (CESTOP 100 nF)
* Any open in the chain (button pressed in, external button pressed, broken wire) pulls ESTOP_OK low = stop.
* Loop current 1.3 mA (was 0.3 mA with 1k / 10k) for the switch contacts; ESTOP_OK sits at 2.87 V when closed.
* A short of the external cable to GND puts 10 mA / 33 mW in RESTSRC (0402, 62.5 mW): that is why it is not lower.
* SWSTOP: XKB8080-Z, latching (push on / push off), two changeover poles wired in parallel. Commons are pins
* 2 and 5. The datasheet's circuit diagram draws 2-3 / 5-6 closed in the released state, so RSTOPNC (0R, fitted)
* takes pins 3 and 6. The drawing does not label the positions: if a built board stops with the button UP,
* move the 0R link from RSTOPNC to RSTOPNO (pins 1 and 4).
* External stop button: plug a normally-closed switch into JESTOP and REMOVE RSTOPEXT. With RSTOPEXT fitted the
* connector is bypassed and an external button does nothing.
*/
export const Safety = () => (
<>
{/* In the gap beside the top DATA connector (M4, between the M4 and M3 power stages); E-stop connector on the top edge. */}
<group schLayout={{ layoutMode: "relative" }} name="SAFETY" schSheetName="safety" pcbX={11} pcbY={27.2}>
<SM02B_SRSS_TB_LF__SN_ {...schematicPlacement("JESTOP")} name="JESTOP" pcbX={-5.0} pcbY={16.7} pcbRotation={180}
connections={{ pin1: n("ESTOP_SRC"), pin2: n("ESTOP_LOOP"), pin3: n("GND"), pin4: n("GND") }} />
{/* 0R link across the connector's two loop pins, just left of the connector (board 2.8, 45.3) */}
<R name="RSTOPEXT" v="0" a={n("ESTOP_LOOP")} b={n("ESTOP_SRC")} at={{ x: -8.2, y: 18.1, r: 90 }} />
<R name="RESTSRC" v="330" a={n("V3V3_AON")} b={n("ESTOP_SRC")} at={{ x: -8.6, y: 3.0, r: 90 }} />
<R name="RESTPD" v="2.2k" a={n("ESTOP_OK")} b={n("GND")} at={{ x: -7.3, y: 3.0, r: 90 }} />
<C name="CESTOP" v="100nF" a={n("ESTOP_OK")} at={{ x: -6.0, y: 3.0, r: 90 }} />
<TPS3823_33DBVR {...schematicPlacement("UWDT")} name="UWDT" pcbX={-6.8} pcbY={-1.6}
connections={{ VDD: n("V3V3_AON"), GND: n("GND"), WDI: n("LNX_WDI"), N_MR: n("V3V3_AON"), N_RESET: n("LNX_WDT_OK") }} />
<R name="RWDIPD" v="10k" a={n("LNX_WDI")} b={n("GND")} at={{ x: -3.4, y: -3.2, r: 90 }} />
<C name="CWDT" v="100nF" a={n("V3V3_AON")} at={{ x: -3.4, y: 0.0, r: 90 }} />
<SN74LVC1G11DBVR {...schematicPlacement("UKILL")} name="UKILL" pcbX={0.4} pcbY={-1.6}
connections={{ A: n("ESTOP_OK"), B: n("LNX_WDT_OK"), C: n("IN_PG"), Y: n("KILL_N"), VCC: n("V3V3_AON"), GND: n("GND") }} />
<C name="CKILL" v="100nF" a={n("V3V3_AON")} at={{ x: 0.4, y: 2.2 }} />
<A_74LVC1G74DP_Q100H {...schematicPlacement("ULATCH")} name="ULATCH" pcbX={6.2} pcbY={-1.0}
connections={{ D: n("V3V3_AON"), CP: n("PORT_ARM"), R_D: n("KILL_N"), S_D: n("V3V3_AON"),
Q: n("PORT_HW_EN"), N_Q: n("PORT_HW_EN_N"), VCC: n("V3V3_AON"), GND: n("GND") }} />
<R name="RARMPD" v="100k" a={n("PORT_ARM")} b={n("GND")} at={{ x: 3.4, y: 3.0, r: 90 }} />
<C name="CLATCH" v="100nF" a={n("V3V3_AON")} at={{ x: 4.7, y: 3.0, r: 90 }} />
</group>
{/* On-board stop button at the bottom edge, straight below the three status LEDs (LED column x = -4.5, lowest
LED at y = -37.0). Button centre (-4.5, -44.25): 7.25 mm below the lowest LED, 4.75 mm from the board edge.
Enclosure: a cap on this button must stay below y = -39.3 (2.3 mm clear of the lowest LED's centre), e.g.
a round cap up to 9.9 mm, or a rounded bar up to about 14 x 9.5 mm. See the stem sizes in ROUTING.txt.
No existing part or trace was moved for it: the six pins clear all other copper by 0.25 mm or more. */}
<group schLayout={{ layoutMode: "relative" }} name="STOP_BUTTON" schSheetName="safety" pcbX={STOP_BUTTON_AT.x} pcbY={STOP_BUTTON_AT.y}>
<XKB8080_Z {...schematicPlacement("SWSTOP")} name="SWSTOP" pcbX={0} pcbY={0}
connections={{ pin2: n("ESTOP_LOOP"), pin5: n("ESTOP_LOOP"), pin3: n("ESTOP_NC"), pin6: n("ESTOP_NC"), pin1: n("ESTOP_NO"), pin4: n("ESTOP_NO") }} />
<R name="RSTOPNC" v="0" a={n("ESTOP_NC")} b={n("ESTOP_OK")} at={{ x: 5.35, y: -1.75, r: 0 }} />
<R name="RSTOPNO" v="0" dnp a={n("ESTOP_OK")} b={n("ESTOP_NO")} at={{ x: -5.5, y: -1.75, r: 0 }} />
</group>
</>
)