seveibar/pd-dual-stepper-controller

Bottom-side PCB silkscreen artwork consisting of embedded mirrored TS Circuit SVG logos, with via-clearance-aware lower-board placement.

Version
0.1.0
License
unset
Stars
0

schematic/Motor2DriverCoreSection.tsx

import { Drv8825Support2 } from "./Drv8825Support2";
import { motor2Placement } from "../mechanical/motor2-placement";
import { HoLRT1206_1W_300mR_1_ } from "../imports/HoLRT1206_1W_300mR_1_";
import { DRV8825PWPR } from "../imports/DRV8825PWPR";
import { BSS84 } from "../imports/BSS84";
import { Fragment } from "react";
import {
	groundTrace,
	logicTrace,
	powerTrace,
	schematicSections,
	schematicSheets,
} from "./config";

export const Motor2DriverController = () => (
	<>
		<DRV8825PWPR
			name="DRIVER_M2" schWidth={2.2} schHeight={3.8}
      noConnect={["DECAY", "NC", "nHOME"]}
			schMarginLeft={1}
			schMarginRight={1}
			schPinArrangement={{
				leftSide: {
					pins: [5, 6, 7, 10, 9, 8, 1, 2, 3],
					direction: "top-to-bottom",
				},
				rightSide: {
					pins: [22, 20, 16, 21, 17, 18, 24, 25, 26, 19, 27, 23],
					direction: "top-to-bottom",
				},
				topSide: {
					pins: [4, 11, 15, 12, 13],
					direction: "left-to-right",
				},
				bottomSide: {
					pins: [14, 28, 29],
					direction: "left-to-right",
				},
			}}
			schPinStyle={{
        ...Object.fromEntries([20,16,21,17,18,24,25,26,19,27,23].map(pin => [`pin${pin}`, {marginTop:0.04}])),
        pin11: {marginLeft:0.1}, pin15: {marginLeft:0.1},
        pin28: {marginLeft:0.3}, pin29: {marginLeft:0.3},
				pin5: {marginTop:0.15},
        pin7: { marginTop: 0.45 },
				pin9: { marginTop: 0.45 },
				pin1: { marginTop: 0.45 },
			}}
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("DRIVER_M2", {x:-5.625,y:-8.25})}
		/>
	</>
);

export const Motor2DriverPassives = () => (
	<>
    <Drv8825Support2 />
		<capacitor
			name="C_VM_BULK_M2"
			capacitance="10uF"
      maxVoltageRating="50V"
			footprint="1206"
			supplierPartNumbers={{ jlcpcb: ["C13585"] }}
			manufacturerPartNumber="CL31A106KBHNNNE"
			maxDecouplingTraceLength={7.5}
			schMarginX={0.15}
			schMarginY={0.25}
			schOrientation="vertical"
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("C_VM_BULK_M2", {x:-5.625,y:-8.25})}
		/>
		<capacitor
			name="C_VM_HF_M2" maxVoltageRating="50V"
			capacitance="100nF"
			footprint="0402"
			supplierPartNumbers={{ jlcpcb: ["C960916"] }}
			maxDecouplingTraceLength={5.5}
			schMarginX={0.15}
			schMarginY={0.25}
			schOrientation="vertical"
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("C_VM_HF_M2", {x:-5.625,y:-8.25})}
		/>
		<HoLRT1206_1W_300mR_1_
			name="R_ISEN_A_M2" schRotation={-90.0}
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("R_ISEN_A_M2", {x:-5.625,y:-8.25})}
		/>
		<HoLRT1206_1W_300mR_1_
			name="R_ISEN_B_M2" schRotation={-90.0}
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("R_ISEN_B_M2", {x:-5.625,y:-8.25})}
		/>
		<resistor
			name="R_SLEEP_PD_M2" schRotation={-90.0}
			resistance="100k"
			footprint="0402"
			supplierPartNumbers={{ jlcpcb: ["C25741"] }}
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("R_SLEEP_PD_M2", {x:-5.625,y:-8.25})}
		/>
		<resistor
			name="R_FAULT_PU_M2" schRotation={90.0}
			resistance="10k"
			footprint="0402"
			supplierPartNumbers={{ jlcpcb: ["C25744"] }}
			manufacturerPartNumber="0402WGF1002TCE"
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("R_FAULT_PU_M2", {x:-5.625,y:-8.25})}
		/>
		<BSS84
			name="Q_PD_ENABLE_M2"
			schPinStyle={{ pin3: { marginTop: 0.2 } }}
			schPinArrangement={{
				leftSide: { pins: [1], direction: "top-to-bottom" },
				rightSide: { pins: [2, 3], direction: "top-to-bottom" },
			}}
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("Q_PD_ENABLE_M2", {x:-5.625,y:-8.25})}
		/>
		<resistor
			name="R_PD_ENABLE_PU_M2"
			resistance="100k"
			footprint="0402"
			supplierPartNumbers={{ jlcpcb: ["C25741"] }}
			schOrientation="vertical"
			schSheetName={"motor_2"}
			schSectionName={"motor_2_core"} {...motor2Placement("R_PD_ENABLE_PU_M2", {x:-5.625,y:-8.25})}
		/>
	</>
);

