Initial import: SB-LoRa v0.1 hardware, MeshCore UART patch, design docs

Organize the planning-session outputs into hardware/, firmware/,
palm-client/ and docs/, with design notes and a progress tracker.
This commit is contained in:
rich committed 2026-10-30 13:33:31 -04:00
commit b1b2171852
32 files changed
+10884

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# KiCad
*-backups/
*.kicad_prl
fp-info-cache
*.lck
# generator intermediates
*.dsn
*.ses
freerouting.log
*_unrouted.kicad_pcb
# Palm build output
palm-client/build/
*.o
# OS
.DS_Store
+22
View File
@@ -0,0 +1,22 @@
# VisorMesh
A MeshCore client for the Handspring Visor (Palm OS 3.5.2H3.0).
The Visor works as a terminal for a MeshCore **companion radio**. The radio (a Seeed XIAO nRF52840 with a Wio-SX1262) handles LoRa, routing and crypto. The Visor only speaks the companion framing protocol over a byte stream. The radio sits on a custom Springboard module with its own LiPo, so it keeps meshing while the Visor sleeps.
See [docs/design.md](docs/design.md) for the architecture and the reasons behind each decision, and [docs/progress.md](docs/progress.md) for the current status and log.
## Repo layout
| Path | What |
|---|---|
| `hardware/sb-lora/` | SB-LoRa Springboard carrier board: KiCad, fab outputs (JLCPCB), generator scripts. See its [README](hardware/sb-lora/README.md) |
| `firmware/` | Patches to MeshCore: companion firmware on the XIAO's hardware UART (D6/D7) |
| `palm-client/` | Palm OS client app (`.prc`), not started yet |
| `docs/design.md` | Architecture, protocol notes and decisions |
| `docs/progress.md` | Status, milestones and a dated log |
| `docs/reference/` | Third-party reference: Handspring Springboard dev guide and mechanical spec, springSD v1.1 hardware |
## Versioning
Hardware revisions are tagged in git (`hw-v0.1`, `hw-v0.2`, ...), so the files that went to fab for each order stay recoverable. Each board's README records its revision and status.
+51
View File
@@ -0,0 +1,51 @@
# Design notes
Decisions and background carried over from the original planning conversation (claude.ai, October 2026).
## Target device
- Handspring Visor, Palm OS **3.5.2H3.0** (Handspring 3.5 build), DragonBall CPU, runs on 2x AAA.
- No BLE or WiFi. The radio is never powered from the AAAs: an SX1262 at 22 dBm TX draws over 100 mA.
## Architecture
The Visor is a dumb terminal for a MeshCore companion radio. Running Ed25519/X25519 on a 16 to 33 MHz DragonBall would be painfully slow. The companion protocol is simple byte framing, which the Visor handles easily.
### Companion protocol (serial)
- 115200 8N1. The radio is the server and the Visor app is the client.
- Radio → app frames start with `0x3E` (`>`). App → radio frames start with `0x3C` (`<`). Each is followed by a 2-byte little-endian length.
- `MAX_FRAME_SIZE` = 172 bytes.
- Minimal client command set: `APP_START`, `GET_CONTACTS`, `SYNC_NEXT_MESSAGE`, `SEND_TXT_MSG`, the channel-message equivalents, and handling of the `0x8x` push codes.
- First bring-up probe: `CMD_DEVICE_QUERY` = `<` + len + `0x16 0x03`, expect a `>`-framed DEVICE_INFO reply.
- Reference: Companion Radio Protocol page on the eastmesh wiki.
## Transport options considered
1. **Cradle-connector serial**: 3.3 V TTL UART, no level shifter needed. Requires companion firmware on a hardware UART instead of USB-CDC, since the Visor can't be a USB host. Verify the pinout with a scope first, because sources disagree. Don't wire the HotSync line.
2. **Raw IR (SIR)**: `SrmOpen(serPortIrPort, ...)` paired with an MCP2120 and a TFDU transceiver on the radio. Needs line of sight.
3. **Intel/Xircom SpringPort Wireless Ethernet** (802.11b) to a WiFi companion on TCP 4000. Rare module and WEP-era, so a stunt rather than a daily driver.
4. **Custom Springboard LoRa module**: **chosen**, now the SB-LoRa board. The Palm-side protocol code is the same as option 1. Only the transport routines differ.
## SB-LoRa module (hardware/sb-lora)
- XIAO nRF52840 + Wio-SX1262 stack on 1x7 pin headers, running MeshCore companion firmware with the UART on D6 (TX) / D7 (RX). See `firmware/`.
- The Visor reaches it through bus-SPI (springSD-style CS0/CS1 latch trick) into an **SC16IS740** SPI-UART bridge. A 14.7456 MHz crystal gives 115200 baud (DLL=8).
- Power is isolated: only the SN74LVC1T45s span the Visor and XIAO supplies. The LiPo is soldered to the XIAO BAT pads and charged by the XIAO over USB-C.
- VDOCK charging sits behind JP1, which is left **open**.
- There's no module ROM in v0.1, so the client installs to RAM.
- The springSD v1.1 connector footprint and bus routines (Dmitry Grinberg) are the basis for J1 and the 68k bus code.
## Palm client plans
- Toolchain: prc-tools (m68k gcc) or CodeWarrior, Palm OS 3.5 SDK, plus Handspring HsExt headers for Springboard notifications.
- Use the New Serial Manager (`Srm*`) for cradle and IR. Use `SrmReceiveWindowOpen/Close` for zero-copy parsing, and `SrmSetWakeupHandler` + `SrmPrimeWakeupHandler(portId, 3)` to wake on the frame header.
- On SB-LoRa, the transport is the bus-SPI routines driving the SC16IS740 (IRQ* on the Springboard interrupt line). Put the SC16IS740 to sleep (IER bit 4) when idle to stay under the 100 µA standby limit.
- Power model: let the Visor sleep. The companion queues messages, and on wake the client drains with `SYNC_NEXT_MESSAGE` until NO_MORE_MESSAGES.
- Store contacts and messages in Palm databases, not the heap. Set the backup bit so HotSync keeps a copy.
- Develop in POSE with a Visor ROM matching 3.5.2H3 (Platinum/Prism or Neo/Pro profile matching the unit). POSE can bridge its serial port to a real companion board, but it can't emulate the Springboard module.
- Install: HotSync (Palm Desktop 4.x in an XP VM, or `pilot-xfer -p /dev/ttyUSB1 -i visormesh.prc` on Linux), or the user's Springboard CF adapter if its ROM has an installer. The CF adapter and SB-LoRa share the single slot.
## Future (v0.2 ideas)
- Small flash on CS0 with a module ROM header, so the client auto-launches on insert with no install step.
+36
View File
@@ -0,0 +1,36 @@
# Progress
## Milestones
### Hardware: SB-LoRa v0.1
- [x] Board designed, DRC clean, fab package generated
- [ ] Check part rotations in JLC preview (U1–U7, Y1, D1)
- [ ] Order PCBs + assembly (2-layer, 1.6 mm, ENIG)
- [ ] Order J1 (Hirose IC1HA-68RD-1.27SH(51), DigiKey HR1187-ND) and 2x 1x7 female headers
- [ ] Bare board: continuity check, dry-fit in Visor slot
- [ ] Fit J1, bench-power VSB at 3.3 V, check current and 14.7456 MHz on Y1
- [ ] In Visor: read/write SC16IS740 scratch register (SPR, 0x07) from Palm side
### Firmware
- [ ] Apply `firmware/meshcore-xiao-nrf52-uart-companion.patch` to MeshCore, build `Xiao_nrf52_companion_radio_uart`
- [ ] Bench-test over 3.3 V USB-TTL on D6/D7 with meshcore-cli
- [ ] Plug stack into carrier; `CMD_DEVICE_QUERY` gets a DEVICE_INFO reply
### Palm client
- [ ] Toolchain set up (prc-tools or CodeWarrior, Palm OS 3.5 SDK, HsExt headers)
- [ ] POSE running a 3.5.2H3 Visor ROM
- [ ] Port springSD bus routines; SC16IS740 driver
- [ ] Companion protocol framing + minimal command set
- [ ] UI: contacts, DMs, channels
- [ ] Install method confirmed (HotSync or CF adapter)
## Open questions
- Which CF adapter is it, and does its ROM include an app installer?
- Is the J1 footprint correct against the Hirose drawing? (Only checked against springSD.)
- Does the extension clear the Visor body? Is the slot-opening alignment right?
## Log
### 2026-10-30
- Planning done in claude.ai. Chose a custom Springboard module (SB-LoRa) over cradle serial/IR.
- SB-LoRa v0.1 fab package generated. Repo set up and files organized.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
# Firmware
## meshcore-xiao-nrf52-uart-companion.patch
Adds a `Xiao_nrf52_companion_radio_uart` PlatformIO env to MeshCore. It runs the companion protocol on the XIAO nRF52840's hardware UART, D6 (TX, P1.11) / D7 (RX, P1.12), at 115200 8N1, and moves I2C to unused internal pins 16/17.
```sh
git clone https://github.com/meshcore-dev/MeshCore && cd MeshCore
git apply /path/to/visormesh/firmware/meshcore-xiao-nrf52-uart-companion.patch
pio run -e Xiao_nrf52_companion_radio_uart -t upload
```
The patch was written against a MeshCore checkout from October 2026. If it no longer applies, check `examples/companion_radio/main.cpp` and `variants/xiao_nrf52/platformio.ini` for changes upstream. Record the MeshCore commit it applies cleanly to here once you've built it.
@@ -0,0 +1,50 @@
diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp
index 839d495..9d17efa 100644
--- a/examples/companion_radio/main.cpp
+++ b/examples/companion_radio/main.cpp
@@ -80,7 +80,11 @@ MultiSerialInterface interface_manager;
#if defined(SERIAL_RX)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface hardware_serial_interface;
- HardwareSerial companion_serial(1);
+ #if defined(NRF52_PLATFORM)
+ #define companion_serial Serial1 // Adafruit nRF52 core: UARTE0, pins remappable
+ #else
+ HardwareSerial companion_serial(1);
+ #endif
#endif
// platform file system
diff --git a/variants/xiao_nrf52/platformio.ini b/variants/xiao_nrf52/platformio.ini
index b40ebbc..e61a0fa 100644
--- a/variants/xiao_nrf52/platformio.ini
+++ b/variants/xiao_nrf52/platformio.ini
@@ -118,3 +118,28 @@ build_src_filter = ${Xiao_nrf52.build_src_filter}
+<../examples/kiss_modem/*.cpp>
lib_deps =
${Xiao_nrf52.lib_deps}
+
+; Companion over hardware UART (TTL 3.3V) for Handspring Visor client.
+; UART on D6 (TX, P1.11) / D7 (RX, P1.12); I2C moved to unused internal pins 17/16.
+[env:Xiao_nrf52_companion_radio_uart]
+extends = Xiao_nrf52
+board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
+board_upload.maximum_size = 708608
+build_flags =
+ ${Xiao_nrf52.build_flags}
+ -UPIN_WIRE_SCL -UPIN_WIRE_SDA
+ -D PIN_WIRE_SCL=16
+ -D PIN_WIRE_SDA=17
+ -I examples/companion_radio/ui-orig
+ -D MAX_CONTACTS=350
+ -D MAX_GROUP_CHANNELS=40
+ -D OFFLINE_QUEUE_SIZE=256
+ -D QSPIFLASH=1
+ -D SERIAL_TX=D6
+ -D SERIAL_RX=D7
+build_src_filter = ${Xiao_nrf52.build_src_filter}
+ +<../examples/companion_radio/*.cpp>
+ +<../examples/companion_radio/ui-orig/*.cpp>
+lib_deps =
+ ${Xiao_nrf52.lib_deps}
+ densaugeo/base64 @ ~1.4.0
+67
View File
@@ -0,0 +1,67 @@
# VisorMesh SB-LoRa v0.1
A Springboard module for the Handspring Visor that carries a Seeed XIAO nRF52840 + Wio-SX1262 stack running MeshCore companion firmware. The Visor talks to it over a bit-banged SPI link into an SC16IS740 UART bridge. The XIAO runs from its own LiPo and keeps meshing while the Visor sleeps or the module is unplugged.
**Status: prototype design, not yet built.** DRC is clean (0 unconnected pads) and the netlist was cross-checked against the Springboard Development Guide pin table, the SC16IS740 datasheet pinout, and Dmitry Grinberg's springSD v1.1 connector footprint. Order 5 boards and build one before trusting it.
## What's in here
| Path | What |
|---|---|
| `fab/visormesh_gerbers_jlcpcb.zip` | Gerbers + Excellon drill, upload as-is to JLCPCB or PCBWay |
| `fab/visormesh_bom_jlcpcb.csv` | BOM, JLC format (LCSC part numbers) |
| `fab/visormesh_cpl_jlcpcb.csv` | Pick-and-place, JLC format, top side only |
| `fab/hand_fit_parts.csv` | Parts you fit yourself (J1, J2, J3, JP1) |
| `fab/visormesh_schematic.pdf` | Net-label schematic + theory of operation |
| `fab/visormesh_assembly_top.pdf` | Assembly drawing with reference designators |
| `kicad/` | KiCad 7 board + project + custom DRC rule (opens in KiCad 7 or 8) |
| `source/` | The scripts that generated everything. `netlist.py` is the single source of truth |
| `../../firmware/` | MeshCore patch: `Xiao_nrf52_companion_radio_uart` env (companion protocol on D6/D7) |
| `renders/` | Top and bottom copper renders |
## Ordering (JLCPCB)
- PCB: 2 layers, **1.6 mm**, 1 oz, any color. **ENIG recommended** (flat pads for the 0.65 mm TSSOP, SC-70 parts and the straddle connector); lead-free HASL works too.
- Board is 50.43 x 75.15 mm. The bottom 50.47 mm is the in-slot section, using springSD's exact outline. The top 24.6 mm sticks out of the Visor and carries the XIAO stack.
- Assembly: top side, Economic PCBA is fine. Upload BOM + CPL. **Check part rotations in JLC's placement preview** before paying, especially U1-U7, Y1 and D1; KiCad and JLC disagree on rotation for some SOT/SC-70 footprints. Pin 1 of each IC is marked on the silkscreen and assembly drawing.
- Extended parts: SC16IS740 (C407851), 74LVC1G80 (C353857), crystal (C6264361) and probably the SN74LVC1T45 (C9382) and 74LVC1G04 (C10237). Expect extended-part loading fees.
## Parts you fit by hand
1. **J1 Springboard connector**: Hirose **IC1HA-68RD-1.27SH(51)** (DigiKey HR1187-ND), the PC-Card-style straddle receptacle springSD uses. It clamps the board edge; pins 1-34 land on the top pads, 35-68 on the bottom. Dmitry also sourced keyless 2x34 1.27 mm parts from LCSC (XKB X1321FV-2x34, C2881777); check that part's drawing before substituting. Pin 1 is marked on silk at the right-hand end of the top row.
2. **J2/J3**: two 1x7 2.54 mm female headers (low-profile if you can find them). Your XIAO+Wio stack plugs in here. You can also solder the stack's pins straight into the holes.
3. **JP1**: leave **open**. See VDOCK below.
## Mechanical / orientation
- The XIAO sits with **components facing up (same side as U1-U7) and USB-C at the outer edge**. Silkscreen labels (D0..D6, 5V, GND, 3V3, D10..D7) show which header pin goes where. **Check them against your stack before plugging in.** If your stack only exposes pins upside-down, the labels tell you it's mirrored.
- Solder your LiPo to the XIAO's BAT+/BAT- pads first. The carrier doesn't touch the battery; the XIAO's own charger handles it over USB-C.
- In-slot components are all 1.25 mm or shorter, on the top side only, which is lower than springSD's microSD socket. The bottom side inside the slot is a flat GND pour.
- **Assumption to verify:** like springSD, the top edge of the 50.47 mm section lines up with the slot opening, and the extension (with the stack and antenna) protrudes like a battery-module bump. Dry-fit a bare board before soldering anything.
## Electrical summary
- **Bus SPI** (same wiring as springSD, so its 68k routines port directly):
- A CS0* access latches A17 and A8 on its rising edge. Through Q-bar, `nCS = NOT A17` and `MOSI = NOT A8`.
- A CS1* read produces one SCLK pulse; MISO comes back on D0 through a 1k resistor.
- SC16IS740 is SPI mode 0. Register byte: bit7 = R/W (1 = read), bits 6:3 = register, bits 2:1 = channel 00.
- **UART**: 14.7456 MHz crystal, so 115200 baud with DLL=8, DLH=0 (prescaler 1). 64-byte TX/RX FIFOs. IRQ* goes straight to the Springboard IRQ* (the Visor has the pull-up). RESET* follows the slot RESET*.
- **Power isolation**: only U5-U7 (SN74LVC1T45) touch both domains, and both of their ports go Hi-Z when either supply is 0 V. Removing the module, a LOWBAT power cut, or a flat LiPo can't back-power the other side.
- **Visor-present**: XIAO D0 is high when the slot is powered. The firmware can stop pushing frames when it's low; the companion queues messages anyway.
- **Slot budget**: a few mA active, against the 100 mA limit. To stay inside the 100 uA standby limit, put the SC16IS740 to sleep (IER bit 4) when the Palm app is idle.
- **VDOCK (JP1)**: when bridged, VDOCK (4.75-6.2 V, only present in a charging dock) feeds the XIAO 5V pin through a Schottky so the XIAO charger can top up the LiPo while docked. The standard Visor USB cradle almost certainly doesn't supply VDOCK on an AAA Visor. **If you bridge JP1, never plug USB-C in while docked**, because VDOCK would back-feed the USB host.
## Bring-up order
1. Bare board, before soldering anything: check continuity of VSB (J1 pins 17/51) and GND, then dry-fit in the Visor slot.
2. After JLC assembly, fit J1 only. Bench-power VSB at 3.3 V through a current-limited supply. Expect a few mA, and the crystal at 14.7456 MHz on Y1.
3. Insert into the Visor with nothing on J2/J3. Port springSD's bus routines and read the SC16IS740 scratch register (SPR, reg 0x07): write and read back a pattern. That proves the CS0/CS1 latch path.
4. Flash the XIAO with `Xiao_nrf52_companion_radio_uart` (patch in `../../firmware/`). Bench-test it over a 3.3 V USB-TTL adapter on D6/D7 with meshcore-cli before plugging the stack into the carrier.
5. Plug in the stack. Configure the SC16IS740 for 115200 8N1, send CMD_DEVICE_QUERY (`<` + len + `0x16 0x03`), and look for a `>`-framed DEVICE_INFO reply.
## Known limits / things I could not verify from here
- Mechanical fit of the extension against the Visor body and the exact slot depth (see the assumption above).
- The J1 footprint is copied pad-for-pad from springSD v1.1 (verified against its IPC-356 netlist). I could not check it against the Hirose drawing.
- JLC part rotations (see Ordering).
- There is no `.kicad_sch`: the schematic is generated from `source/netlist.py` as a PDF, and the board's nets come from the same file. To regenerate on a machine with KiCad 7, Java and Freerouting 2.1: `source/make.sh` (autoroutes), then `make_fab.py`, `verify.py`, `draw_schematic.py`. Routing is nondeterministic between runs.
+5
View File
@@ -0,0 +1,5 @@
Ref,Part,Notes
J1,Springboard 68p straddle,Hirose IC1HA-68RD-1.27SH(51) (DigiKey HR1187-ND); hand-solder
JP1,VDOCK EN,Open by default
J2,XIAO left 1x7,XIAO pins 1-7 (D0..D6); female socket or solder pins direct
J3,XIAO right 1x7,"XIAO pins 14-8 (VBUS,GND,3V3,D10,D9,D8,D7)"
1 Ref Part Notes
2 J1 Springboard 68p straddle Hirose IC1HA-68RD-1.27SH(51) (DigiKey HR1187-ND); hand-solder
3 JP1 VDOCK EN Open by default
4 J2 XIAO left 1x7 XIAO pins 1-7 (D0..D6); female socket or solder pins direct
5 J3 XIAO right 1x7 XIAO pins 14-8 (VBUS,GND,3V3,D10,D9,D8,D7)
Binary file not shown.
@@ -0,0 +1,12 @@
Comment,Designator,Footprint,LCSC Part #
1uF,"C1,C14",C_0603_1608Metric,C15849
100nF,"C2,C3,C4,C5,C8,C9,C10,C11,C12,C13",C_0603_1608Metric,C14663
22pF C0G,"C6,C7",C_0805_2012Metric,C24658
B5819W,D1,D_SOD-123,C8598
1k,R1,R_0603_1608Metric,C21190
100k,"R2,R3,R4",R_0603_1608Metric,C25803
74LVC1G80GW,"U1,U2",SOT-353_SC-70-5,C353857
74LVC1G04GW,U3,SOT-353_SC-70-5,C10237
SC16IS740IPW,U4,TSSOP-16_4.4x5mm_P0.65mm,C407851
SN74LVC1T45DCKR,"U5,U6,U7",SOT-363_SC-70-6,C9382
14.7456MHz 13pF,Y1,Crystal_SMD_3225-4Pin_3.2x2.5mm,C6264361
1 Comment Designator Footprint LCSC Part #
2 1uF C1,C14 C_0603_1608Metric C15849
3 100nF C2,C3,C4,C5,C8,C9,C10,C11,C12,C13 C_0603_1608Metric C14663
4 22pF C0G C6,C7 C_0805_2012Metric C24658
5 B5819W D1 D_SOD-123 C8598
6 1k R1 R_0603_1608Metric C21190
7 100k R2,R3,R4 R_0603_1608Metric C25803
8 74LVC1G80GW U1,U2 SOT-353_SC-70-5 C353857
9 74LVC1G04GW U3 SOT-353_SC-70-5 C10237
10 SC16IS740IPW U4 TSSOP-16_4.4x5mm_P0.65mm C407851
11 SN74LVC1T45DCKR U5,U6,U7 SOT-363_SC-70-6 C9382
12 14.7456MHz 13pF Y1 Crystal_SMD_3225-4Pin_3.2x2.5mm C6264361
@@ -0,0 +1,28 @@
Designator,Mid X,Mid Y,Layer,Rotation
C1,100.000000mm,-116.500000mm,Top,90.000000
C2,107.000000mm,-110.500000mm,Top,0.000000
C3,112.000000mm,-110.500000mm,Top,0.000000
C4,117.000000mm,-110.500000mm,Top,0.000000
C5,95.500000mm,-96.500000mm,Top,90.000000
C6,108.000000mm,-97.000000mm,Top,0.000000
C7,108.000000mm,-106.000000mm,Top,0.000000
C8,90.500000mm,-80.000000mm,Top,90.000000
C9,95.500000mm,-80.000000mm,Top,90.000000
C10,97.500000mm,-80.000000mm,Top,90.000000
C11,102.500000mm,-80.000000mm,Top,90.000000
C12,104.500000mm,-80.000000mm,Top,90.000000
C13,109.500000mm,-80.000000mm,Top,90.000000
C14,113.000000mm,-62.000000mm,Top,90.000000
D1,92.500000mm,-116.000000mm,Top,90.000000
R1,89.000000mm,-112.000000mm,Top,90.000000
R2,89.000000mm,-70.500000mm,Top,90.000000
R3,100.000000mm,-89.000000mm,Top,90.000000
R4,85.000000mm,-52.500000mm,Top,90.000000
U1,107.000000mm,-113.500000mm,Top,0.000000
U2,112.000000mm,-113.500000mm,Top,0.000000
U3,117.000000mm,-113.500000mm,Top,0.000000
U4,100.000000mm,-101.000000mm,Top,0.000000
U5,93.000000mm,-83.000000mm,Top,0.000000
U6,100.000000mm,-83.000000mm,Top,0.000000
U7,107.000000mm,-83.000000mm,Top,0.000000
Y1,108.000000mm,-101.500000mm,Top,90.000000
1 Designator Mid X Mid Y Layer Rotation
2 C1 100.000000mm -116.500000mm Top 90.000000
3 C2 107.000000mm -110.500000mm Top 0.000000
4 C3 112.000000mm -110.500000mm Top 0.000000
5 C4 117.000000mm -110.500000mm Top 0.000000
6 C5 95.500000mm -96.500000mm Top 90.000000
7 C6 108.000000mm -97.000000mm Top 0.000000
8 C7 108.000000mm -106.000000mm Top 0.000000
9 C8 90.500000mm -80.000000mm Top 90.000000
10 C9 95.500000mm -80.000000mm Top 90.000000
11 C10 97.500000mm -80.000000mm Top 90.000000
12 C11 102.500000mm -80.000000mm Top 90.000000
13 C12 104.500000mm -80.000000mm Top 90.000000
14 C13 109.500000mm -80.000000mm Top 90.000000
15 C14 113.000000mm -62.000000mm Top 90.000000
16 D1 92.500000mm -116.000000mm Top 90.000000
17 R1 89.000000mm -112.000000mm Top 90.000000
18 R2 89.000000mm -70.500000mm Top 90.000000
19 R3 100.000000mm -89.000000mm Top 90.000000
20 R4 85.000000mm -52.500000mm Top 90.000000
21 U1 107.000000mm -113.500000mm Top 0.000000
22 U2 112.000000mm -113.500000mm Top 0.000000
23 U3 117.000000mm -113.500000mm Top 0.000000
24 U4 100.000000mm -101.000000mm Top 0.000000
25 U5 93.000000mm -83.000000mm Top 0.000000
26 U6 100.000000mm -83.000000mm Top 0.000000
27 U7 107.000000mm -83.000000mm Top 0.000000
28 Y1 108.000000mm -101.500000mm Top 90.000000
Binary file not shown.
Binary file not shown.
+103
View File
@@ -0,0 +1,103 @@
** Drc report for visormesh.kicad_pcb **
** Created on 2026-10-30 12:38:55 **
** Found 31 DRC violations **
[lib_footprint_issues]: The current configuration does not include the library 'Package_SO'.
Local override; Severity: warning
@(100.0000 mm, 101.0000 mm): Footprint U4
[lib_footprint_issues]: The current configuration does not include the library 'Resistor_SMD'.
Local override; Severity: warning
@(85.0000 mm, 52.5000 mm): Footprint R4
[lib_footprint_issues]: The current configuration does not include the library 'Connector_PinSocket_2.54mm'.
Local override; Severity: warning
@(92.3800 mm, 51.9482 mm): Footprint J2
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(113.0000 mm, 62.0000 mm): Footprint C14
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(100.0000 mm, 116.5000 mm): Footprint C1
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(104.5000 mm, 80.0000 mm): Footprint C12
[lib_footprint_issues]: The current configuration does not include the library 'Connector_PinSocket_2.54mm'.
Local override; Severity: warning
@(107.6200 mm, 51.9482 mm): Footprint J3
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(107.0000 mm, 113.5000 mm): Footprint U1
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(112.0000 mm, 113.5000 mm): Footprint U2
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(95.5000 mm, 96.5000 mm): Footprint C5
[lib_footprint_issues]: The current configuration does not include the library 'Resistor_SMD'.
Local override; Severity: warning
@(100.0000 mm, 89.0000 mm): Footprint R3
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(117.0000 mm, 113.5000 mm): Footprint U3
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(97.5000 mm, 80.0000 mm): Footprint C10
[lib_footprint_issues]: The current configuration does not include the library 'Crystal'.
Local override; Severity: warning
@(108.0000 mm, 101.5000 mm): Footprint Y1
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(112.0000 mm, 110.5000 mm): Footprint C3
[lib_footprint_issues]: The current configuration does not include the library 'Resistor_SMD'.
Local override; Severity: warning
@(89.0000 mm, 70.5000 mm): Footprint R2
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(95.5000 mm, 80.0000 mm): Footprint C9
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(100.0000 mm, 83.0000 mm): Footprint U6
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(93.0000 mm, 83.0000 mm): Footprint U5
[lib_footprint_issues]: The current configuration does not include the library 'Diode_SMD'.
Local override; Severity: warning
@(92.5000 mm, 116.0000 mm): Footprint D1
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(102.5000 mm, 80.0000 mm): Footprint C11
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(108.0000 mm, 106.0000 mm): Footprint C7
[lib_footprint_issues]: The current configuration does not include the library 'Resistor_SMD'.
Local override; Severity: warning
@(89.0000 mm, 112.0000 mm): Footprint R1
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(117.0000 mm, 110.5000 mm): Footprint C4
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(90.5000 mm, 80.0000 mm): Footprint C8
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(107.0000 mm, 110.5000 mm): Footprint C2
[lib_footprint_issues]: The current configuration does not include the library 'Jumper'.
Local override; Severity: warning
@(116.0000 mm, 54.0000 mm): Footprint JP1
[lib_footprint_issues]: The current configuration does not include the library 'Package_TO_SOT_SMD'.
Local override; Severity: warning
@(107.0000 mm, 83.0000 mm): Footprint U7
[lib_footprint_issues]: The current configuration does not include the library 'visormesh'.
Local override; Severity: warning
@(100.0000 mm, 122.6054 mm): Footprint J1
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(109.5000 mm, 80.0000 mm): Footprint C13
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(108.0000 mm, 97.0000 mm): Footprint C6
** Found 0 unconnected pads **
** Found 0 Footprint errors **
** End of Report **
@@ -0,0 +1,5 @@
(version 1)
# Springboard straddle-connector pads run to the board edge by design (connector clamps the edge).
(rule "J1 pads at edge"
(constraint edge_clearance (min 0mm))
(condition "A.Parent == 'J1'"))
File diff suppressed because it is too large. Load diff
+271
View File
@@ -0,0 +1,271 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {
"board_outline_line_width": 0.049999999999999996,
"copper_line_width": 0.19999999999999998,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": false,
"courtyard_line_width": 0.049999999999999996,
"dimension_precision": 4,
"dimension_units": 3,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": false,
"text_position": 0,
"units_format": 1
},
"fab_line_width": 0.09999999999999999,
"fab_text_italic": false,
"fab_text_size_h": 1.0,
"fab_text_size_v": 1.0,
"fab_text_thickness": 0.15,
"fab_text_upright": false,
"other_line_width": 0.09999999999999999,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": false,
"pads": {
"drill": 0.762,
"height": 1.524,
"width": 1.524
},
"silk_line_width": 0.09999999999999999,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.09999999999999999,
"silk_text_upright": false,
"zones": {
"min_clearance": 0.5
}
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"meta": {
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"connection_width": "warning",
"copper_edge_clearance": "error",
"copper_sliver": "warning",
"courtyards_overlap": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"footprint": "error",
"footprint_type_mismatch": "ignore",
"hole_clearance": "error",
"hole_near_hole": "error",
"invalid_outline": "error",
"isolated_copper": "warning",
"item_on_disabled_layer": "error",
"items_not_allowed": "error",
"length_out_of_range": "error",
"lib_footprint_issues": "warning",
"lib_footprint_mismatch": "warning",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "warning",
"pth_inside_courtyard": "ignore",
"shorting_items": "error",
"silk_edge_clearance": "warning",
"silk_over_copper": "warning",
"silk_overlap": "warning",
"skew_out_of_range": "error",
"solder_mask_bridge": "error",
"starved_thermal": "error",
"text_height": "warning",
"text_thickness": "warning",
"through_hole_pad_without_hole": "error",
"too_many_vias": "error",
"track_dangling": "warning",
"track_width": "error",
"tracks_crossing": "error",
"unconnected_items": "error",
"unresolved_variable": "error",
"via_dangling": "warning",
"zones_intersect": "error"
},
"rules": {
"max_error": 0.005,
"min_clearance": 0.15,
"min_connection": 0.0,
"min_copper_edge_clearance": 0.3,
"min_hole_clearance": 0.25,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.19999999999999998,
"min_microvia_drill": 0.09999999999999999,
"min_resolved_spokes": 2,
"min_silk_clearance": 0.0,
"min_text_height": 0.7999999999999999,
"min_text_thickness": 0.08,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.15,
"min_via_annular_width": 0.09999999999999999,
"min_via_diameter": 0.6,
"solder_mask_to_copper_clearance": 0.0,
"use_height_for_length_calcs": true
},
"teardrop_options": [
{
"td_allow_use_two_tracks": true,
"td_curve_segcount": 5,
"td_on_pad_in_zone": false,
"td_onpadsmd": true,
"td_onroundshapesonly": false,
"td_ontrackend": false,
"td_onviapad": true
}
],
"teardrop_parameters": [
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_round_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_rect_shape",
"td_width_to_size_filter_ratio": 0.9
},
{
"td_curve_segcount": 0,
"td_height_ratio": 1.0,
"td_length_ratio": 0.5,
"td_maxheight": 2.0,
"td_maxlen": 1.0,
"td_target_name": "td_track_end",
"td_width_to_size_filter_ratio": 0.9
}
],
"track_widths": [],
"via_dimensions": [],
"zones_allow_external_fillets": false
},
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "visormesh.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
},
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Power",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.4,
"via_diameter": 0.7,
"via_drill": 0.35,
"wire_width": 6
}
],
"meta": {
"version": 3
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": [
{
"netclass": "Power",
"pattern": "GND"
},
{
"netclass": "Power",
"pattern": "VSB"
},
{
"netclass": "Power",
"pattern": "3V3X"
},
{
"netclass": "Power",
"pattern": "VDOCK"
},
{
"netclass": "Power",
"pattern": "VDOCK_D"
},
{
"netclass": "Power",
"pattern": "XIAO_VBUS"
}
]
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"legacy_lib_dir": "",
"legacy_lib_list": []
},
"sheets": [],
"text_variables": {}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

+202
View File
@@ -0,0 +1,202 @@
#!/usr/bin/python3
"""Generate visormesh.kicad_pcb (unrouted) with KiCad 7's pcbnew API. Run with /usr/bin/python3."""
import sys, os
import pcbnew
sys.path.insert(0, os.path.dirname(__file__))
from netlist import PARTS, CONN, NETS, SB_NAMES, XIAO_NAMES
MM = pcbnew.FromMM
IN = 25.4
OX, OY = 100.0, 100.0 # springSD origin (inches, y-up) mapped to KiCad (mm, y-down)
def sb(x_in, y_in): # springSD coordinate -> KiCad mm
return OX + x_in * IN, OY - y_in * IN
def V(x, y):
return pcbnew.VECTOR2I(MM(x), MM(y))
FPLIB = "/usr/share/kicad/footprints"
OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(os.path.dirname(__file__), "visormesh.kicad_pcb")
board = pcbnew.BOARD()
board.SetCopperLayerCount(2)
ds = board.GetDesignSettings()
ds.SetBoardThickness(MM(1.6))
ds.m_TrackMinWidth = MM(0.15)
ds.m_MinClearance = MM(0.15)
ds.m_ViasMinSize = MM(0.6)
ds.m_MinThroughDrill = MM(0.3)
ds.m_CopperEdgeClearance = MM(0.3)
nc = ds.m_NetSettings.m_DefaultNetClass
nc.SetClearance(MM(0.2)); nc.SetTrackWidth(MM(0.2)); nc.SetViaDiameter(MM(0.6)); nc.SetViaDrill(MM(0.3))
pwr = pcbnew.NETCLASS("Power")
pwr.SetClearance(MM(0.2)); pwr.SetTrackWidth(MM(0.4)); pwr.SetViaDiameter(MM(0.7)); pwr.SetViaDrill(MM(0.35))
ds.m_NetSettings.m_NetClasses["Power"] = pwr
POWER_NETS = ("GND", "VSB", "3V3X", "VDOCK", "VDOCK_D", "XIAO_VBUS")
# ---------------- outline ----------------
X0, X1 = sb(-0.991, 0)[0], sb(0.994315, 0)[0]
Y_EDGE = sb(0, -0.926)[1] # connector edge (bottom)
Y_SLOT = sb(0, 1.060307)[1] # top of springSD outline = slot opening
EXT = 24.6 # extension beyond slot for the XIAO stack
Y_TOP = Y_SLOT - EXT
pts = [(X0, Y_TOP), (X1, Y_TOP), (X1, Y_EDGE), (X0, Y_EDGE)]
for i in range(4):
s = pcbnew.PCB_SHAPE(board); s.SetShape(pcbnew.SHAPE_T_SEGMENT)
s.SetStart(V(*pts[i])); s.SetEnd(V(*pts[(i + 1) % 4])); s.SetLayer(pcbnew.Edge_Cuts); s.SetWidth(MM(0.1))
board.Add(s)
# slot-opening reference line on both fab layers
for lyr in (pcbnew.F_Fab, pcbnew.B_Fab, pcbnew.F_SilkS):
s = pcbnew.PCB_SHAPE(board); s.SetShape(pcbnew.SHAPE_T_SEGMENT)
s.SetStart(V(X0 + 1, Y_SLOT)); s.SetEnd(V(X1 - 1, Y_SLOT)); s.SetLayer(lyr); s.SetWidth(MM(0.12))
board.Add(s)
# ---------------- nets ----------------
netinfo = {}
for n in NETS:
ni = pcbnew.NETINFO_ITEM(board, n); board.Add(ni); netinfo[n] = ni
if n in POWER_NETS:
ni.SetNetClass(pwr)
# ---------------- footprints ----------------
def text(fp, layer, s, x, y, size=0.8):
t = pcbnew.PCB_TEXT(fp) if hasattr(pcbnew, "PCB_TEXT") else pcbnew.FP_TEXT(fp)
return t
def springboard_fp():
fp = pcbnew.FOOTPRINT(board)
fp.SetFPID(pcbnew.LIB_ID("visormesh", "SPRINGBOARD_68_STRADDLE"))
fp.SetReference("J1"); fp.SetValue("Springboard 68p")
pad_len = 1.83 # from board edge inward; contact lands ~0.66 mm from edge
for n in range(1, 69):
top = n <= 34
k = (n - 1) if top else (n - 35)
x = (0.8 - k * 0.05) * IN # local to footprint origin (OX, Y_EDGE - pad_len/2)
y = 0.0
p = pcbnew.PAD(fp)
p.SetNumber(str(n)); p.SetShape(pcbnew.PAD_SHAPE_RECT); p.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
p.SetSize(V(0.7, pad_len))
ls = pcbnew.LSET()
if top:
ls.AddLayer(pcbnew.F_Cu); ls.AddLayer(pcbnew.F_Mask)
else:
ls.AddLayer(pcbnew.B_Cu); ls.AddLayer(pcbnew.B_Mask)
p.SetLayerSet(ls)
fp.Add(p)
p.SetPos0(V(x, y)) if hasattr(p, "SetPos0") else None
p.SetPosition(V(x, y))
fp.SetPosition(V(OX, Y_EDGE - pad_len / 2))
return fp
placed = {}
def load(ref):
val, lib, name, lcsc, desc, dnp = PARTS[ref]
if ref == "J1":
fp = springboard_fp()
else:
fp = pcbnew.FootprintLoad(os.path.join(FPLIB, lib + ".pretty"), name)
fp.SetFPID(pcbnew.LIB_ID(lib, name))
fp.SetReference(ref); fp.SetValue(val)
if lcsc:
fp.SetProperty("LCSC", lcsc)
board.Add(fp)
placed[ref] = fp
return fp
def place(ref, x, y, rot=0.0, back=False):
fp = placed.get(ref) or load(ref)
if ref != "J1":
fp.SetPosition(V(x, y))
fp.SetOrientationDegrees(rot)
if back:
fp.Flip(fp.GetPosition(), False)
return fp
# ---- placement (KiCad mm). Slot zone: Y_SLOT..Y_EDGE. Extension: Y_TOP..Y_SLOT ----
XC = OX
place("J1", 0, 0)
# Bus decode near the connector signals: CS0* pin7 (x=112.7), A8 pin12 (106.35), CS1* pin42 (111.43), A17 pin46 (106.35)
place("U1", 107.0, 113.5, 0) # A17 latch
place("U2", 112.0, 113.5, 0) # A8 latch
place("U3", 117.0, 113.5, 0) # CS1 inverter
place("C2", 107.0, 110.5, 0)
place("C3", 112.0, 110.5, 0)
place("C4", 117.0, 110.5, 0)
place("C1", 100.0, 116.5, 90) # VSB bulk at VCC pins 17/51
# Bridge
place("U4", 100.0, 101.0, 0)
place("C5", 95.5, 96.5, 90)
place("Y1", 108.0, 101.5, 90)
place("C6", 108.0, 97.0, 0)
place("C7", 108.0, 106.0, 0)
place("R1", 89.0, 112.0, 90) # D0 (pin30 @ x=83.49) -> SO
# Ioff translators near the slot opening
place("U5", 93.0, 83.0, 0)
place("U6", 100.0, 83.0, 0)
place("U7", 107.0, 83.0, 0)
place("C8", 90.5, 80.0, 90); place("C9", 95.5, 80.0, 90)
place("C10", 97.5, 80.0, 90); place("C11", 102.5, 80.0, 90)
place("C12", 104.5, 80.0, 90); place("C13", 109.5, 80.0, 90)
place("R3", 100.0, 89.0, 90) # bridge RX pull-up (VSB)
place("R2", 89.0, 70.5, 90) # XIAO RX pull-up (3V3X)
place("R4", 85.0, 52.5, 90) # VISOR_PRESENT pull-down
place("C14", 113.0, 62.0, 90) # 3V3X bulk next to XIAO 3V3
# VDOCK path
place("D1", 92.5, 116.0, 90)
place("JP1", 116.0, 54.0, 90)
# XIAO stack: centre (XC, YX), USB-C toward Y_TOP
YX = Y_SLOT - 3.0 - 10.5
place("J2", XC - 7.62, YX - 7.62, 0) # XIAO pins 1..7 top->bottom (left column, top view)
place("J3", XC + 7.62, YX - 7.62, 0) # XIAO pins 14..8 top->bottom (right column)
# ---------------- reference/value text ----------------
for ref, fp in placed.items():
fp.Value().SetVisible(False)
r = fp.Reference()
if ref in ("J2", "J3", "JP1"):
r.SetTextSize(V(0.8, 0.8)); r.SetTextThickness(MM(0.12))
else:
r.SetLayer(pcbnew.F_Fab) # refs live on the assembly drawing
r.SetTextSize(V(0.5, 0.5)); r.SetTextThickness(MM(0.08))
# U4 pin 8 (I2C/SPI select) sits between signal pins: solid-connect it to the pour
for p in placed["U4"].Pads():
if p.GetNumber() in ("8", "9", "6", "11"):
p.SetZoneConnection(pcbnew.ZONE_CONNECTION_FULL)
placed["J2"].Reference().SetPosition(V(XC - 7.62, YX + 7.62 + 2.6))
placed["J3"].Reference().SetPosition(V(XC + 7.62, YX + 7.62 + 2.6))
placed["JP1"].Reference().SetPosition(V(118.6, 54.0))
for p in placed["J1"].Pads():
if p.GetNumber() in ("1", "34", "35", "36", "67", "68"):
p.SetZoneConnection(pcbnew.ZONE_CONNECTION_FULL)
# ---------------- assign nets ----------------
for (ref, pad), net in CONN.items():
fp = placed[ref]
hit = [p for p in fp.Pads() if p.GetNumber() == pad]
assert hit, (ref, pad)
for p in hit:
p.SetNet(netinfo[net])
# ---------------- silkscreen / fab notes ----------------
def silk(s, x, y, size=0.8, layer=pcbnew.F_SilkS, mirror=False):
t = pcbnew.PCB_TEXT(board)
t.SetText(s); t.SetPosition(V(x, y)); t.SetLayer(layer)
t.SetTextSize(V(size, size)); t.SetTextThickness(MM(size * 0.15))
if mirror: t.SetMirrored(True)
board.Add(t)
return t
t = silk("VisorMesh SB-LoRa v0.1", 77.4, 96.0, 1.0); t.SetTextAngleDegrees(90)
silk("^ SLOT OPENING ^", 84.0, Y_SLOT + 1.3, 0.8)
silk("XIAO USB-C this edge, parts up", XC, Y_TOP + 1.0, 0.8)
silk("1", OX + 0.8 * IN, Y_EDGE - 2.6, 0.8)
silk("34", OX - 0.85 * IN, Y_EDGE - 2.6, 0.8)
silk("35", OX + 0.8 * IN, Y_EDGE - 2.6, 0.8, pcbnew.B_SilkS, True)
silk("68", OX - 0.85 * IN, Y_EDGE - 2.6, 0.8, pcbnew.B_SilkS, True)
for k in range(1, 8):
silk(XIAO_NAMES[k], XC - 7.62 - 2.9, YX - 7.62 + (k - 1) * 2.54, 0.8)
silk(XIAO_NAMES[15 - k], XC + 7.62 + 3.0, YX - 7.62 + (k - 1) * 2.54, 0.8)
silk("VDOCK>5V", 121.0, 60.5, 0.8)
silk("keep open", 121.0, 61.7, 0.8)
board.Save(OUT)
print("saved", OUT, "slot", round(Y_SLOT, 3), "top", round(Y_TOP, 3), "edge", round(Y_EDGE, 3),
"x", round(X0, 3), round(X1, 3))
+138
View File
@@ -0,0 +1,138 @@
#!/usr/bin/env python3
"""Net-label schematic (PDF) generated from netlist.py: every pin shows its number, function and net."""
import sys, os
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch, Rectangle
from matplotlib.backends.backend_pdf import PdfPages
sys.path.insert(0, os.path.dirname(__file__))
from netlist import CONN, PARTS, SB_NAMES, XIAO_NAMES
PIN = {
"U1": {1: "D", 2: "CP", 3: "GND", 4: "Q̅", 5: "VCC"},
"U2": {1: "D", 2: "CP", 3: "GND", 4: "Q̅", 5: "VCC"},
"U3": {1: "NC", 2: "A", 3: "GND", 4: "Y", 5: "VCC"},
"U4": {1: "VDD", 2: "CS*", 3: "SI", 4: "SO", 5: "SCLK", 6: "SDA", 7: "IRQ*", 8: "I2C/SPI*",
9: "VSS", 10: "RTS*", 11: "CTS*", 12: "TX", 13: "RX", 14: "RESET*", 15: "XTAL1", 16: "XTAL2"},
"U5": {1: "VCCA", 2: "GND", 3: "A", 4: "B", 5: "DIR", 6: "VCCB"},
"U6": {1: "VCCA", 2: "GND", 3: "A", 4: "B", 5: "DIR", 6: "VCCB"},
"U7": {1: "VCCA", 2: "GND", 3: "A", 4: "B", 5: "DIR", 6: "VCCB"},
"Y1": {1: "X1", 2: "GND", 3: "X2", 4: "GND"},
"D1": {1: "K", 2: "A"}, "JP1": {1: "1", 2: "2"},
}
DOM = {"VSB": "#2b6cb0", "3V3X": "#b7791f"}
def pins_of(ref):
return sorted({int(p) for (r, p) in CONN if r == ref} | set(PIN.get(ref, {}).keys()))
def block(ax, x, y, ref, title, pins, names, w=5.2, color="#333", desc=True):
h = 0.42 * len(pins) + 0.9
ax.add_patch(FancyBboxPatch((x, y - h), w, h, boxstyle="round,pad=0.02", fc="#fbfbfb", ec=color, lw=1.2))
ax.text(x + 0.15, y - 0.35, f"{ref} {title}", fontsize=8.5, weight="bold", va="center")
ax.text(x + 0.15, y - 0.68, (PARTS[ref][4] if (ref in PARTS and desc) else "")[:58], fontsize=5.6, color="#666", va="center")
for i, p in enumerate(pins):
yy = y - 1.0 - i * 0.42
net = CONN.get((ref, str(p)), "")
ax.text(x + 0.2, yy, f"{p:>2}", fontsize=7, family="monospace", va="center")
ax.text(x + 0.75, yy, names.get(p, ""), fontsize=7, va="center")
col = DOM.get(net, "#c53030" if net else "#999")
if net in ("GND",): col = "#222"
ax.plot([x + w, x + w + 0.35], [yy, yy], color="#555", lw=0.8)
ax.text(x + w + 0.45, yy, net if net else "nc", fontsize=7, va="center", color=col,
weight="bold" if net else "normal")
return h
def page1(pdf):
fig, ax = plt.subplots(figsize=(16.5, 11.7)); ax.set_xlim(0, 48); ax.set_ylim(0, 34); ax.axis("off")
ax.text(0.5, 33.2, "VisorMesh SB-LoRa v0.1 - Springboard MeshCore companion module", fontsize=14, weight="bold")
ax.text(0.5, 32.5, "Net-label schematic: pins with the same net name are connected. Blue = Springboard VCC domain (VSB), "
"amber = XIAO 3V3 domain (3V3X).", fontsize=8.5, color="#444")
# J1 two columns
names = {p: SB_NAMES[p] for p in range(1, 69)}
block(ax, 0.5, 31.5, "J1", "pins 1-34 (top)", list(range(1, 35)), names, w=4.2, desc=False)
block(ax, 7.2, 31.5, "J1", "pins 35-68 (bottom)", list(range(35, 69)), names, w=4.2, desc=False)
ax.text(0.5, 31.75, "J1 Springboard 68p straddle: Hirose IC1HA-68RD-1.27SH(51), hand-solder", fontsize=7.5, color="#444")
x = 15.0
for ref, title in (("U1", "74LVC1G80GW"), ("U2", "74LVC1G80GW"), ("U3", "74LVC1G04GW")):
pass
y = 31.5
for ref, title in (("U1", "74LVC1G80GW"), ("U2", "74LVC1G80GW"), ("U3", "74LVC1G04GW")):
h = block(ax, x, y, ref, title, pins_of(ref), PIN[ref], w=4.0); y -= h + 0.6
block(ax, x, y, "R1", "1k", [1, 2], {1: "", 2: ""}, w=4.0)
x2 = 22.4
h = block(ax, x2, 31.5, "U4", "SC16IS740IPW", pins_of("U4"), PIN["U4"], w=4.6)
y = 31.5 - h - 0.6
h = block(ax, x2, y, "Y1", "14.7456 MHz", pins_of("Y1"), PIN["Y1"], w=4.6); y -= h + 0.6
for ref in ("C6", "C7"):
h = block(ax, x2, y, ref, PARTS[ref][0], [1, 2], {}, w=4.6); y -= h + 0.4
x3 = 31.0; y = 31.5
for ref in ("U5", "U6", "U7"):
h = block(ax, x3, y, ref, "SN74LVC1T45", pins_of(ref), PIN[ref], w=4.4); y -= h + 0.5
x4 = 39.6; y = 31.5
xn = {k: XIAO_NAMES[k] for k in range(1, 8)}
h = block(ax, x4, y, "J2", "XIAO left (pins 1-7)", list(range(1, 8)), xn, w=4.4); y -= h + 0.5
xr = {k: XIAO_NAMES[15 - k] for k in range(1, 8)}
h = block(ax, x4, y, "J3", "XIAO right (pins 14-8)", list(range(1, 8)), xr, w=4.4); y -= h + 0.5
h = block(ax, x4, y, "D1", "B5819W", [1, 2], PIN["D1"], w=4.4); y -= h + 0.4
h = block(ax, x4, y, "JP1", "solder jumper", [1, 2], PIN["JP1"], w=4.4); y -= h + 0.4
# passives summary
rows = []
for ref in sorted(PARTS, key=lambda r: (r[0], int("".join(c for c in r if c.isdigit()) or 0))):
if ref[0] in "RC" and ref not in ("C6", "C7", "R1"):
rows.append(f"{ref:<4} {PARTS[ref][0]:<6} {CONN.get((ref,'1'),''):<14} - {CONN.get((ref,'2'),''):<10} {PARTS[ref][4]}")
ax.text(14.2, 8.6, "Passives", fontsize=8.5, weight="bold")
for i, r in enumerate(rows):
ax.text(14.2, 8.0 - i * 0.42, r, fontsize=6.6, family="monospace")
pdf.savefig(fig); plt.close(fig)
def page2(pdf):
fig, ax = plt.subplots(figsize=(16.5, 11.7)); ax.set_xlim(0, 48); ax.set_ylim(0, 34); ax.axis("off")
ax.text(0.5, 33.2, "Theory of operation", fontsize=14, weight="bold")
def box(x, y, w, h, t, fc):
ax.add_patch(Rectangle((x, y), w, h, fc=fc, ec="#333", lw=1.2)); ax.text(x + w / 2, y + h / 2, t, ha="center", va="center", fontsize=9)
def arrow(x0, y0, x1, y1, t=""):
ax.annotate("", (x1, y1), (x0, y0), arrowprops=dict(arrowstyle="->", lw=1.2))
if t: ax.text((x0 + x1) / 2, (y0 + y1) / 2 + 0.35, t, ha="center", fontsize=7.5)
ax.add_patch(Rectangle((8.5, 18), 18, 12, fc="#ebf4ff", ec="#2b6cb0", lw=1, ls="--"))
ax.text(9, 29.4, "VSB domain (Springboard VCC, off when Visor removes slot power)", fontsize=8, color="#2b6cb0")
ax.add_patch(Rectangle((29, 18), 16.5, 12, fc="#fff8e6", ec="#b7791f", lw=1, ls="--"))
ax.text(29.5, 29.4, "3V3X domain (XIAO + LiPo, always on)", fontsize=8, color="#b7791f")
box(0.5, 22, 6, 4, "Visor\nSpringboard bus\nCS0* CS1* A17 A8\nD0 IRQ* RESET*", "#eee")
box(10, 25, 5, 2.4, "U1/U2 latch\nA17->nCS A8->MOSI\non CS0* rise", "#fff")
box(10, 21.2, 5, 2.4, "U3 inverter\nCS1* -> SCLK", "#fff")
box(18.5, 21.5, 6, 5.5, "U4 SC16IS740\nSPI mode 0\n64B FIFOs\n115200 8N1\n(14.7456 MHz)", "#fff")
box(26.2, 23, 4.4, 3, "U5/U6/U7\nLVC1T45\nIoff both ports", "#fff")
box(33, 21.5, 6, 5.5, "XIAO nRF52840\nMeshCore companion\n(UART on D6/D7)", "#fff")
box(41, 22.5, 4, 3.5, "Wio-SX1262\nLoRa", "#fff")
arrow(6.5, 25.5, 10, 26.2, "CS0*,A17,A8"); arrow(6.5, 23, 10, 22.4, "CS1*")
arrow(15, 26.2, 18.5, 25.5, "nCS, MOSI"); arrow(15, 22.4, 18.5, 23, "SCLK")
ax.annotate("", (3.5, 22), (21.5, 21.5), arrowprops=dict(arrowstyle="->", lw=1.2, connectionstyle="angle,angleA=-90,angleB=0,rad=0")) if False else None
ax.plot([21.5, 21.5, 3.5], [21.5, 19.6, 19.6], color="black", lw=1.2); ax.annotate("", (3.5, 22), (3.5, 19.6), arrowprops=dict(arrowstyle="->", lw=1.2))
ax.text(12.5, 19.0, "SO -> R1 1k -> D0 (sampled during each CS1* read)", ha="center", fontsize=7.5)
arrow(24.5, 25, 26.2, 25, "TX/RX"); arrow(30.6, 25, 33, 25, "D7/D6")
arrow(39, 24.2, 41, 24.2, "SPI")
notes = [
"Bus protocol (identical address bits to springSD, so its 68k SPI routines carry over):",
" - Any CS0* access latches A17 and A8 on the rising edge of CS0*. U1/U2 are Q-bar outputs, so nCS = NOT A17 and MOSI = NOT A8.",
" To assert chip select, touch csSlot0 with A17=1; to send bit b, touch csSlot0 with A8 = NOT b (A17 kept at 1).",
" - Any CS1* read produces one SCLK pulse (high while CS1* is low). The SC16IS740 samples SI on the rising edge (SPI mode 0)",
" and shifts SO on the falling edge; read bit 0 of the 16-bit word returned by the CS1* access to get MISO.",
" - SC16IS740 register byte: bit7 R/W (1=read), bits6:3 register address, bits2:1 channel (00), bit0 unused.",
" - SC16IS740 IRQ* is open-drain straight onto Springboard IRQ* (the Visor provides the pull-up). RESET* follows the slot RESET*.",
"Power-domain rules:",
" - Only U5-U7 touch both domains. SN74LVC1T45 ports go high-impedance when either VCC is 0 V, so pulling the module, a Visor",
" sleep/LOWBAT power cut, or a flat LiPo never back-powers the other side. R2/R3 keep both UART RX lines idle-high.",
" - U7 reports slot power to XIAO D0 (VISOR_PRESENT, high = Visor powering the slot). Firmware can gate UART output on it.",
" - Springboard VCC load: U1-U4 + VCCA of U5-U7, a few mA active, under 100 mA. Put the SC16IS740 in sleep (IER[4]) when idle",
" to stay inside the 100 uA standby budget.",
" - JP1 (default open) routes VDOCK (4.75-6.2 V, dock only) through D1 into the XIAO 5V pin so the XIAO charger can top up the",
" LiPo in a charging dock. Do NOT bridge JP1 if you will ever plug USB-C in while docked: VDOCK would back-feed the USB host.",
]
for i, n in enumerate(notes):
ax.text(0.5, 16.0 - i * 0.62, n, fontsize=8.2, family="monospace" if n.startswith(" ") else None)
pdf.savefig(fig); plt.close(fig)
with PdfPages(sys.argv[1]) as pdf:
page1(pdf); page2(pdf)
print("ok")
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/python3
"""Import Freerouting session, add GND pours, fill, save, and write custom DRC rules."""
import sys, pcbnew
MM = pcbnew.FromMM
pcb = sys.argv[1]; ses = sys.argv[2]
b = pcbnew.LoadBoard(pcb)
import re
def sexp(txt):
toks = re.findall(r'\(|\)|"[^"]*"|[^\s()]+', txt)
st = [[]]
for t in toks:
if t == "(": st.append([])
elif t == ")": e = st.pop(); st[-1].append(e)
else: st[-1].append(t.strip('"'))
return st[0][0]
S = sexp(open(ses).read())
def find(node, key):
return [c for c in node if isinstance(c, list) and c and c[0] == key]
routes = find(S, "routes")[0]
res = float(find(routes, "resolution")[0][2]) # units per um
k = 1.0 / (res * 1000.0) # -> mm
NM = lambda v: int(round(float(v) * 1000.0 / res)) # session units -> KiCad nm, exact
for remove in [t for t in b.GetTracks()]:
b.Remove(remove)
ntr = nvia = 0
for net in find(find(routes, "network_out")[0], "net"):
ni = b.FindNet(net[1])
for w in find(net, "wire"):
path = find(w, "path")[0]
layer = b.GetLayerID(path[1]); width = float(path[2]) * k
xy = path[3:]
pts = [(NM(xy[i]), -NM(xy[i + 1])) for i in range(0, len(xy), 2)]
for (ax, ay), (bx, by) in zip(pts, pts[1:]):
t = pcbnew.PCB_TRACK(b); t.SetLayer(layer); t.SetWidth(MM(width)); t.SetNet(ni)
t.SetStart(pcbnew.VECTOR2I(ax, ay)); t.SetEnd(pcbnew.VECTOR2I(bx, by))
b.Add(t); ntr += 1
for v in find(net, "via"):
m = re.search(r'_(\d+):(\d+)_um', v[1]); dia, drl = int(m.group(1)) / 1000, int(m.group(2)) / 1000
via = pcbnew.PCB_VIA(b); via.SetNet(ni)
via.SetPosition(pcbnew.VECTOR2I(NM(v[2]), -NM(v[3])))
via.SetWidth(MM(dia)); via.SetDrill(MM(drl)); via.SetLayerPair(pcbnew.F_Cu, pcbnew.B_Cu)
b.Add(via); nvia += 1
print("imported", ntr, "segments", nvia, "vias")
gnd = b.FindNet("GND")
bb = b.GetBoardEdgesBoundingBox()
x0, y0, x1, y1 = bb.GetX(), bb.GetY(), bb.GetRight(), bb.GetBottom()
for layer in (pcbnew.F_Cu, pcbnew.B_Cu):
z = pcbnew.ZONE(b); z.SetLayer(layer); z.SetNet(gnd)
ol = z.Outline(); ol.NewOutline()
for x, y in ((x0, y0), (x1, y0), (x1, y1), (x0, y1)):
ol.Append(x, y)
z.SetLocalClearance(MM(0.25)); z.SetMinThickness(MM(0.2))
z.SetPadConnection(pcbnew.ZONE_CONNECTION_THT_THERMAL)
z.SetThermalReliefGap(MM(0.3)); z.SetThermalReliefSpokeWidth(MM(0.3))
z.SetIsFilled(False)
b.Add(z)
# drop dangling stubs / orphan vias left by the router
def ends(t): return (t.GetStart(), t.GetEnd())
def key(t):
a, c = t.GetStart(), t.GetEnd()
a, c = sorted([(a.x, a.y), (c.x, c.y)])
return (t.GetLayer(), t.GetNetname(), a, c)
seen = set()
for t in [t for t in b.GetTracks() if t.Type() == pcbnew.PCB_TRACE_T]:
if key(t) in seen or t.GetStart() == t.GetEnd():
b.Remove(t)
else:
seen.add(key(t))
for _ in range(10):
tracks = [t for t in b.GetTracks() if t.Type() == pcbnew.PCB_TRACE_T]
vias = [t for t in b.GetTracks() if t.Type() == pcbnew.PCB_VIA_T]
removed = 0
for t in list(tracks):
if t.GetNetname() == "GND":
continue
for pt in ends(t):
touch = any(o is not t and o.GetLayer() == t.GetLayer() and pt in ends(o) for o in tracks)
touch = touch or any(v.GetPosition() == pt for v in vias)
touch = touch or any(p.HitTest(pt) and p.IsOnLayer(t.GetLayer()) for p in b.GetPads())
if not touch:
b.Remove(t); removed += 1; break
for v in list(vias):
n = sum(1 for t in b.GetTracks() if t.Type() == pcbnew.PCB_TRACE_T and v.GetPosition() in ends(t))
if n == 0:
b.Remove(v); removed += 1
if not removed: break
pcbnew.ZONE_FILLER(b).Fill(b.Zones())
b.Save(pcb)
print("tracks", len(b.GetTracks()), "zones", len(b.Zones()))
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Full pipeline: place -> autoroute -> import -> pour -> DRC
set -e
cd "$(dirname "$0")"
/usr/bin/python3 build_board.py visormesh.kicad_pcb
python3 set_project.py visormesh.kicad_pro
cp visormesh.kicad_pcb visormesh_unrouted.kicad_pcb
/usr/bin/python3 -c "import pcbnew; b=pcbnew.LoadBoard('visormesh.kicad_pcb'); pcbnew.ExportSpecctraDSN(b,'visormesh.dsn')"
java -jar ${FREEROUTING:-/home/claude/tools/freerouting.jar} -de visormesh.dsn -do visormesh.ses -mp 30 -host-mode cli >freerouting.log 2>&1
/usr/bin/python3 finish_board.py visormesh.kicad_pcb visormesh.ses
/usr/bin/python3 run_drc.py visormesh.kicad_pcb drc.rpt
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""Build the JLCPCB/PCBWay package: gerbers+drill zip, BOM and CPL in JLC format."""
import csv, os, subprocess, sys, zipfile, shutil
sys.path.insert(0, os.path.dirname(__file__))
from netlist import PARTS
HERE = os.path.dirname(os.path.abspath(__file__))
OUT = sys.argv[1]
PCB = os.path.join(HERE, "visormesh.kicad_pcb")
G = os.path.join(OUT, "gerbers")
shutil.rmtree(G, ignore_errors=True); os.makedirs(G)
layers = "F.Cu,B.Cu,F.Paste,B.Paste,F.SilkS,B.SilkS,F.Mask,B.Mask,Edge.Cuts"
subprocess.run(["kicad-cli", "pcb", "export", "gerbers", "-l", layers, "--subtract-soldermask",
"--no-x2", "-o", G + "/", PCB], check=True, capture_output=True)
subprocess.run(["kicad-cli", "pcb", "export", "drill", "--format", "excellon", "--excellon-units", "mm",
"--excellon-zeros-format", "decimal", "--generate-map", "--map-format", "gerberx2",
"-o", G + "/", PCB], check=True, capture_output=True)
zp = os.path.join(OUT, "visormesh_gerbers_jlcpcb.zip")
with zipfile.ZipFile(zp, "w", zipfile.ZIP_DEFLATED) as z:
for f in sorted(os.listdir(G)):
z.write(os.path.join(G, f), f)
# Placement
pos = os.path.join(OUT, "pos_raw.csv")
subprocess.run(["kicad-cli", "pcb", "export", "pos", "--format", "csv", "--units", "mm", "--side", "both",
"--smd-only", "-o", pos, PCB], check=True, capture_output=True)
rows = list(csv.DictReader(open(pos)))
assembled = {r for r, p in PARTS.items() if p[3] and not p[5]} # has LCSC and not DNP
with open(os.path.join(OUT, "visormesh_cpl_jlcpcb.csv"), "w", newline="") as f:
w = csv.writer(f); w.writerow(["Designator", "Mid X", "Mid Y", "Layer", "Rotation"])
for r in rows:
if r["Ref"] in assembled:
w.writerow([r["Ref"], r["PosX"] + "mm", r["PosY"] + "mm",
"Top" if r["Side"] == "top" else "Bottom", r["Rot"]])
os.remove(pos)
# BOM grouped by value+footprint+LCSC
groups = {}
for ref, (val, lib, name, lcsc, desc, dnp) in PARTS.items():
if ref in assembled:
groups.setdefault((val, name, lcsc), []).append(ref)
def refkey(r):
import re
m = re.match(r"([A-Z]+)(\d+)", r); return (m.group(1), int(m.group(2)))
with open(os.path.join(OUT, "visormesh_bom_jlcpcb.csv"), "w", newline="") as f:
w = csv.writer(f); w.writerow(["Comment", "Designator", "Footprint", "LCSC Part #"])
for (val, name, lcsc), refs in sorted(groups.items(), key=lambda kv: refkey(sorted(kv[1], key=refkey)[0])):
w.writerow([val, ",".join(sorted(refs, key=refkey)), name, lcsc])
# Hand-fit parts
with open(os.path.join(OUT, "hand_fit_parts.csv"), "w", newline="") as f:
w = csv.writer(f); w.writerow(["Ref", "Part", "Notes"])
for ref, (val, lib, name, lcsc, desc, dnp) in PARTS.items():
if ref not in assembled:
w.writerow([ref, val, desc])
print("ok", sorted(os.listdir(G)))
+122
View File
@@ -0,0 +1,122 @@
"""
VisorMesh Springboard module: single source of truth for parts and connectivity.
Used by build_board.py (PCB), make_bom.py (JLC BOM/CPL) and draw_schematic.py (PDF schematic).
Power domains
VSB : Springboard VCC (3.0-3.6 V, 100 mA max), present only while the Visor powers the slot.
3V3X : XIAO nRF52840 3V3 output, always on (XIAO runs from its own LiPo).
Every signal that crosses VSB <-> 3V3X goes through an SN74LVC1T45 (Ioff on both ports),
so neither domain can back-power the other.
Bus SPI (copied from Dmitry Grinberg's springSD, same address bits so its driver logic carries over):
CS0* access latches A17 -> nCS and A8 -> MOSI (74LVC1G80, Q-bar output, rising edge of CS0*)
CS1* access produces one SCLK pulse (74LVC1G04 inverts CS1*); MISO is read on D0 through 1k.
"""
# ref: (value, footprint_lib, footprint_name, lcsc, description, dnp)
PARTS = {
"J1": ("Springboard 68p straddle", None, "SPRINGBOARD_68", "",
"Hirose IC1HA-68RD-1.27SH(51) (DigiKey HR1187-ND); hand-solder", True),
"U1": ("74LVC1G80GW", "Package_TO_SOT_SMD", "SOT-353_SC-70-5", "C353857", "D-FF, Q-bar: A17 -> nCS", False),
"U2": ("74LVC1G80GW", "Package_TO_SOT_SMD", "SOT-353_SC-70-5", "C353857", "D-FF, Q-bar: A8 -> MOSI", False),
"U3": ("74LVC1G04GW", "Package_TO_SOT_SMD", "SOT-353_SC-70-5", "C10237", "Inverter: CS1* -> SCLK", False),
"U4": ("SC16IS740IPW", "Package_SO", "TSSOP-16_4.4x5mm_P0.65mm", "C407851", "SPI-to-UART bridge, 64B FIFOs", False),
"U5": ("SN74LVC1T45DCKR", "Package_TO_SOT_SMD", "SOT-363_SC-70-6", "C9382", "Ioff xlate: bridge TX -> XIAO D7", False),
"U6": ("SN74LVC1T45DCKR", "Package_TO_SOT_SMD", "SOT-363_SC-70-6", "C9382", "Ioff xlate: XIAO D6 -> bridge RX", False),
"U7": ("SN74LVC1T45DCKR", "Package_TO_SOT_SMD", "SOT-363_SC-70-6", "C9382", "Ioff xlate: Visor-present -> XIAO D0", False),
"Y1": ("14.7456MHz 13pF", "Crystal", "Crystal_SMD_3225-4Pin_3.2x2.5mm", "C6264361", "SXT32413BA07-14.7456M", False),
"C1": ("1uF", "Capacitor_SMD", "C_0603_1608Metric", "C15849", "VSB bulk", False),
"C2": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U1 decoupling", False),
"C3": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U2 decoupling", False),
"C4": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U3 decoupling", False),
"C5": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U4 decoupling", False),
"C6": ("22pF C0G", "Capacitor_SMD", "C_0805_2012Metric", "C24658", "Y1 load (FH 0805CG220J500NT)", False),
"C7": ("22pF C0G", "Capacitor_SMD", "C_0805_2012Metric", "C24658", "Y1 load (FH 0805CG220J500NT)", False),
"C8": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U5 VCCA", False),
"C9": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U5 VCCB", False),
"C10": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U6 VCCA", False),
"C11": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U6 VCCB", False),
"C12": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U7 VCCA", False),
"C13": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U7 VCCB", False),
"C14": ("1uF", "Capacitor_SMD", "C_0603_1608Metric", "C15849", "3V3X bulk", False),
"R1": ("1k", "Resistor_SMD", "R_0603_1608Metric", "C21190", "MISO series to D0 (bus contention limit)", False),
"R2": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "XIAO RX idle-high pull-up", False),
"R3": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "Bridge RX idle-high pull-up", False),
"R4": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "Visor-present pull-down", False),
"D1": ("B5819W", "Diode_SMD", "D_SOD-123", "C8598", "VDOCK -> XIAO VBUS (only if JP1 bridged)", False),
"JP1": ("VDOCK EN", "Jumper", "SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mm", "", "Open by default", False),
"J2": ("XIAO left 1x7", "Connector_PinSocket_2.54mm", "PinSocket_1x07_P2.54mm_Vertical", "",
"XIAO pins 1-7 (D0..D6); female socket or solder pins direct", True),
"J3": ("XIAO right 1x7", "Connector_PinSocket_2.54mm", "PinSocket_1x07_P2.54mm_Vertical", "",
"XIAO pins 14-8 (VBUS,GND,3V3,D10,D9,D8,D7)", True),
}
# Springboard pin -> net (Table 5-1 of the Springboard Development Guide; CD1*/CD2* tied to GND per spec)
SB = {
1: "GND", 34: "GND", 35: "GND", 68: "GND", 36: "GND", 67: "GND",
17: "VSB", 51: "VSB",
18: "VDOCK", 52: "VDOCK",
7: "CS0_N", 42: "CS1_N", 46: "A17", 12: "A8",
30: "D0", 16: "IRQ_N", 58: "RESET_N",
}
SB_NAMES = { # for silkscreen/schematic only
1: "GND", 2: "D3", 3: "D4", 4: "D5", 5: "D6", 6: "D7", 7: "CS0*", 8: "A10", 9: "OE*", 10: "A11", 11: "A9",
12: "A8", 13: "A13", 14: "A14", 15: "WE*", 16: "IRQ*", 17: "VCC", 18: "VDOCK", 19: "A16", 20: "A15",
21: "A12", 22: "A7", 23: "A6", 24: "A5", 25: "A4", 26: "A3", 27: "A2", 28: "A1", 29: "A0", 30: "D0",
31: "D1", 32: "D2", 33: "RSVD", 34: "GND", 35: "GND", 36: "CD1*", 37: "D11", 38: "D12", 39: "D13",
40: "D14", 41: "D15", 42: "CS1*", 43: "RSVD", 44: "RSVD", 45: "RSVD", 46: "A17", 47: "A18", 48: "A19",
49: "A20", 50: "A21", 51: "VCC", 52: "VDOCK", 53: "A22", 54: "A23", 55: "RSVD", 56: "RSVD", 57: "RSVD",
58: "RESET*", 59: "RSVD", 60: "MIC-", 61: "MIC+", 62: "RSVD", 63: "LOWBAT*", 64: "D8", 65: "D9",
66: "D10", 67: "CD2*", 68: "GND",
}
# (ref, pad) -> net
CONN = {}
for p, n in SB.items():
CONN[("J1", str(p))] = n
def c(ref, pad, net):
CONN[(ref, str(pad))] = net
# U1/U2 74LVC1G80 (SOT-353): 1 D, 2 CP, 3 GND, 4 Q-bar, 5 VCC
for ref, d, q in (("U1", "A17", "SPI_NCS"), ("U2", "A8", "SPI_MOSI")):
c(ref, 1, d); c(ref, 2, "CS0_N"); c(ref, 3, "GND"); c(ref, 4, q); c(ref, 5, "VSB")
# U3 74LVC1G04 (SOT-353): 1 NC, 2 A, 3 GND, 4 Y, 5 VCC
c("U3", 2, "CS1_N"); c("U3", 3, "GND"); c("U3", 4, "SPI_SCLK"); c("U3", 5, "VSB")
# U4 SC16IS740 TSSOP-16
for pad, net in {1: "VSB", 2: "SPI_NCS", 3: "SPI_MOSI", 4: "SPI_MISO", 5: "SPI_SCLK", 6: "GND", 7: "IRQ_N",
8: "GND", 9: "GND", 11: "GND", 12: "BR_TX", 13: "BR_RX", 14: "RESET_N",
15: "XTAL1", 16: "XTAL2"}.items():
c("U4", pad, net) # pin 10 RTS left open
# Y1 3225 4-pad: 1/3 crystal, 2/4 case
c("Y1", 1, "XTAL1"); c("Y1", 3, "XTAL2"); c("Y1", 2, "GND"); c("Y1", 4, "GND")
c("C6", 1, "XTAL1"); c("C6", 2, "GND"); c("C7", 1, "XTAL2"); c("C7", 2, "GND")
c("R1", 1, "D0"); c("R1", 2, "SPI_MISO")
# SN74LVC1T45 (SC-70-6): 1 VCCA, 2 GND, 3 A, 4 B, 5 DIR, 6 VCCB. DIR high = A->B
for ref, a, b, d in (("U5", "BR_TX", "XIAO_RX", "VSB"), # bridge TX -> XIAO D7
("U6", "BR_RX", "XIAO_TX", "GND"), # XIAO D6 -> bridge RX
("U7", "VSB", "VISOR_PRESENT", "VSB")): # VSB present -> XIAO D0
c(ref, 1, "VSB"); c(ref, 2, "GND"); c(ref, 3, a); c(ref, 4, b); c(ref, 5, d); c(ref, 6, "3V3X")
c("R2", 1, "3V3X"); c("R2", 2, "XIAO_RX")
c("R3", 1, "VSB"); c("R3", 2, "BR_RX")
c("R4", 1, "VISOR_PRESENT"); c("R4", 2, "GND")
# Decoupling
for ref, net in (("C1", "VSB"), ("C2", "VSB"), ("C3", "VSB"), ("C4", "VSB"), ("C5", "VSB"),
("C8", "VSB"), ("C10", "VSB"), ("C12", "VSB"),
("C9", "3V3X"), ("C11", "3V3X"), ("C13", "3V3X"), ("C14", "3V3X")):
c(ref, 1, net); c(ref, 2, "GND")
# VDOCK charging path (optional)
c("D1", 2, "VDOCK"); c("D1", 1, "VDOCK_D") # SOD-123 pad 1 = cathode
c("JP1", 1, "VDOCK_D"); c("JP1", 2, "XIAO_VBUS")
# XIAO nRF52840 header (top view, USB-C toward outer edge)
XIAO = {1: "VISOR_PRESENT", 2: None, 3: None, 4: None, 5: None, 6: None, 7: "XIAO_TX",
8: "XIAO_RX", 9: None, 10: None, 11: None, 12: "3V3X", 13: "GND", 14: "XIAO_VBUS"}
XIAO_NAMES = {1: "D0", 2: "D1", 3: "D2", 4: "D3", 5: "D4", 6: "D5", 7: "D6", 8: "D7", 9: "D8",
10: "D9", 11: "D10", 12: "3V3", 13: "GND", 14: "5V"}
for k in range(1, 8):
if XIAO[k]: c("J2", k, XIAO[k])
for k in range(1, 8): # J3 pin k = XIAO pin 15-k
n = XIAO[15 - k]
if n: c("J3", k, n)
NETS = sorted(set(CONN.values()))
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/python3
import sys, pcbnew, re, collections
b = pcbnew.LoadBoard(sys.argv[1])
ok = pcbnew.WriteDRCReport(b, sys.argv[2], pcbnew.EDA_UNITS_MILLIMETRES, True)
txt = open(sys.argv[2]).read()
print(ok, re.findall(r"\*\* Found \d+ [^*]+", txt))
c = collections.Counter(re.findall(r"^\[(\w+)\]", txt, re.M)); print(dict(c))
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env python3
"""Write net-class patterns and fab rules into the KiCad project (KiCad 7 keeps them in .kicad_pro)."""
import json, sys
f = sys.argv[1]
p = json.load(open(f))
ns = p.setdefault("net_settings", {})
ns["netclass_patterns"] = [{"netclass": "Power", "pattern": n}
for n in ("GND", "VSB", "3V3X", "VDOCK", "VDOCK_D", "XIAO_VBUS")]
for c in ns["classes"]:
if c["name"] == "Power":
c.update({"track_width": 0.4, "clearance": 0.2, "via_diameter": 0.7, "via_drill": 0.35})
if c["name"] == "Default":
c.update({"track_width": 0.2, "clearance": 0.2, "via_diameter": 0.6, "via_drill": 0.3})
json.dump(p, open(f, "w"), indent=2)
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/python3
"""Independent cross-checks of the routed board against the source documents."""
import re, sys, os, collections
import pcbnew
sys.path.insert(0, os.path.dirname(__file__))
from netlist import CONN, SB_NAMES
fail = []
def check(cond, msg):
print(("PASS " if cond else "FAIL ") + msg)
if not cond: fail.append(msg)
b = pcbnew.LoadBoard(os.path.join(os.path.dirname(__file__), "visormesh.kicad_pcb"))
pad_net = {}
for fp in b.GetFootprints():
for p in fp.Pads():
pad_net[(fp.GetReference(), p.GetNumber())] = p.GetNetname()
# 1. every pad's net equals the netlist (and unlisted pads are unconnected)
bad = [(k, pad_net[k], CONN.get(k, "")) for k in pad_net if pad_net[k] != CONN.get(k, "")]
check(not bad, f"board pad nets match netlist.py ({len(pad_net)} pads) {bad[:5]}")
# 2. Springboard pins vs Development Guide Table 5-1 names
expect = {"GND": "GND", "CD1*": "GND", "CD2*": "GND", "VCC": "VSB", "VDOCK": "VDOCK", "CS0*": "CS0_N",
"CS1*": "CS1_N", "A17": "A17", "A8": "A8", "D0": "D0", "IRQ*": "IRQ_N", "RESET*": "RESET_N"}
for pin in range(1, 69):
want = expect.get(SB_NAMES[pin], "")
got = pad_net[("J1", str(pin))]
if got != want:
check(False, f"J1 pin {pin} ({SB_NAMES[pin]}) net {got!r} expected {want!r}")
check(True, "J1 pins 1-68 agree with Table 5-1 usage")
# 3. J1 pad geometry vs springSD IPC-356 netlist (positions relative to pin 1, layer side)
ipc = open("/home/claude/ref/springsd/gerb/SpringSD_1.1_gerber - CADCAM Netlist.IPC").read().splitlines()
ref = {}
for l in ipc:
if l.startswith("327") and "CN1" in l:
n = int(l[26:30].strip().lstrip("-")); acc = l[38:41]
xy = re.search(r"X([+-]\d+)Y([+-]\d+)", l)
ref[n] = (int(xy.group(1)) / 1e4 * 25.4, acc)
j1 = {p.GetNumber(): p for p in b.FindFootprintByReference("J1").Pads()}
x1 = pcbnew.ToMM(j1["1"].GetPosition().x)
geo_bad = []
for n, (xmm, acc) in ref.items():
p = j1[str(n)]
dx = pcbnew.ToMM(p.GetPosition().x) - x1 - (xmm - ref[1][0])
side_ok = p.IsOnLayer(pcbnew.F_Cu) if acc == "A01" else p.IsOnLayer(pcbnew.B_Cu)
if abs(dx) > 0.01 or not side_ok:
geo_bad.append((n, round(dx, 3), acc))
check(not geo_bad, f"J1 pad pitch/side identical to springSD v1.1 footprint (68 pads) {geo_bad[:4]}")
# springSD's own nets on shared signals
sd_nets = {7: "H$CS0", 42: "H$CS1", 46: "HA17", 12: "HA8", 30: "HD0", 16: "$IRQ", 58: "$HRESET", 17: "VCC", 51: "VCC"}
names = {m.group(1): m.group(2) for m in re.finditer(r"P (NNAME\d+) (\S+)", "\n".join(ipc))}
sd = {}
for l in ipc:
if l.startswith("327") and "CN1" in l:
sd[int(l[26:30].strip().lstrip("-"))] = names.get(l[3:17].strip(), l[3:17].strip())
check(all(sd[k].startswith(v) for k, v in sd_nets.items()), "CS0/CS1/A17/A8/D0/IRQ/RESET/VCC pins match springSD")
# 4. SC16IS740 pins vs NXP datasheet pin table (TSSOP16)
ds = {1: "VSB", 2: "SPI_NCS", 3: "SPI_MOSI", 4: "SPI_MISO", 5: "SPI_SCLK", 6: "GND", 7: "IRQ_N", 8: "GND",
9: "GND", 10: "", 11: "GND", 12: "BR_TX", 13: "BR_RX", 14: "RESET_N", 15: "XTAL1", 16: "XTAL2"}
check(all(pad_net[("U4", str(k))] == v for k, v in ds.items()),
"U4: VDD,CS,SI,SO,SCLK,SDA=GND,IRQ,I2C/SPI=GND(SPI),VSS,RTS nc,CTS=GND,TX,RX,RESET*,XTAL1,XTAL2")
# 5. domain isolation: no pad is on both VSB-domain nets and 3V3X except through U5-U7
vsb_side = {"VSB", "BR_TX", "BR_RX", "SPI_NCS", "SPI_MOSI", "SPI_MISO", "SPI_SCLK", "XTAL1", "XTAL2"}
x_side = {"3V3X", "XIAO_RX", "XIAO_TX", "VISOR_PRESENT"}
cross = collections.defaultdict(set)
for (r, p), n in pad_net.items():
if n in vsb_side: cross[r].add("VSB")
if n in x_side: cross[r].add("3V3X")
both = sorted(r for r, s in cross.items() if len(s) == 2)
check(both == ["J2", "J3", "U5", "U6", "U7"] or both == ["U5", "U6", "U7"],
f"only the LVC1T45s straddle both power domains: {both}")
check(pad_net[("U5", "5")] == "VSB" and pad_net[("U6", "5")] == "GND" and pad_net[("U7", "5")] == "VSB",
"DIR: U5 A->B (bridge TX->XIAO), U6 B->A (XIAO TX->bridge), U7 A->B (present)")
check(pad_net[("J2", "1")] == "VISOR_PRESENT" and pad_net[("J2", "7")] == "XIAO_TX"
and pad_net[("J3", "1")] == "XIAO_VBUS" and pad_net[("J3", "2")] == "GND"
and pad_net[("J3", "3")] == "3V3X" and pad_net[("J3", "7")] == "XIAO_RX",
"XIAO: D0=present, D6=TX, D7=RX, 3V3, GND, 5V (matches companion firmware patch D6/D7)")
# 6. outline and stackup
bb = b.GetBoardEdgesBoundingBox()
w, h = pcbnew.ToMM(bb.GetWidth()), pcbnew.ToMM(bb.GetHeight())
w -= 0.1 # bbox includes the 0.1 mm Edge.Cuts line width
check(abs(w - 50.43) < 0.05, f"board width {w:.2f} mm = springSD width 50.43 mm")
print(f"INFO board {w:.2f} x {h:.2f} mm, thickness {pcbnew.ToMM(b.GetDesignSettings().GetBoardThickness())} mm")
print("RESULT", "ALL PASS" if not fail else f"{len(fail)} FAIL")
+3
View File
@@ -0,0 +1,3 @@
# Palm client
Not started. See [../docs/design.md](../docs/design.md#palm-client-plans) for the plan and [../docs/progress.md](../docs/progress.md) for the milestones.