Skip to content

Add RP2040 microcontroller subcircuit - #78

Merged
seveibar merged 7 commits into
mainfrom
agent/add-rp2040-subcircuit
Jul 20, 2026
Merged

Add RP2040 microcontroller subcircuit#78
seveibar merged 7 commits into
mainfrom
agent/add-rp2040-subcircuit

Conversation

@seveibar

@seveibar seveibar commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a reusable Microcontroller_RP2040 subcircuit adapted from abse/gameboy
  • include the RP2040, QSPI flash, 12 MHz crystal, USB-C, 3.3 V regulator, decoupling, boot/run controls, status LEDs, and SWD test points
  • forward connection mappings to the internal RP2040 and export the component and props from @tscircuit/common
  • replace every imported EasyEDA/inline footprint with an exact, self-contained footprinter string while preserving pin positions
  • add a standalone USB-C usage circuit with committed PCB, schematic, and 3D snapshots
  • refresh PCB, schematic, and 3D snapshots across the full repository

Impact

Consumers can now use:

import { Microcontroller_RP2040 } from "@tscircuit/common"

<Microcontroller_RP2040 name="MCU" />

GPIO, USB, and debug pins can also be connected through the component's connections prop. The subcircuit includes its USB-C receptacle and support circuitry.

Footprint conversion

The JLCPCB/EasyEDA copper was evaluated in component-local coordinates with circuit-json-to-footprinter#12. All imported parts recover at 100% copper IoU with matching pin positions:

Part Self-contained footprinter string Copper IoU
RP2040 (C2040) qfn56_thermalpad3.1mmx3.1mm_p0.4001mm_w7.8999mm_h7.9001mm_pw0.2mm_pl0.85mm 1.000
B5819W_SL (C8598) sod123w_p3.4mm_pw0.95mm 1.000
XL_1608SURC_06 (C965799) led_p1.498mm_pw0.8mm_ph0.8mm 1.000
X322512MSB4SI (C9002) crystal 1.000
SKRPACE010 (C139797) smdpushbutton 1.000
AP2112K_3_3TRG1 (C23380830) dfn6_missing(5)_p0.95mm_w3.2001mm_pin1location(rightside,bottom) 1.000
W25Q16JVUXIQ (C2843335) wson 1.000
TYPE_C_16PIN_2MD_073_ (C2765186) usbcmidmount16_pinstart13 1.000

@tscircuit/footprinter is updated to ^0.0.380 for global pin1location(...) support. Orientation is now encoded in the AP2112 footprinter string instead of a separate component pcbRotation. The RP2040 base QFN orientation already places pin 1 on the left edge near the top (leftside,top), so it needs no suffix.

The RP2040's generated thermalpad hint is explicitly aliased to pin 57/GND, with a render test covering that electrical mapping.

Validation

  • bun test — 5 passing tests, including a complete circuit render with zero circuit errors and the RP2040 thermal-pad mapping
  • bunx tsc --noEmit
  • bun run build
  • bun run format:check
  • bun run build:circuit — all 12 circuits built; existing supplier metadata and component-model warnings were emitted
  • bun run snapshot:update — refreshed PCB, schematic, and 3D snapshots for all 12 circuits
  • bun run snapshot — all snapshots match
  • visually inspected the RP2040 PCB and 3D snapshots after the orientation change
  • circuit-json-to-footprinter: 17 tests passing, including exact recovery of the oriented AP2112 footprint without pcbRotation

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tscircuit-common Ready Ready Preview, Comment Jul 20, 2026 10:47pm

Request Review

@seveibar

Copy link
Copy Markdown
Contributor Author

CC @Abse2001 wdyt? i want to merge this then start improving the schematic to make it more RP2040-like- but lmk wyt

@seveibar
seveibar marked this pull request as ready for review July 20, 2026 22:47
@seveibar
seveibar requested a review from Abse2001 as a code owner July 20, 2026 22:47
@seveibar

seveibar commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@Abse2001 you probably have a better PR, but i really want to start trying to use this to build a motor controller- maybe you can replace it? lmk wyt- i'd be down to completely nix it, but the sooner i get going the sooner i think i'll figure out what features we'll need

@seveibar
seveibar merged commit dfe998c into main Jul 20, 2026
6 checks passed
@seveibar
seveibar deleted the agent/add-rp2040-subcircuit branch July 20, 2026 22:55
@tscircuitbot

Copy link
Copy Markdown

Thank you for your contribution! 🎉

PR Rating:
Impact: Tiny

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants