seveibar/nema17-stepper-motor-driver-tmc2209-usb-pd

RP2040-based USB-C PD stepper-motor controller with TMC2209 drive, AS5600 position feedback, TMP102 thermal shutdown, current/voltage telemetry, RGB status LED, and protected buzzer alarm circuitry.

Version
0.2.0
License
unset
Stars
0

schematic/ThermalProtectionSection.tsx

import { TMP102AIDRLR } from "../imports/TMP102AIDRLR";
import { SN74LVC1G00DBVR } from "../imports/SN74LVC1G00DBVR";
import { logicTrace, schematicSheets } from "./config";

// Signal width requested by the sensor circuit. The validated route plan
// includes fine-pitch escapes and local supply/ground connections.
const thermalTrace = logicTrace;

const section = {
  schSheetName: schematicSheets.thermalProtection,
  schSectionName: "thermal_protection",
} as const;

/** Sensor is near the DRIVER, beside its grounded thermal area.
 * GPIO26/27: I2C1 SDA/SCL. GPIO24: active-low hardware temperature alert.
 * The NAND gate preserves the existing MCU + USB-PD enable interlock.
 */
export const ThermalProtectionComponents = () => (
  <>
    <TMP102AIDRLR name="U_TEMP" schWidth={1.6} schHeight={1.2} pcbX={13.375} pcbY={2.0} pcbRotation={180}
      schX={-3} schY={1} schPinStyle={{pin4: {marginLeft: 0.5}}}
      schPinArrangement={{
        leftSide: { pins: [1, 6], direction: "top-to-bottom" },
        rightSide: { pins: [3], direction: "top-to-bottom" },
        topSide: { pins: [5], direction: "left-to-right" },
        bottomSide: { pins: [2, 4], direction: "left-to-right" },
      }} {...section} />
    <SN74LVC1G00DBVR name="U_THERM_GATE" schWidth={1.0} schHeight={0.8} pcbX={10.625} pcbY={6.75}
      schX={4} schY={1}
      schPinArrangement={{
        leftSide: { pins: [1, 2], direction: "top-to-bottom" },
        rightSide: { pins: [4], direction: "top-to-bottom" },
        topSide: { pins: [5], direction: "left-to-right" },
        bottomSide: { pins: [3], direction: "left-to-right" },
      }} {...section} />
    <capacitor name="C_TEMP" capacitance="100nF" footprint="0402" maxDecouplingTraceLength={15}
      supplierPartNumbers={{ jlcpcb: ["C1525"] }}
      pcbX={16.125} pcbY={-2.5} schX={-6} schY={-3}
      schOrientation="vertical" {...section} />
    <capacitor name="C_THERM_GATE" pcbRotation={0} capacitance="100nF" footprint="0402" maxDecouplingTraceLength={4.5}
      supplierPartNumbers={{ jlcpcb: ["C1525"] }}
      pcbX={10.375} pcbY={4.3} schX={-4} schY={-3}
      schOrientation="vertical" {...section} />
    <resistor name="R_TEMP_SDA" resistance="4.7k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25900"] }}
      pcbX={16.125} pcbY={0.25} schX={-8} schY={1.4}
      schOrientation="pos_bottom" {...section} />
    <resistor name="R_TEMP_SCL" resistance="4.7k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25900"] }}
      pcbX={16.125} pcbY={-1} schX={-6} schY={1.6}
      schOrientation="pos_bottom" {...section} />
    <resistor name="R_TEMP_ALERT" resistance="10k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25744"] }}
      pcbX={16.125} pcbY={-4} schX={0} schY={1.5}
      schOrientation="pos_bottom" {...section} />
    <resistor name="R_ENABLE_PD" pcbRotation={0} resistance="100k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25741"] }}
      pcbX={10.625} pcbY={2.75} schX={2} schY={-3}
      schOrientation="vertical" {...section} />
    <resistor name="R_MCU_ENABLE_PD" resistance="100k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25741"] }}
      pcbX={5.625} pcbY={-11.25} schX={-1} schY={-3}
      schOrientation="vertical" {...section} />
  </>
);

export const ThermalProtectionTraces = () => (
  <>
    <trace name="TEMP_SDA" from=".MCU > .U1 > .GPIO26_ADC0" to=".U_TEMP > .SDA" schDisplayLabel="TEMP_SDA" {...thermalTrace} />
    <trace name="TEMP_SCL" from=".MCU > .U1 > .GPIO27_ADC1" to=".U_TEMP > .SCL" schDisplayLabel="TEMP_SCL" {...thermalTrace} />
    <trace name="TEMP_ALERT_MCU" from=".U_TEMP > .ALERT" to=".MCU_GPIO24_ESCAPE > .bottom" schDisplayLabel="TEMP_OK" {...thermalTrace} />
    <trace name="TEMP_HARDWARE_INTERLOCK" schDisplayLabel="TEMP_OK" from=".U_TEMP > .ALERT" to=".U_THERM_GATE > .B" {...thermalTrace} />
    <trace name="THERMAL_SLEEP_OUTPUT" from=".U_THERM_GATE > .Y" to=".DRIVER > .ENN" schDisplayLabel="ENN" {...thermalTrace} />
    <trace name="TEMP_GND" from=".U_TEMP > .GND" to=".DRIVER > .EP" {...thermalTrace} thickness="0.3mm"
       />
    <trace name="TEMP_ADDR_0X48" from=".U_TEMP > .ADD0" to=".U_TEMP > .GND" {...thermalTrace} />
    <trace name="THERM_GATE_GND" from=".U_THERM_GATE > .GND" to=".DRIVER > .EP" {...thermalTrace} />
    <trace name="TEMP_POWER" from=".C_TEMP > .pin1" to=".MCU > .L_AVDD > .pin1" schDisplayLabel="V3V3" {...thermalTrace} />
    <trace name="THERM_GATE_POWER" schDisplayLabel="V3V3" from=".U_THERM_GATE > .VCC" to=".U_TEMP > .V_POS" {...thermalTrace} />
    <trace name="TEMP_DECOUPLE" schDisplayLabel="V3V3" from=".C_TEMP > .pin1" to=".U_TEMP > .V_POS" {...thermalTrace} />
    <trace name="THERM_GATE_DECOUPLE" schDisplayLabel="V3V3" from=".C_THERM_GATE > .pin1" to=".U_THERM_GATE > .VCC" {...thermalTrace} />
    <trace name="SDA_PULLUP" schDisplayLabel="TEMP_SDA" from=".R_TEMP_SDA > .pin1" to=".U_TEMP > .SDA" {...thermalTrace} />
    <trace name="SCL_PULLUP" schDisplayLabel="TEMP_SCL" from=".R_TEMP_SCL > .pin1" to=".U_TEMP > .SCL" {...thermalTrace} />
    <trace name="ALERT_PULLUP" schDisplayLabel="TEMP_OK" from=".R_TEMP_ALERT > .pin1" to=".U_TEMP > .ALERT" {...thermalTrace} />
    <trace name="ENABLE_PULLDOWN" from=".R_ENABLE_PD > .pin1" to=".U_THERM_GATE > .A" schDisplayLabel="PD_MCU_ENABLE" {...thermalTrace} />
    <trace name="MCU_ENABLE_PULLDOWN" from=".R_MCU_ENABLE_PD > .pin1" to=".Q_PD_ENABLE > .source" schDisplayLabel="MCU_ENABLE" {...thermalTrace} />
    {["R_TEMP_SDA", "R_TEMP_SCL", "R_TEMP_ALERT"].map(name => (
      <trace key={name} name={`${name}_3V3`} schDisplayLabel="V3V3" from={`.${name} > .pin2`} to=".U_TEMP > .V_POS" {...thermalTrace} />
    ))}
    <trace name="C_TEMP_GND" from=".C_TEMP > .pin2" to=".U_TEMP > .ADD0" {...thermalTrace} />
    <trace name="C_THERM_GATE_GND" from=".C_THERM_GATE > .pin2" to=".U_THERM_GATE > .GND" {...thermalTrace} />
    <trace name="R_ENABLE_PD_GND" from=".R_ENABLE_PD > .pin2" to=".DRIVER > .EP" {...thermalTrace} />
    <trace name="R_MCU_ENABLE_PD_GND" from=".R_MCU_ENABLE_PD > .pin2" to="net.GND" {...thermalTrace} />
  </>
);