/** Independent motion controls; GPIO12 is gated by the shared PD-good signal. */
export const Motor2DriverControlTraces = () => <>
  {([
    [8, "STEP", "STEP"], [9, "DIR", "DIR"], [10, "nRESET", "RESET"],
    [11, "nENBL", "ENABLE_N"], [13, "nFault", "FAULT"],
  ] as const).map(([gpio,pin,label]) => <trace key={String(gpio)} name={`M2_${label}`}
    from={`.MCU > .U1 > .GPIO${gpio}`} to={`.DRIVER_M2 > .${pin}`}
    schDisplayLabel={`M2_${label}`} {...logicTrace} />)}
  <trace name="M2_SLEEP_REQUEST" from=".MCU > .U1 > .GPIO12" to=".Q_PD_ENABLE_M2 > .source" schDisplayLabel="M2_SLEEP_REQUEST" {...logicTrace}/>
  <trace name="M2_VM_FEED" from=".D_MOTOR_BLOCK > .cathode" to=".DRIVER_M2 > .VM" schDisplayLabel="VMOTOR_PROTECTED" {...powerTrace}/>
</>;

export const Motor2DriverPowerTraces = () => (
	<>
		<trace
			name="VM_BULK_M2"
			from=".DRIVER_M2 > .VM"
			to=".C_VM_BULK_M2 > .pin1"
			schDisplayLabel="VMOTOR"
			{...powerTrace}
		/>
		<trace
			name="VM_HF_M2"
			from=".DRIVER_M2 > .VMB"
			to=".C_VM_HF_M2 > .pin1"
			{...powerTrace}
		/>
	</>
);

export const Motor2DriverPrimaryGroundTraces = () => (
	<>
		{/* Join the board's scoped GND (pours and sense returns) to the
		    MCU/driver/USB ground network. Matching net names do not join them. */}
		<trace
			name="BOARD_GND_JOIN_M2"
			from=".DRIVER_M2 > .EP"
			to="net.GND"
			{...powerTrace}
		/>
		<trace
			name="COMMON_GND_M2"
			from=".DRIVER_M2 > .EP"
			to=".MCU > .U1 > .GND"
			{...groundTrace}
		/>
		<trace
			name="DRIVER_GND_JOIN_M2"
			from=".DRIVER_M2 > .GND1"
			to=".DRIVER_M2 > .EP"
			{...groundTrace}
		/>
	</>
);

export const Motor2DriverGroundTraces = () => (
	<>
		<trace
			name="ISEN_A_GND_M2"
			from=".R_ISEN_A_M2 > .pin2"
			to="net.GND"
			{...groundTrace}
		/>
		<trace
			name="ISEN_B_GND_M2"
			from=".R_ISEN_B_M2 > .pin2"
			to="net.GND"
			{...groundTrace}
		/>
		<trace
			name="VM_BULK_GND_M2"
			from=".C_VM_BULK_M2 > .pin2"
			to="net.GND"
			{...groundTrace}
		/>
		<trace
			name="VM_HF_GND_M2"
			from=".C_VM_HF_M2 > .pin2"
			to="net.GND"
			{...groundTrace}
		/>
		<trace
			name="SLEEP_PULLDOWN_GND_M2"
			from=".R_SLEEP_PD_M2 > .pin2"
			to="net.GND"
			{...logicTrace}
		/>
	</>
);

export const Motor2DriverSenseAndControlTraces = () => (
	<>

		<trace
			name="ISEN_A_M2"
			from=".DRIVER_M2 > .AISEN"
			to=".R_ISEN_A_M2 > .pin1"
			schDisplayLabel="M2_A_ISEN"
			{...powerTrace}
		/>
		<trace
			name="ISEN_B_M2"
			from=".DRIVER_M2 > .BISEN"
			to=".R_ISEN_B_M2 > .pin1"
			schDisplayLabel="M2_B_ISEN"
			{...powerTrace}
		/>
		<trace
			name="PD_ENABLE_OUTPUT_M2"
			schDisplayLabel="M2_PD_MCU_ENABLE"
			from=".Q_PD_ENABLE_M2 > .drain"
			to=".DRIVER_M2 > .nSleep"
			{...logicTrace}
		/>
		<trace
			name="PD_ENABLE_GATE_M2"
			from=".Q_PD_ENABLE_M2 > .gate"
			to=".U_PD > .PG"
			schDisplayLabel="PD_GOOD"
			{...logicTrace}
		/>
		<trace
			name="PD_ENABLE_GATE_PULLUP_M2"
			from=".R_PD_ENABLE_PU_M2 > .pin1"
			to=".Q_PD_ENABLE_M2 > .gate"
			{...logicTrace}
		/>
		<trace
			name="PD_ENABLE_PULLUP_SUPPLY_M2"
			from=".R_PD_ENABLE_PU_M2 > .pin2"
			to=".U_PD > .VDD"
			{...logicTrace}
		/>
		<trace
			name="SLEEP_PULLDOWN_M2"
			from=".R_SLEEP_PD_M2 > .pin1"
			to=".DRIVER_M2 > .nSleep"
			schDisplayLabel="M2_nSLEEP"
			{...logicTrace}
		/>
		<trace
			name="FAULT_PULLUP_M2"
			from=".R_FAULT_PU_M2 > .pin1"
			to=".DRIVER_M2 > .nFault"
			schDisplayLabel="M2_nFAULT"
			thickness="0.1mm"
		/>
		<trace
			name="FAULT_PULLUP_3V3_M2"
			from=".R_FAULT_PU_M2 > .pin2"
			to=".MCU > .L_AVDD > .pin1"
			schDisplayLabel="V3V3"
			{...logicTrace}
		/>
	</>
);