pixalynx/usb3-hub-10g

A USB 3.2 Gen 2 six-port hub board with USB-C PD power input, regulated 5 V/3.3 V/1.15 V rails, one upstream and four protected downstream USB-A/USB-C ports, SuperSpeed muxes, ESD protection, and controlled port power.

Version
0.0.1
License
unset
Stars
0

blocks/TypeA.tsx

import { pcb } from "../lib/place"
import { UsbA3 } from "../parts/Connectors"
import { Pusb3fr4, Usblc6 } from "../parts/Protection"
import { PortSwitch } from "../parts/Power"
import { R, C, Led } from "../lib/passives"
import { J, S, onSheet } from "../lib/layout"
import { Note, Frame } from "../lib/sch"

/** USB-A 3.x downstream port on hub port 1 or 2 (both BC1.2 DCP/CDP via CFG_BC_EN, so 1.5 A charging).
 * AP22653 (active-high EN) with EN and FAULT_N both on PRT_CTLn, exactly DS00003850F Figure 8-2; 15k = 1.735 A.
 * 220 uF polymer bulk on VBUS: USB requires 120 uF per downstream Type-A port (AP22653 datasheet note 4). */
export const TypeAPort = ({ n }: { n: 1 | 2 }) => {
  const jn = `J${n + 2}` // J3, J4
  const hub = `DN${n}`
  const vbus = `VBUS_A${n}`
  const k = 400 + (n - 1) * 50
  const jp = n === 1 ? J.A1 : J.A2
  const [sx, sy] = n === 1 ? S.A1 : S.A2
  const sec = `A${n}`
  const at = (dx: number, dy: number) => ({ x: jp.x + dx, y: jp.y + dy })
  const s = (dx: number, dy: number) => ({ sx: sx + dx, sy: sy + dy, sec })
  const xy = (dx: number, dy: number) => ({ schX: sx + dx, schY: sy + dy, schSectionName: sec, ...onSheet(sec) })
  const row = (i: number) => s(-1.3 + i * 1.3, -3.2)   // passives under the switch
  const N = (dx: number, dy: number, lines: string[]) => <Note x={sx + dx} y={sy + dy} lines={lines} />
  const sw = `U${40 + n}`
  return (
    <>
      <UsbA3 name={jn} {...pcb(jn, { x: jp.x, y: jp.y, rot: jp.rot })} {...xy(14.0, 0)} />
      <trace from={`${jn}.VBUS`} to={`net.${vbus}`} />
      {["GND", "GND_DRAIN", "SH1", "SH2"].map((p) => <trace key={p} from={`${jn}.${p}`} to="net.GND" />)}
      <trace from={`${jn}.DP`} to={`net.${hub}_DP`} /><trace from={`${jn}.DM`} to={`net.${hub}_DM`} />
      <trace from={`${jn}.SSTXP`} to={`net.${hub}_TXP`} /><trace from={`${jn}.SSTXN`} to={`net.${hub}_TXN`} />
      <trace from={`${jn}.SSRXP`} to={`net.${hub}_RXP`} /><trace from={`${jn}.SSRXN`} to={`net.${hub}_RXN`} />

      <Pusb3fr4 name={`D${k + 1}`} {...pcb(`D${k + 1}`, { x: jp.x + 1, y: jp.y + 6 })} {...xy(5.2, 0.2)} />
      <trace from={`D${k + 1}.CH1`} to={`net.${hub}_TXP`} /><trace from={`D${k + 1}.FT1`} to={`net.${hub}_TXP`} />
      <trace from={`D${k + 1}.CH2`} to={`net.${hub}_TXN`} /><trace from={`D${k + 1}.FT2`} to={`net.${hub}_TXN`} />
      <trace from={`D${k + 1}.CH3`} to={`net.${hub}_RXP`} /><trace from={`D${k + 1}.FT3`} to={`net.${hub}_RXP`} />
      <trace from={`D${k + 1}.CH4`} to={`net.${hub}_RXN`} /><trace from={`D${k + 1}.FT4`} to={`net.${hub}_RXN`} />
      <trace from={`D${k + 1}.GND3`} to="net.GND" /><trace from={`D${k + 1}.GND8`} to="net.GND" />
      <Usblc6 name={`D${k + 2}`} {...pcb(`D${k + 2}`, { x: jp.x - 3, y: jp.y + 6 })} {...xy(9.6, 0.2)} />
      <trace from={`D${k + 2}.IO1`} to={`net.${hub}_DP`} /><trace from={`D${k + 2}.IO1B`} to={`net.${hub}_DP`} />
      <trace from={`D${k + 2}.IO2`} to={`net.${hub}_DM`} /><trace from={`D${k + 2}.IO2B`} to={`net.${hub}_DM`} />
      <trace from={`D${k + 2}.VBUS`} to="net.VSYS5" /><trace from={`D${k + 2}.GND`} to="net.GND" />

      <PortSwitch name={sw} {...pcb(sw, { x: jp.x - 5, y: jp.y + 9 })} {...xy(0, 0)} />
      <trace from={`${sw}.IN`} to="net.VSYS5" /><trace from={`${sw}.GND`} to="net.GND" />
      <trace from={`${sw}.OUT`} to={`net.${vbus}`} />
      <trace from={`${sw}.EN`} to={`net.PRT_CTL${n}`} /><trace from={`${sw}.FAULT_N`} to={`net.PRT_CTL${n}`} />
      <trace from={`${sw}.ILIM`} to={`net.A${n}_ILIM`} />
      <R name={`R${k + 1}`} v="15k" a={`A${n}_ILIM`} b="GND" {...at(-8, 9)} {...row(1)} />
      <C name={`C${k + 1}`} v="1uF" a="VSYS5" b="GND" {...at(-8, 11)} {...row(0)} />
      <C name={`C${k + 2}`} v="220uF" fp="poscapB" jlc="C79111" a={vbus} b="GND" {...at(4, 9)} {...row(2)} />
      <C name={`C${k + 3}`} v="100nF" a={vbus} b="GND" {...at(1, 9)} {...row(3)} />
      <Led name={`D${k + 3}`} rname={`R${k + 2}`} rail={vbus} x={jp.x + 6} y={jp.y + 5} rx={jp.x + 6} ry={jp.y + 7} {...row(4)} />
      {N(-0.8, -0.82, [`${sw} AP22653 power switch (EN active high)`, "3-5.5 V in, 2.1 A max, limit 1.61-1.86 A", "(15 k); EN + FAULT_N on PRT_CTL" + n])}
      {N(4.5, -0.82, ["PUSB3FR4 SuperSpeed ESD,", "4 ch, 0.29 pF, +/-15 kV"])}
      {N(9.0, -0.62, ["USBLC6-2SC6 USB 2.0 ESD", "+ VBUS rail clamp"])}
      {N(13.4, -1.62, [`${jn} USB-A 3.x receptacle`, "10 Gbps, BC1.2 1.5 A charging", "220 uF bulk (USB: >= 120 uF)"])}
      <Frame x0={sx - 2.8} y0={sy - 6.2} x1={sx + 16.2} y1={sy + 1.9} title={`DOWNSTREAM USB-A PORT ${n} (HUB PORT ${n})`} />
    </>
  )
}