imrishabh18/rp2040-motor-controller
This circuit module provides a microcontroller-based NEMA17 stepper motor driver with integrated USB-C Power Delivery, temperature sensing, and safety interlocks.
- Version
- 1.0.16
- License
- unset
- Stars
- 0
schematic/MotorDriverCoreSection.tsx
import { DRV8847PWPR } from "../imports/DRV8847PWPR";
import { BSS84 } from "../imports/BSS84";
import { Fragment } from "react";
import {
groundTrace,
logicTrace,
powerTrace,
schematicSections,
schematicSheets,
} from "./config";
export const MotorDriverController = () => (
<>
<DRV8847PWPR
name="DRIVER" schWidth={3.2} schHeight={4}
pcbX={9.5}
pcbY={-2.5}
schX={-5.5}
schY={0}
schMarginLeft={1}
schMarginRight={1}
schPinArrangement={{
leftSide: {
pins: [2, 3, 4, 7, 6, 5],
direction: "top-to-bottom",
},
rightSide: {
pins: [16, 15, 9, 10, 1, 8],
direction: "top-to-bottom",
},
topSide: {
pins: [12],
direction: "left-to-right",
},
bottomSide: {
pins: [13, 17],
direction: "left-to-right",
},
}}
schPinStyle={{
pin7: { marginTop: 0.45 },
pin9: { marginTop: 0.45 },
pin1: { marginTop: 0.45 },
}}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
</>
);
export const MotorDriverPassives = () => (
<>
<capacitor
name="C_VM_BULK"
capacitance="10uF"
footprint="1206"
supplierPartNumbers={{ jlcpcb: ["C77093"] }}
manufacturerPartNumber="GRM31CR71E106KA12L"
pcbX={15.25}
pcbY={5.0}
maxDecouplingTraceLength={7.5}
schX={-1.2}
schY={-3.5}
schMarginX={0.15}
schMarginY={0.25}
schOrientation="vertical"
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<capacitor
name="C_VM_HF"
capacitance="100nF"
footprint="0603"
supplierPartNumbers={{ jlcpcb: ["C14663"] }}
pcbX={7.8}
pcbY={3.95}
maxDecouplingTraceLength={5.5}
schX={-1.2}
schY={-1.5}
schMarginX={0.15}
schMarginY={0.25}
schOrientation="vertical"
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<resistor
name="R_ISEN_A"
resistance="0.15"
footprint="2512"
supplierPartNumbers={{ jlcpcb: ["C2903485"] }}
manufacturerPartNumber="HoJLR2512-3W-150mR-1%"
pcbX={6}
pcbY={-10.5}
schX={-10}
schY={1.5}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<resistor
name="R_ISEN_B"
resistance="0.15"
footprint="2512"
supplierPartNumbers={{ jlcpcb: ["C2903485"] }}
manufacturerPartNumber="HoJLR2512-3W-150mR-1%"
pcbX={14}
pcbY={-10.5}
schX={-10}
schY={-1.5}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<resistor
name="R_SLEEP_PD"
resistance="100k"
footprint="0402"
supplierPartNumbers={{ jlcpcb: ["C25741"] }}
pcbX={4.5}
pcbY={-5.0}
schX={-8}
schY={-4.5}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<resistor
name="R_FAULT_PU"
resistance="10k"
footprint="0402"
supplierPartNumbers={{ jlcpcb: ["C25744"] }}
manufacturerPartNumber="0402WGF1002TCE"
pcbX={4.625}
pcbY={-7.75}
schX={-8}
schY={-7}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<BSS84
name="Q_PD_ENABLE"
pcbX={5.625}
pcbY={8.25}
schX={-12}
schY={-3}
schPinStyle={{ pin3: { marginTop: 0.7 } }}
schPinArrangement={{
leftSide: { pins: [1], direction: "top-to-bottom" },
rightSide: { pins: [2, 3], direction: "top-to-bottom" },
}}
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
<resistor
name="R_PD_ENABLE_PU"
resistance="100k"
footprint="0402"
supplierPartNumbers={{ jlcpcb: ["C25741"] }}
pcbX={5.125}
pcbY={5.5}
schX={-12}
schY={-5.5}
schOrientation="vertical"
schSheetName={schematicSheets.motorDriver}
schSectionName={schematicSections.driverCore}
/>
</>
);
export const MotorDriverControlTraces = () => (
<>
{/* Staggered escape vias keep the 0.4 mm-pitch GPIO fanout outside the QFN. */}
{[
{ gpio: 18, x: 0.8250000000000002, y: 0.3993500000000001 },
{ gpio: 19, x: 1.5750000000000002, y: 0.79945 },
{ gpio: 20, x: 0.8250000000000002, y: 1.19955 },
{ gpio: 24, x: 0.7249999999999996, y: 3.20005 },
].map(({ gpio, x, y }) => (
<Fragment key={gpio}>
<via name={`MCU_GPIO${gpio}_ESCAPE`} pcbX={x} pcbY={y}
holeDiameter="0.3mm" outerDiameter="0.45mm"
fromLayer="top" toLayer="bottom"
connectsTo={[`.MCU > .U1 > .GPIO${gpio}`, `.MCU_GPIO${gpio}_ESCAPE > .top`, `.MCU_GPIO${gpio}_ESCAPE > .bottom`]} />
<trace name={`MCU_GPIO${gpio}_ESCAPE_TRACE`}
schDisplayLabel={gpio === 24 ? "TEMP_OK" : ({18: "DRIVER_AIN1", 19: "DRIVER_AIN2", 20: "DRIVER_BIN1"} as Record<number, string>)[gpio]}
from={`.MCU > .U1 > .GPIO${gpio}`} to={`.MCU_GPIO${gpio}_ESCAPE > .top`}
thickness="0.15mm" pcbPath={[`.MCU_GPIO${gpio}_ESCAPE > .top`]} />
</Fragment>
))}
<trace
name="DRIVER_AIN1"
from=".MCU_GPIO18_ESCAPE > .bottom"
to=".DRIVER > .AIN1"
{...logicTrace}
/>
<trace
name="DRIVER_AIN2"
from=".MCU_GPIO19_ESCAPE > .bottom"
to=".DRIVER > .AIN2"
{...logicTrace}
/>
<trace
name="DRIVER_BIN1"
from=".MCU_GPIO20_ESCAPE > .bottom"
to=".DRIVER > .BIN1"
{...logicTrace}
/>
<trace
name="DRIVER_BIN2"
from=".MCU > .U1 > .GPIO21"
to=".DRIVER > .BIN2"
{...logicTrace}
/>
<trace
name="DRIVER_SLEEP"
schDisplayLabel="MCU_ENABLE"
from=".MCU > .U1 > .GPIO22"
to=".Q_PD_ENABLE > .source"
{...logicTrace}
/>
<trace
name="DRIVER_FAULT"
// Reserve the complete MCU/pull-up/driver fault route before power routing.
from=".MCU > .U1 > .GPIO23"
to=".DRIVER > .nFault"
thickness="0.1mm"
/>
</>
);
export const MotorDriverPowerTraces = () => (
<>
<trace
name="VM_BULK"
from=".DRIVER > .VM"
to=".C_VM_BULK > .pin1"
schDisplayLabel="VMOTOR"
{...powerTrace}
/>
<trace
name="VM_HF"
from=".DRIVER > .VM"
to=".C_VM_HF > .pin1"
{...powerTrace}
/>
</>
);
export const MotorDriverPrimaryGroundTraces = () => (
<>
{/* 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"
from=".DRIVER > .GND2"
to="net.GND"
{...powerTrace}
/>
<trace
name="COMMON_GND"
from=".DRIVER > .GND2"
to=".MCU > .U1 > .GND"
{...groundTrace}
/>
<trace
name="DRIVER_GND_JOIN"
from=".DRIVER > .GND1"
to=".DRIVER > .GND2"
pcbPathRelativeTo=".DRIVER > .GND2"
pcbPath={[{ x: -0.324866, y: 1.1 }]}
{...groundTrace}
/>
</>
);
export const MotorDriverGroundTraces = () => (
<>
<trace
name="ISEN_A_GND"
from=".R_ISEN_A > .pin2"
to="net.GND"
{...groundTrace}
/>
<trace
name="ISEN_B_GND"
from=".R_ISEN_B > .pin2"
to="net.GND"
{...groundTrace}
/>
<trace
name="VM_BULK_GND"
from=".C_VM_BULK > .pin2"
to="net.GND"
{...groundTrace}
/>
<trace
name="VM_HF_GND"
from=".C_VM_HF > .pin2"
to="net.GND"
{...groundTrace}
/>
<trace
name="SLEEP_PULLDOWN_GND"
from=".R_SLEEP_PD > .pin2"
to="net.GND"
{...logicTrace}
/>
</>
);
export const MotorDriverSenseAndControlTraces = () => (
<>
{/* Explicit layer transition keeps the sense escape clear of BOUT2. */}
<via name="ISEN_B_ESCAPE" pcbX={10.275} pcbY={-4.50}
holeDiameter="0.3mm" outerDiameter="0.45mm"
fromLayer="top" toLayer="bottom"
connectsTo={[".DRIVER > .BISEN", ".R_ISEN_B > .pin1", ".ISEN_B_ESCAPE > .top", ".ISEN_B_ESCAPE > .bottom"]} />
<trace name="ISEN_B_ESCAPE_TRACE"
from=".DRIVER > .BISEN" to=".ISEN_B_ESCAPE > .top"
thickness="0.2mm" pcbPath={[".ISEN_B_ESCAPE > .top"]} />
<trace
name="ISEN_A"
from=".DRIVER > .AISEN"
to=".R_ISEN_A > .pin1"
schDisplayLabel="A_ISEN"
{...powerTrace}
/>
<trace
name="ISEN_B"
from=".ISEN_B_ESCAPE > .bottom"
to=".R_ISEN_B > .pin1"
schDisplayLabel="B_ISEN"
{...powerTrace}
/>
<trace
name="DRIVER_MODE"
from=".DRIVER > .MODE"
to=".DRIVER > .GND2"
schDisplayLabel="GND"
pcbPathRelativeTo=".DRIVER > .GND2"
pcbPath={[{ x: -0.975106, y: 1.1 }]}
{...logicTrace}
/>
<trace
name="DRIVER_TRQ"
from=".DRIVER > .TRQ"
to=".DRIVER > .GND2"
schDisplayLabel="GND"
pcbPathRelativeTo=".DRIVER > .GND2"
pcbPath={[{ x: 0.975106, y: 1.1 }]}
{...logicTrace}
/>
<trace
name="PD_ENABLE_OUTPUT"
schDisplayLabel="PD_MCU_ENABLE"
from=".Q_PD_ENABLE > .drain"
to=".U_THERM_GATE > .A"
{...logicTrace}
/>
<trace
name="PD_ENABLE_GATE"
from=".Q_PD_ENABLE > .gate"
to=".U_PD > .PG"
schDisplayLabel="PD_GOOD"
{...logicTrace}
/>
<trace
name="PD_ENABLE_GATE_PULLUP"
from=".R_PD_ENABLE_PU > .pin1"
to=".Q_PD_ENABLE > .gate"
{...logicTrace}
/>
<trace
name="PD_ENABLE_PULLUP_SUPPLY"
from=".R_PD_ENABLE_PU > .pin2"
to=".U_PD > .VDD"
{...logicTrace}
/>
<trace
name="SLEEP_PULLDOWN"
from=".R_SLEEP_PD > .pin1"
to=".DRIVER > .nSleep"
schDisplayLabel="nSLEEP"
{...logicTrace}
/>
<trace
name="FAULT_PULLUP"
from=".R_FAULT_PU > .pin1"
to=".DRIVER > .nFault"
schDisplayLabel="nFAULT"
thickness="0.1mm"
/>
<trace
name="FAULT_PULLUP_3V3"
from=".R_FAULT_PU > .pin2"
to=".MCU > .L_AVDD > .pin1"
schDisplayLabel="V3V3"
{...logicTrace}
/>
</>
);