abse/am3354-cm4-module
A six-layer AM3354-based compute module with DDR3L, dual 100-pin CM4 connectors, PMIC/buck power regulation, clocks, boot/pull-up support, USB/SD/GPIO interfaces, dense decoupling, and fully routed/verified multilayer copper.
- Version
- 0.1.4
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone abse/am3354-cm4-module # download the package files into ./am3354-cm4-module
tsci add abse/am3354-cm4-module # add it to your project as @tsci/abse.am3354-cm4-moduleIn 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.
source/pb/import.ts
// pb/import.ts <pb routes file>: converts a routing of pb/route.ts into cm4-module/routes.json (the format planes.ts,
// build.tsx, check.ts and export.ts read). Plane-drop nets keep their vias and stubs like any other net.
const root = import.meta.dir + "/.."
const plan = await Bun.file(root + "/plan.json").json()
const src = process.argv[2] ?? import.meta.dir + "/routes.json"
const rj = await Bun.file(src).json()
const out: any = { solved: !rj.failed?.length && !rj.conflicts?.length, router: "pb/route.ts (negotiated congestion, routing playbook)", source: src, nets: {} }
for (const [name, r] of Object.entries(rj.nets) as [string, any][]) {
const terms = ((plan.nets as any[]).find((n) => n.name === name)?.terms ?? []).map((t: any) => t.ref)
const segs = r.segs.map((s: any) => ({ layer: s.layer, w: s.w, pts: s.pts }))
const length = +segs.reduce((a: number, g: any) => a + g.pts.slice(1).reduce((b: number, p: any, i: number) => b + Math.hypot(p.x - g.pts[i].x, p.y - g.pts[i].y), 0), 0).toFixed(2)
// two vias of one net whose centres are within a via radius are one via (two branches of the net's tree changed
// layer at neighbouring grid cells): keep the first, whose pad covers the other's trace ends
const vias: any[] = []
for (const v of r.vias) if (!vias.some((u) => Math.hypot(u.x - v.x, u.y - v.y) < Math.min(u.d, v.d) / 2)) vias.push({ x: v.x, y: v.y, d: v.d, hole: v.hole })
out.nets[name] = { terms, segs, vias, length }
}
await Bun.write(root + "/routes.json", JSON.stringify(out))
console.log(`routes.json from ${src}: ${Object.keys(out.nets).length} nets, ${Object.values(out.nets).reduce((s: number, r: any) => s + r.vias.length, 0)} vias; failed ${rj.failed?.length ?? 0}, in conflict ${rj.conflicts?.length ?? 0}`)