aj0070/logic-analyzer

A 16-channel USB logic analyzer PCB built around an RP2040, USB-C input/ESD protection, 3.3V regulation, QSPI flash, crystal clock, dual 8-channel level shifters, and probe headers.

Version
1.0.0
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone aj0070/logic-analyzer  # download the package files into ./logic-analyzer
tsci add aj0070/logic-analyzer    # add it to your project as @tsci/aj0070.logic-analyzer

In 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.

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import { Fragment } from "react"
import { AP2112K_3_3TRG1 } from "./imports/AP2112K_3_3TRG1"
import { PESD5V2S2UT_215 } from "./imports/PESD5V2S2UT_215"
import { TXS0108EPWR } from "./imports/TXS0108EPWR"
import { RP2040 } from "./imports/RP2040"

const channels = Array.from({ length: 16 }, (_, i) => i)

export default () => (
  <board
    width="55mm"
    height="35mm"
    layers={2}
    title="16-channel USB logic analyzer"
    routeRemaining={true}
  >
    <schematicsheet name="power_usb" displayName="Power and USB" sheetIndex={0} />
    <schematicsheet name="mcu" displayName="RP2040 and clock" sheetIndex={1} />
    <schematicsheet name="flash_boot" displayName="Flash, boot, status" sheetIndex={2} />
    <schematicsheet name="probe" displayName="Level shifters and probe" sheetIndex={3} />

    <schematicsection name="usbc" displayName="USB-C and ESD" />
    <schematicsection name="ldo" displayName="3.3V LDO" />
    <schematicsection name="vref" displayName="VREF select" />
    <schematicsection name="mcu_power" displayName="RP2040 supply" />
    <schematicsection name="clock" displayName="12MHz crystal" />
    <schematicsection name="qspi" displayName="QSPI flash" />
    <schematicsection name="boot" displayName="Reset and boot" />
    <schematicsection name="led" displayName="Status LED" />
    <schematicsection name="shift" displayName="Level shifters" />
    <schematicsection name="probe_hdr" displayName="Probe header" />

    <net name="VBUS" isPowerNet nominalTraceWidth={0.5} />
    <net name="V3_3" isPowerNet nominalTraceWidth={0.5} />
    <net name="V1_1" isPowerNet nominalTraceWidth={0.4} />
    <net name="GND" isGroundNet nominalTraceWidth={0.4} />
    <net name="VREF" isPowerNet nominalTraceWidth={0.4} />
    <net name="VREF_EXT" />
    <net name="USB_DP" />
    <net name="USB_DM" />
    <net name="USB_DP_C" />
    <net name="USB_DM_C" />
    <net name="XIN" />
    <net name="XOUT" />
    <net name="XOUT_XTAL" />
    <net name="QSPI_SS" />
    <net name="QSPI_SCLK" />
    <net name="QSPI_SD0" />
    <net name="QSPI_SD1" />
    <net name="QSPI_SD2" />
    <net name="QSPI_SD3" />
    <net name="RUN" />
    <net name="LED_A" />

    <connector
      name="J1"
      standard="usb_c"
      supplierPartNumbers={{ jlcpcb: ["C2765186"] }}
      allowOffBoard
      pcbX={-25.5}
      pcbY={6.0}
      pcbRotation={270}
      schSheetName="power_usb"
      schSectionName="usbc"
      schX={-12}
      schY={4}
      noConnect={["SBU1", "SBU2"]}
      schWidth={1.575}
    />

    <PESD5V2S2UT_215
      name="D2"
      pcbX={-19.0}
      pcbY={2.0}
      pcbRotation={0}
      schSheetName="power_usb"
      schSectionName="usbc"
      schX={-8}
      schY={4}
    />

    <resistor name="R1" resistance="5.1k" footprint="0402" pcbX={-19.8} pcbY={10.0} pcbRotation={90} schSheetName="power_usb" schSectionName="usbc" schX={-9.5} schY={7} schRotation={270} />
    <resistor name="R2" resistance="5.1k" footprint="0402" pcbX={-19.8} pcbY={12.0} pcbRotation={90} schSheetName="power_usb" schSectionName="usbc" schX={-8.3} schY={7} schRotation={270} />
    <resistor name="R3" resistance="27" footprint="0402" pcbX={-21.9} pcbY={1.0} pcbRotation={90} schSheetName="power_usb" schSectionName="usbc" schX={-6} schY={2} />
    <resistor name="R4" resistance="27" footprint="0402" pcbX={-21.9} pcbY={-1.0} pcbRotation={90} schSheetName="power_usb" schSectionName="usbc" schX={-6} schY={0.5} />

    <AP2112K_3_3TRG1
      name="U5"
      pcbX={-21.3}
      pcbY={-13.6}
      pcbRotation={0}
      schSheetName="power_usb"
      schSectionName="ldo"
      schX={-1}
      schY={7}
      schWidth={1.865}
      schHeight={0.8}
    />

    <capacitor name="C1" capacitance="10uF" footprint="0603" pcbX={-25.3} pcbY={-12.6} pcbRotation={0} schSheetName="power_usb" schSectionName="ldo" schX={2.2} schY={7} schRotation={270} />
    <capacitor name="C2" capacitance="100nF" footprint="0402" pcbX={-25.3} pcbY={-14.4} pcbRotation={0} schSheetName="power_usb" schSectionName="ldo" schX={3.2} schY={7} schRotation={270} />
    <capacitor name="C3" capacitance="10uF" footprint="0603" pcbX={-17.6} pcbY={-12.6} pcbRotation={0} schSheetName="power_usb" schSectionName="ldo" schX={5.2} schY={7} schRotation={270} />
    <capacitor name="C4" capacitance="100nF" footprint="0402" pcbX={-17.6} pcbY={-14.4} pcbRotation={0} schSheetName="power_usb" schSectionName="ldo" schX={6.2} schY={7} schRotation={270} />

    <pinheader
      name="J3"
      pinCount={4}
      pitch="2.54mm"
      gender="male"
      footprint="pinrow4_p2.54mm"
      pinLabels={["V3_3", "VREF", "VREF_EXT", "GND"]}
      schWidth={0.96}
      schFacingDirection="right"
      pcbX={-25.7}
      pcbY={-6.0}
      pcbRotation={90}
      schSheetName="power_usb"
      schSectionName="vref"
      schX={10}
      schY={5}
      schRotation={90}
    />
    <capacitor name="C5" capacitance="100nF" footprint="0402" pcbX={-22.5} pcbY={-6.0} pcbRotation={90} schSheetName="power_usb" schSectionName="vref" schX={12.5} schY={5} schRotation={270} />
    <capacitor name="C25" capacitance="100nF" footprint="0402" pcbX={-23.0} pcbY={-8.2} pcbRotation={90} schSheetName="power_usb" schSectionName="vref" schX={14.5} schY={5} schRotation={270} />

    <RP2040
      name="U1"
      pcbX={0}
      pcbY={5.5}
      pcbRotation={90}
      schSheetName="mcu"
      schSectionName="mcu_power"
      schX={-8}
      schY={0}
      schWidth={2.815}
      schHeight={6}
    />

    <crystal
      name="X1"
      frequency="12MHz"
      loadCapacitance="15pF"
      pinVariant="two_pin"
      footprint="kicad:Crystal/Crystal_SMD_3215-2Pin_3.2x1.5mm"
      pcbX={6.0}
      pcbY={4.7}
      pcbRotation={90}
      schSheetName="mcu"
      schSectionName="clock"
      schX={0}
      schY={-5}
    />
    <capacitor name="C19" capacitance="15pF" footprint="0402" pcbX={8.6} pcbY={4.9} pcbRotation={0} schSheetName="mcu" schSectionName="clock" schX={-2.5} schY={-7.6} schRotation={270} />
    <capacitor name="C20" capacitance="15pF" footprint="0402" pcbX={8.6} pcbY={2.0} pcbRotation={0} schSheetName="mcu" schSectionName="clock" schX={2.5} schY={-7.6} schRotation={270} />
    <resistor name="R21" resistance="1k" footprint="0402" pcbX={6.0} pcbY={1.6} pcbRotation={90} schSheetName="mcu" schSectionName="clock" schX={2.5} schY={-5} schRotation={180} />

    <capacitor name="C6" capacitance="100nF" footprint="0402" pcbX={-5.9} pcbY={4.4} pcbRotation={0} schSheetName="mcu" schSectionName="mcu_power" schX={4} schY={6} schRotation={270} />
    <capacitor name="C7" capacitance="100nF" footprint="0402" pcbX={-5.9} pcbY={5.5} pcbRotation={0} schSheetName="mcu" schSectionName="mcu_power" schX={5} schY={6} schRotation={270} />
    <capacitor name="C8" capacitance="100nF" footprint="0402" pcbX={-5.9} pcbY={6.6} pcbRotation={0} schSheetName="mcu" schSectionName="mcu_power" schX={6} schY={6} schRotation={270} />
    <capacitor name="C9" capacitance="100nF" footprint="0402" pcbX={-5.9} pcbY={7.7} pcbRotation={0} schSheetName="mcu" schSectionName="mcu_power" schX={7} schY={6} schRotation={270} />
    <capacitor name="C10" capacitance="100nF" footprint="0402" pcbX={4.4} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={8} schY={6} schRotation={270} />
    <capacitor name="C11" capacitance="100nF" footprint="0402" pcbX={6.6} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={9} schY={6} schRotation={270} />
    <capacitor name="C12" capacitance="100nF" footprint="0402" pcbX={-4.6} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={10} schY={6} schRotation={270} />
    <capacitor name="C13" capacitance="100nF" footprint="0402" pcbX={-2.4} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={11} schY={6} schRotation={270} />
    <capacitor name="C14" capacitance="100nF" footprint="0402" pcbX={-0.2} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={12} schY={6} schRotation={270} />
    <capacitor name="C15" capacitance="100nF" footprint="0402" pcbX={2.0} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={13} schY={6} schRotation={270} />
    <capacitor name="C16" capacitance="1uF" footprint="0603" pcbX={-9.0} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={14} schY={6} schRotation={270} />
    <capacitor name="C17" capacitance="1uF" footprint="0603" pcbX={-12.6} pcbY={11.0} pcbRotation={90} schSheetName="mcu" schSectionName="mcu_power" schX={15.2} schY={6} schRotation={270} />

    <chip
      name="U2"
      manufacturerPartNumber="W25Q16JVSSIQ"
      footprint="soic8_p1.27mm"
      pinLabels={{ pin1: "CS", pin2: "DO", pin3: "WP", pin4: "GND", pin5: "DI", pin6: "CLK", pin7: "HOLD", pin8: "VCC" }}
      pinAttributes={{ VCC: { requiresPower: true }, GND: { requiresGround: true } }}
      pcbX={-10.0}
      pcbY={2.6}
      pcbRotation={0}
      schSheetName="flash_boot"
      schSectionName="qspi"
      schX={-9}
      schY={3}
      schWidth={1.8}
      schHeight={1}
    />
    <capacitor name="C18" capacitance="100nF" footprint="0402" pcbX={-14.2} pcbY={3.6} pcbRotation={90} schSheetName="flash_boot" schSectionName="qspi" schX={-5.5} schY={3} schRotation={270} />

    <resistor name="R23" resistance="10k" footprint="0402" pcbX={5.7} pcbY={8.0} pcbRotation={90} schSheetName="flash_boot" schSectionName="boot" schX={-11} schY={-2} schRotation={270} />
    <pushbutton name="SW2" footprint="smdpushbutton" pcbX={17.0} pcbY={7.0} pcbRotation={0} schSheetName="flash_boot" schSectionName="boot" schX={-8} schY={-5} />
    <pushbutton name="SW1" footprint="smdpushbutton" pcbX={17.0} pcbY={0.0} pcbRotation={0} schSheetName="flash_boot" schSectionName="boot" schX={-3} schY={-5} />

    <resistor name="R22" resistance="330" footprint="0402" pcbX={10.4} pcbY={11.0} pcbRotation={0} schSheetName="flash_boot" schSectionName="led" schX={6.2} schY={4.4} schRotation={270} />
    <led name="D1" color="green" footprint="led0603" pcbX={13.8} pcbY={11.0} pcbRotation={0} schSheetName="flash_boot" schSectionName="led" schX={6.2} schY={3.0} schRotation={270} />

    <TXS0108EPWR
      name="U3"
      pcbX={-7.6}
      pcbY={-4.5}
      pcbRotation={0}
      schSheetName="probe"
      schSectionName="shift"
      schX={-6}
      schY={2}
      schWidth={1.96}
      schHeight={2.2}
    />
    <TXS0108EPWR
      name="U4"
      pcbX={7.6}
      pcbY={-4.5}
      pcbRotation={0}
      schSheetName="probe"
      schSectionName="shift"
      schX={4}
      schY={2}
      schWidth={1.96}
      schHeight={2.2}
    />
    <capacitor name="C21" capacitance="100nF" footprint="0402" pcbX={-12.5} pcbY={-7.4} pcbRotation={90} schSheetName="probe" schSectionName="shift" schX={-1.0} schY={6.6} schRotation={270} />
    <capacitor name="C23" capacitance="100nF" footprint="0402" pcbX={12.5} pcbY={-7.4} pcbRotation={90} schSheetName="probe" schSectionName="shift" schX={0.0} schY={6.6} schRotation={270} />
    <capacitor name="C22" capacitance="100nF" footprint="0402" pcbX={-12.5} pcbY={-1.6} pcbRotation={90} schSheetName="probe" schSectionName="shift" schX={-1.0} schY={5.6} schRotation={270} />
    <capacitor name="C24" capacitance="100nF" footprint="0402" pcbX={12.5} pcbY={-1.6} pcbRotation={90} schSheetName="probe" schSectionName="shift" schX={0.0} schY={5.6} schRotation={270} />

    {channels.map((i) => {
      const r = `R${5 + i}`
      const x = -14.25 + i * 1.9
      const shifter = i < 8 ? "U3" : "U4"
      const a = `A${(i % 8) + 1}`
      const b = `B${(i % 8) + 1}`
      return (
        <Fragment key={r}>
          <resistor
            name={r}
            resistance="33"
            footprint="0402"
            pcbX={x}
            pcbY={-9.9}
            pcbRotation={90}
            schSheetName="probe"
            schSectionName="probe_hdr"
            schX={-10}
            schY={8 - i * 1.05}
            schRotation={0}
          />
          <trace from={`J2.CH${i}`} to={`${r}.pin1`} />
          <trace from={`${r}.pin2`} to={`${shifter}.${a}`} />
          <trace from={`${shifter}.${b}`} to={`U1.GPIO${i}`} />
        </Fragment>
      )
    })}

    <pinheader
      name="J2"
      pinCount={20}
      pitch="2.54mm"
      gender="male"
      doubleRow
      footprint="pinrow20_rows2"
      pinLabels={[
        "CH0", "CH1", "CH2", "CH3", "CH4", "CH5", "CH6", "CH7",
        "CH8", "CH9", "CH10", "CH11", "CH12", "CH13", "CH14", "CH15",
        "GND1", "GND2", "GND3", "GND4",
      ]}
      schWidth={0.58}
      schHeight={4.2}
      schFacingDirection="right"
      pcbX={0}
      pcbY={-14.4}
      pcbRotation={0}
      schSheetName="probe"
      schSectionName="probe_hdr"
      schX={-11}
      schY={0}
    />

    <trace from="J1.VBUS1" to="net.VBUS" />
    <trace from="J1.VBUS2" to="net.VBUS" />
    <trace from="J1.GND1" to="net.GND" />
    <trace from="J1.GND2" to="net.GND" />
    <trace from="J1.SHELL1" to="net.GND" />
    <trace from="J1.SHELL2" to="net.GND" />
    <trace from="J1.CC1" to="R1.pin1" />
    <trace from="R1.pin2" to="net.GND" />
    <trace from="J1.CC2" to="R2.pin1" />
    <trace from="R2.pin2" to="net.GND" />
    <trace from="J1.DP1" to="net.USB_DP_C" />
    <trace from="J1.DP2" to="net.USB_DP_C" />
    <trace from="J1.DM1" to="net.USB_DM_C" />
    <trace from="J1.DM2" to="net.USB_DM_C" />
    <trace from="net.USB_DP_C" to="D2.pin1" />
    <trace from="net.USB_DM_C" to="D2.pin2" />
    <trace from="D2.pin3" to="net.GND" />
    <trace from="net.USB_DP_C" to="R3.pin1" />
    <trace from="R3.pin2" to="net.USB_DP" />
    <trace from="net.USB_DM_C" to="R4.pin1" />
    <trace from="R4.pin2" to="net.USB_DM" />
    <trace from="net.USB_DP" to="U1.USB_DP" />
    <trace from="net.USB_DM" to="U1.USB_DM" />

    <trace from="net.VBUS" to="C1.pin1" />
    <trace from="C1.pin2" to="net.GND" />
    <trace from="net.VBUS" to="C2.pin1" />
    <trace from="C2.pin2" to="net.GND" />
    <trace from="net.VBUS" to="U5.VIN" />
    <trace from="U5.EN" to="net.VBUS" />
    <trace from="U5.GND" to="net.GND" />
    <trace from="U5.VOUT" to="net.V3_3" />
    <trace from="net.V3_3" to="C3.pin1" />
    <trace from="C3.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C4.pin1" />
    <trace from="C4.pin2" to="net.GND" />

    <trace from="J3.V3_3" to="net.V3_3" />
    <trace from="J3.VREF" to="net.VREF" />
    <trace from="J3.VREF_EXT" to="net.VREF_EXT" />
    <trace from="J3.GND" to="net.GND" />
    <trace from="net.VREF" to="C5.pin1" />
    <trace from="C5.pin2" to="net.GND" />
    <trace from="net.VREF_EXT" to="C25.pin1" />
    <trace from="C25.pin2" to="net.GND" />

    <trace from="U1.IOVDD1" to="net.V3_3" />
    <trace from="U1.IOVDD2" to="net.V3_3" />
    <trace from="U1.IOVDD3" to="net.V3_3" />
    <trace from="U1.IOVDD4" to="net.V3_3" />
    <trace from="U1.IOVDD5" to="net.V3_3" />
    <trace from="U1.IOVDD6" to="net.V3_3" />
    <trace from="U1.VREG_IN" to="net.V3_3" />
    <trace from="U1.USB_VDD" to="net.V3_3" />
    <trace from="U1.ADC_AVDD" to="net.V3_3" />
    <trace from="U1.GND" to="net.GND" />
    <trace from="U1.TESTEN" to="net.GND" />
    <trace from="U1.VREG_VOUT" to="net.V1_1" />
    <trace from="U1.DVDD1" to="net.V1_1" />
    <trace from="U1.DVDD2" to="net.V1_1" />

    <trace from="net.V3_3" to="C6.pin1" />
    <trace from="C6.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C7.pin1" />
    <trace from="C7.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C8.pin1" />
    <trace from="C8.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C9.pin1" />
    <trace from="C9.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C10.pin1" />
    <trace from="C10.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C11.pin1" />
    <trace from="C11.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C12.pin1" />
    <trace from="C12.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C13.pin1" />
    <trace from="C13.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C14.pin1" />
    <trace from="C14.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C15.pin1" />
    <trace from="C15.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C16.pin1" />
    <trace from="C16.pin2" to="net.GND" />
    <trace from="net.V1_1" to="C17.pin1" />
    <trace from="C17.pin2" to="net.GND" />

    <trace from="U1.XIN" to="net.XIN" />
    <trace from="net.XIN" to="X1.pin1" />
    <trace from="U1.XOUT" to="net.XOUT" />
    <trace from="net.XOUT" to="R21.pin1" />
    <trace from="R21.pin2" to="net.XOUT_XTAL" />
    <trace from="net.XOUT_XTAL" to="X1.pin2" />
    <trace from="net.XIN" to="C19.pin1" />
    <trace from="C19.pin2" to="net.GND" />
    <trace from="net.XOUT_XTAL" to="C20.pin1" />
    <trace from="C20.pin2" to="net.GND" />

    <trace from="U1.QSPI_SS" to="net.QSPI_SS" />
    <trace from="U1.QSPI_SCLK" to="net.QSPI_SCLK" />
    <trace from="U1.QSPI_SD0" to="net.QSPI_SD0" />
    <trace from="U1.QSPI_SD1" to="net.QSPI_SD1" />
    <trace from="U1.QSPI_SD2" to="net.QSPI_SD2" />
    <trace from="U1.QSPI_SD3" to="net.QSPI_SD3" />
    <trace from="net.QSPI_SS" to="U2.CS" />
    <trace from="net.QSPI_SCLK" to="U2.CLK" />
    <trace from="net.QSPI_SD0" to="U2.DI" />
    <trace from="net.QSPI_SD1" to="U2.DO" />
    <trace from="net.QSPI_SD2" to="U2.WP" />
    <trace from="net.QSPI_SD3" to="U2.HOLD" />
    <trace from="net.V3_3" to="U2.VCC" />
    <trace from="U2.GND" to="net.GND" />
    <trace from="net.V3_3" to="C18.pin1" />
    <trace from="C18.pin2" to="net.GND" />

    <trace from="net.V3_3" to="R23.pin1" />
    <trace from="R23.pin2" to="net.RUN" />
    <trace from="net.RUN" to="U1.RUN" />
    <trace from="net.RUN" to="SW2.pin1" />
    <trace from="SW2.pin2" to="net.GND" />
    <trace from="SW2.pin3" to="net.RUN" />
    <trace from="SW2.pin4" to="net.GND" />
    <trace from="net.QSPI_SS" to="SW1.pin1" />
    <trace from="SW1.pin2" to="net.GND" />
    <trace from="SW1.pin3" to="net.QSPI_SS" />
    <trace from="SW1.pin4" to="net.GND" />

    <trace from="U1.GPIO25" to="R22.pin1" />
    <trace from="R22.pin2" to="net.LED_A" />
    <trace from="net.LED_A" to="D1.left" />
    <trace from="D1.right" to="net.GND" />

    <trace from="U3.VCCA" to="net.VREF" />
    <trace from="U3.VCCB" to="net.V3_3" />
    <trace from="U3.OE" to="net.VREF" />
    <trace from="U3.GND" to="net.GND" />
    <trace from="U4.VCCA" to="net.VREF" />
    <trace from="U4.VCCB" to="net.V3_3" />
    <trace from="U4.OE" to="net.VREF" />
    <trace from="U4.GND" to="net.GND" />
    <trace from="net.VREF" to="C21.pin1" />
    <trace from="C21.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C22.pin1" />
    <trace from="C22.pin2" to="net.GND" />
    <trace from="net.VREF" to="C23.pin1" />
    <trace from="C23.pin2" to="net.GND" />
    <trace from="net.V3_3" to="C24.pin1" />
    <trace from="C24.pin2" to="net.GND" />

    <trace from="J2.GND1" to="net.GND" />
    <trace from="J2.GND2" to="net.GND" />
    <trace from="J2.GND3" to="net.GND" />
    <trace from="J2.GND4" to="net.GND" />
  </board>
)