Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@v7
with:
repository: stackup-eda/stackup
ref: v0.2.0
ref: v0.3.0
path: stackup-tool

- name: Install Rust 1.96
Expand Down
59 changes: 59 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# DroidCANBridge — Claude Notes

## Design principles

This device makes CANBus much easier for droid builders: a very small, cheap CAN-to-UART bridge that gives a
device without CAN support its own CANBus endpoint, translating CAN to a plain UART and back.

Requirements and the decisions behind them are recorded in [PCB/README.md](PCB/README.md). Read it
before changing the hardware, and add to it rather than re-deciding something already settled there.

## Repository layout

- `PCB/` — hardware. `PCB/stackup/` holds the Stackup design, `PCB/datasheets/` the manufacturer
datasheets (fetched with the `pcb-design` skill's `datasheet.py`), and the KiCad project
(`DroidCANBridge.*`) lives beside them.
- `ci/` — the Cargo-locked Stackup CLI (`ci/stackup/`) and the PCB sync check (`check_pcb_sync.py`).
- `src/`, `include/`, `test/` — firmware (PlatformIO, STM32C092). Not started yet.

## Git workflow

**All changes go through pull requests — never push directly to `main`.** History is linear: rebase,
never merge. Land PRs with `gh pr merge --rebase`. The remote is `thePunderWoman`.

Because PRs land by rebase, `git branch -d` and `--merged` won't recognize a landed branch. Confirm
via `git log --oneline` or `gh pr view <branch> --json state`, then `git branch -D <branch>`.

## Hardware design (Stackup)

The electrical design is Stackup KDL — `PCB/stackup/board.kdl` and `PCB/stackup/parts.kdl` — not
KiCad schematics (there are none). Hardware work follows the `pcb-design` skill.

- Check the design with `stackup check PCB/stackup/board.kdl --locked` (CLI 0.3.0; the Cargo-locked
copy in `ci/stackup/` is the reference version). The parts library is pinned by commit in
`manifest.kdl`.
- After any change to the KDL, sync `PCB/DroidCANBridge.kicad_pcb` from it with the Stackup KiCad
plugin (never edit footprint nets by hand) and commit the PCB with the KDL. Footprints record their
`board.kdl` line, so even reordering lines needs a resync.
- Logos are KiCad `board_only` footprints; the sync leaves them alone. Mounting holes are KDL
placements whose stock footprint already excludes itself from the BOM and position files.
- SMD parts (including the boot button) are assembled by JLCPCB; connectors, WAGO terminals and
headers are through-hole and hand-soldered. Give every hand-soldered part `hand=#true` in
`board.kdl`: the sync then sets its *Exclude from position files* and *Exclude from BOM*
attributes, so the KiCad exports leave it out. Don't set those attributes by hand.
- CI (`.github/workflows/ci.yml`) runs the Stackup check and the PCB sync check on PCB changes. The
only required check on `main` should be `CI Result`; add any new job to its `needs` list.

## Firmware (once it exists)

**Test coverage**
- All new logic gets unit tests in `test/`, running on the native PlatformIO environment
(`pio test -e native`) with no hardware. Do not add test dependencies that need Arduino or
physical hardware.
- Keep hardware-touching code (FDCAN/UART HAL wrappers) thin; put the bridging and framing logic in
plain, hardware-agnostic code that is compiled and covered natively.
- Every bug fix gets a regression test that would have caught it.

**Build verification**
- Verify the real firmware build locally (`pio run`) before pushing. Fix a broken build before
opening or merging a PR.
9 changes: 6 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ via `git log --oneline` or `gh pr view <branch> --json state`, then `git branch
The electrical design is Stackup KDL — `PCB/stackup/board.kdl` and `PCB/stackup/parts.kdl` — not
KiCad schematics (there are none). Hardware work follows the `pcb-design` skill.

- Check the design with `stackup check PCB/stackup/board.kdl --locked` (CLI 0.2.0; the Cargo-locked
- Check the design with `stackup check PCB/stackup/board.kdl --locked` (CLI 0.3.0; the Cargo-locked
copy in `ci/stackup/` is the reference version). The parts library is pinned by commit in
`manifest.kdl`.
- After any change to the KDL, sync `PCB/DroidCANBridge.kicad_pcb` from it with the Stackup KiCad
plugin (never edit footprint nets by hand) and commit the PCB with the KDL. Footprints record their
`board.kdl` line, so even reordering lines needs a resync.
- Mounting holes and logos are KiCad `board_only` footprints; the sync leaves them alone.
- Logos are KiCad `board_only` footprints; the sync leaves them alone. Mounting holes are KDL
placements whose stock footprint already excludes itself from the BOM and position files.
- SMD parts (including the boot button) are assembled by JLCPCB; connectors, WAGO terminals and
headers are through-hole and hand-soldered.
headers are through-hole and hand-soldered. Give every hand-soldered part `hand=#true` in
`board.kdl`: the sync then sets its *Exclude from position files* and *Exclude from BOM*
attributes, so the KiCad exports leave it out. Don't set those attributes by hand.
- CI (`.github/workflows/ci.yml`) runs the Stackup check and the PCB sync check on PCB changes. The
only required check on `main` should be `CI Result`; add any new job to its `needs` list.

Expand Down
104 changes: 96 additions & 8 deletions PCB/DroidCANBridge.kicad_pcb
Original file line number Diff line number Diff line change
Expand Up @@ -2582,8 +2582,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at -2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "e4347a70-e173-4894-9ca4-58968e83b845")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/85c3c99a-4404-50f5-9583-e113b3aa22db")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start 6.18 -9.27)
Expand Down Expand Up @@ -4659,8 +4670,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at -2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "56350952-72b1-4bc6-939f-8e016ba0e8e9")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/58b2c568-5130-5c18-89f8-46b4dadade4a")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -1.6 -2.75)
Expand Down Expand Up @@ -4995,8 +5017,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at 0 -2 0)
(layer "F.SilkS")
(hide yes)
(uuid "e4a5714e-a3f9-47e6-a139-a91629716966")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/4adcd872-3ed7-5a2c-9ee4-2161c3eadb31")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start 1.38 1.27)
Expand Down Expand Up @@ -5285,8 +5318,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at -2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "41c1fa32-be40-42e4-935d-1695b94f8013")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/be3033cc-9178-59c3-a4e7-c42c6ee72584")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -1.38 -1.38)
Expand Down Expand Up @@ -5584,8 +5628,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at -2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "76e88f8e-dad7-4cea-88bc-ab2bca3b1208")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/f6ada194-88aa-54da-9101-29e8ecb8c0ee")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -1.38 -1.38)
Expand Down Expand Up @@ -5922,8 +5977,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at 2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "4ca095d0-e067-416b-ab45-b19405d0b1aa")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/33dcdc17-416c-5a32-a49f-4c46c1c0b3e0")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -1.8 2.75)
Expand Down Expand Up @@ -7479,8 +7545,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at 2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "67e8d7e6-c85e-428c-a619-2c9ea92d4aff")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/cc8fdc49-3927-591b-b918-b904255b52aa")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -1.8 2.75)
Expand Down Expand Up @@ -8649,8 +8726,19 @@
)
)
)
(property "Stackup Hand Excluded" "exclude_from_bom exclude_from_pos_files"
(at 2 0 0)
(layer "F.SilkS")
(hide yes)
(uuid "0da77dc7-124a-4177-a1b2-6557f2b8b12a")
(effects
(font
(size 1.27 1.27)
)
)
)
(path "/1a6c01f9-957a-5f59-ab55-d3d7239d792b")
(attr through_hole)
(attr through_hole exclude_from_pos_files exclude_from_bom)
(duplicate_pad_numbers_are_jumpers no)
(fp_line
(start -2.56 5.47)
Expand Down
9 changes: 6 additions & 3 deletions PCB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,10 @@ Accepted findings:
[`production/`](production/) holds the Gerbers and job file (2 layers, 1.6 mm) and the PTH/NPTH
drills with maps in `production/gerbers/`, and the purchasing BOM (`stackup bom`, with LCSC numbers
for JLCPCB) and the placement file in `production/bom/`. The placement file lists only the 20
JLCPCB-placed parts: the BOM's hand-soldered connectors and headers (J1-J8, marked Hand/DNP) are
left out. Check JLCPCB's placement preview for rotation and pin 1 on U1-U3, Q1, D1-D3 and SW1.
JLCPCB-placed parts: the hand-soldered connectors and headers (J1-J8) are `hand=#true` in the KDL,
which marks them Hand/DNP in the BOM and, from Stackup 0.3.0, makes the PCB sync give their
footprints KiCad's *Exclude from position files* and *Exclude from BOM* attributes. The mounting
holes' stock footprint carries both attributes itself. Check JLCPCB's placement preview for rotation and pin 1 on U1-U3, Q1, D1-D3 and SW1.

Regenerate everything after any board change. Refill and save the pours first, because the
exporters plot the fills stored in the board file:
Expand All @@ -268,7 +270,8 @@ stackup bom PCB/stackup/board.kdl --locked -o PCB/production/bom/DroidCANBridge-
```

`stackup bom` exits 1 because H1/H2 have no MPN (see accepted findings) but still writes the CSV.
Then drop the BOM's Hand/DNP references from the placement file.
The placement file needs no hand editing: the footprint attributes already keep J1-J8 and H1/H2
out of it.

## Bench checklist (first board)

Expand Down
22 changes: 11 additions & 11 deletions ci/stackup/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci/stackup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2024"
publish = false

[dependencies]
stackup = { package = "stackup-eda", version = "=0.2.0" }
stackup = { package = "stackup-eda", version = "=0.3.0" }
2 changes: 1 addition & 1 deletion manifest.kdl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
stackup "0.2"
stackup "0.3"
library stackup git="https://github.com/stackup-eda/library" rev="9cf54c63f7f95b711e30edf5992a9bd28932d78d"
Loading