shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

diagnostics.tsx

import { WS2812B_2020 } from "./imports/WS2812B_2020"
import { SN74AHCT1G125DBVR } from "./imports/SN74AHCT1G125DBVR"
import { KLJ_4020 } from "./imports/KLJ_4020"
import { AO3400A } from "./imports/AO3400A"
import { Schottky1N5819WT } from "./imports/RB521S30"

const sheet = { schSheetName: "diagnostics" } as const

/**
 * Local, motion-MCU-owned feedback.
 *
 * The compact RGB indicator follows the buffered-addressable architecture
 * used on the reference controller. A 5 V AHCT buffer gives the LED a
 * guaranteed logic-high from the STM32's 3.3 V GPIO; the input pulldown keeps
 * it dark through reset. The magnetic buzzer is a 3 V / 100 mA inductive load,
 * so it uses a separate logic-level MOSFET, gate pulldown and flyback diode.
 * Linux can request indications over UART, but the STM32 retains fault and
 * over-temperature annunciation during a Linux stall.
 */
export function Diagnostics() {
  return <group name="DIAGNOSTICS" pcbX={0} pcbY={0} schX={0} schY={0} schSheetName="diagnostics">
    <WS2812B_2020 name="D_STATUS" layer="top" pcbX={-9.5} pcbY={-17}
      schX={-8.64} schY={4} noConnect={["DO"]} {...sheet} />
    <SN74AHCT1G125DBVR name="U_STATUS_BUFFER" layer="bottom" pcbX={6} pcbY={10.5}
      pcbRotation={90}
      schX={0.8} schY={4} schHeight={0.6} {...sheet} />
    <resistor name="R_STATUS_DATA" resistance="470" footprint="0603"
      manufacturerPartNumber="0603WAF4700T5E"
      supplierPartNumbers={{jlcpcb:["C23179"]}}
      layer="top" pcbX={-6} pcbY={-17}
      schX={-4.16} schY={4} {...sheet} />
    <resistor name="R_STATUS_PD" resistance="100k" footprint="0402"
      supplierPartNumbers={{jlcpcb:["C25741"]}}
      layer="bottom" pcbX={-17.5} pcbY={3.75} pcbRotation={180}
      schX={-0.5} schY={2.2} schOrientation="vertical" {...sheet} />
    <capacitor name="C_STATUS_LED" capacitance="100nF" maxVoltageRating={16}
      footprint="0402" supplierPartNumbers={{jlcpcb:["C1525"]}}
      maxDecouplingTraceLength={8}
      layer="top" pcbX={-11} pcbY={-19.5}
      schX={-7} schY={1} schOrientation="vertical" {...sheet} />
    <capacitor name="C_STATUS_BUFFER" capacitance="100nF" maxVoltageRating={16}
      footprint="0402" supplierPartNumbers={{jlcpcb:["C1525"]}}
      maxDecouplingTraceLength={8}
      layer="bottom" pcbX={9.5} pcbY={10.5}
      schX={-5.4} schY={1} schOrientation="vertical" {...sheet} />

    {/* PA13 is SWDIO during reset/programming, then becomes the infrequently
        updated status GPIO. The AHCT input is high impedance and the pulldown
        keeps it deterministic while the safety MCU is in reset. */}
    <trace name="STATUS_DATA_MCU" from=".TP_MOTION_SWDIO > .pin1" to=".R_STATUS_PD > .pin1"
      schDisplayLabel="STATUS_DATA" thickness={0.15} />
    <trace name="STATUS_DATA_BUFFER_IN" from=".R_STATUS_PD > .pin1" to=".U_STATUS_BUFFER > .A"
      schDisplayLabel="STATUS_DATA" thickness={0.15} />
    <trace name="STATUS_PULLDOWN_GND" from=".R_STATUS_PD > .pin2" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.15} />
    <trace name="STATUS_BUFFER_OE" from=".U_STATUS_BUFFER > .N_OE" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.15} />
    <trace name="STATUS_BUFFER_GND" from=".U_STATUS_BUFFER > .GND" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.2} />
    <trace name="STATUS_BUFFER_5V" from=".U_STATUS_BUFFER > .VCC" to=".R_BUCK_TOP > .pin1"
      schDisplayLabel="5V" thickness={0.2} />
    <trace name="STATUS_BUFFER_DECOUPLE" from=".C_STATUS_BUFFER > .pin1" to=".U_STATUS_BUFFER > .VCC"
      schDisplayLabel="5V" thickness={0.2} />
    <trace name="STATUS_BUFFER_DECOUPLE_GND" from=".C_STATUS_BUFFER > .pin2" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.2} />
    <trace name="STATUS_DATA_BUFFER_OUT" from=".U_STATUS_BUFFER > .Y" to=".R_STATUS_DATA > .pin1"
      thickness={0.15} />
    <trace name="STATUS_DATA_LED" from=".R_STATUS_DATA > .pin2" to=".D_STATUS > .DI"
      thickness={0.15} />
    <trace name="STATUS_LED_5V" from=".D_STATUS > .VDD" to=".U_STATUS_BUFFER > .VCC"
      schDisplayLabel="5V" thickness={0.2} />
    <trace name="STATUS_LED_GND" from=".D_STATUS > .GND" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.2} />
    <trace name="STATUS_LED_DECOUPLE" from=".C_STATUS_LED > .pin1" to=".D_STATUS > .VDD"
      schDisplayLabel="5V" thickness={0.2} />
    <trace name="STATUS_LED_DECOUPLE_GND" from=".C_STATUS_LED > .pin2" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.2} />

    <KLJ_4020 name="BZ1" layer="top" pcbX={-18.25} pcbY={9}
      schX={7} schY={4} schHeight={1.2}
      schPinArrangement={{ topSide: [1], bottomSide: [2] }} {...sheet} />
    <AO3400A name="Q_BUZZER" layer="top" pcbX={-14} pcbY={7} pcbRotation={0}
      schX={7} schY={0} {...sheet} />
    <Schottky1N5819WT name="D_BUZZER" layer="top" pcbX={-12} pcbY={13.5} pcbRotation={90}
      schX={11} schY={4} schRotation={90} {...sheet} />
    <resistor name="R_BUZZER_GATE" resistance="100" footprint="0402"
      supplierPartNumbers={{jlcpcb:["C25076"]}}
      layer="top" pcbX={-11} pcbY={7}
      schX={3} schY={0} {...sheet} />
    <resistor name="R_BUZZER_PD" resistance="100k" footprint="0402"
      supplierPartNumbers={{jlcpcb:["C25741"]}}
      layer="top" pcbX={-10.5} pcbY={5.5}
      schX={5} schY={-2.5} schOrientation="vertical" {...sheet} />
    <capacitor name="C_BUZZER" capacitance="10uF" maxVoltageRating={10}
      footprint="0603" supplierPartNumbers={{jlcpcb:["C19702"]}}
      maxDecouplingTraceLength={8}
      layer="top" pcbX={-19.5} pcbY={5.5}
      schX={2.5} schY={-2.5} schOrientation="vertical" {...sheet} />
    {/* PB9/TIM17_CH1 is current-limited at the gate and defaults off. Firmware
        drives hardware PWM at the buzzer's 4 kHz resonance while annunciating. */}
    <trace name="BUZZER_PWM_MCU" from=".U_MOTION > .pin2" to=".R_BUZZER_GATE > .pin1"
      schDisplayLabel="BUZZER_PWM" thickness={0.15} />
    <trace name="BUZZER_GATE_DRIVE" from=".R_BUZZER_GATE > .pin2" to=".Q_BUZZER > .G"
      thickness={0.15} />
    <trace name="BUZZER_GATE_PULLDOWN" from=".R_BUZZER_PD > .pin1" to=".Q_BUZZER > .G"
      thickness={0.15} />
    <trace name="BUZZER_GATE_PULLDOWN_GND" from=".R_BUZZER_PD > .pin2" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.15} />
    <trace name="BUZZER_SOURCE_GND" from=".Q_BUZZER > .S" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.3} />

    {/* Pin 1 is the buzzer positive terminal; pin 2 is the switched return.
        The Schottky diode is placed directly across those terminals so the
        inductive flyback loop remains local. */}
    <trace name="BUZZER_3V3" from=".BZ1 > .POS" to=".D_BUZZER > .cathode"
      schDisplayLabel="3V3" thickness={0.2} />
    <trace name="BUZZER_LOW_SIDE" from=".BZ1 > .NEG" to=".Q_BUZZER > .D"
      schDisplayLabel="BUZZER_SINK" thickness={0.2} />
    <trace name="BUZZER_FLYBACK_A" from=".D_BUZZER > .anode" to=".BZ1 > .NEG"
      thickness={0.2} />
    <trace name="BUZZER_FLYBACK_K" from=".D_BUZZER > .cathode" to=".C_MOTION_BULK > .pin1"
      schDisplayLabel="3V3" thickness={0.2} />
    <trace name="BUZZER_DECOUPLE" from=".C_BUZZER > .pin1" to=".BZ1 > .POS"
      schDisplayLabel="3V3" thickness={0.3} />
    <trace name="BUZZER_DECOUPLE_GND" from=".C_BUZZER > .pin2" to="net.BOARD_GND"
      schDisplayLabel="BOARD_GND" thickness={0.3} />

    <silkscreentext text="STATUS" layer="top" pcbX={-7.8} pcbY={-19.7} fontSize={0.55} />
    <silkscreentext text="ALARM" layer="top" pcbX={-18.2} pcbY={12} fontSize={0.55} />
  </group>
}