Diagnosed from the user's console output - 25 chunks pushed cleanly at ~124ms each, then stalled. Two coupled causes: 1) Bus contention. tick() and Live sync share self.midi with the chunk ACKs. While the device was processing a chunk, a Note On / Clock Out / Live-sync FULL heartbeat could land on the same MIDI OUT stream and the host's parser dropped the interleaved ACK SysEx. Fix: self._fw_pushing flag set on 0x21 BEGIN, cleared on 0x23 COMMIT or any error. midi_send / Clock Out / _sync_broadcast / _sync_broadcast_full all early-out when _fw_pushing is True. Only ACKs go out during a push. 2) SysEx assembler garbage. self._sx = bytearray() per chunk leaks ~70 bytes / chunk that only GC'd every 50 chunks. 25 chunks of trash plus a slow heap walked the wrong way explains the ramp-up to 174 -> 119 -> 124 ms ACK times. GC every chunk now (~30ms cost on RP2040/RP2350 with small heap) so the assembler buffer is always fresh. Same patch on both pico-cp/ and pico-explorer/ since the bug is identical. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| circuits | ||
| sim | ||
| Containerfile | ||
| README.md | ||
| run.sh | ||
PM_K-1 EDA environment
A reproducible container with the tools to design, check, and simulate the core board — so the work doesn't depend on whatever happens to be installed on a given machine, now or in 50 years.
What's inside
- KiCad 9 — schematic capture + PCB layout, and a CLI (
kicad-cli) that can run ERC (Electrical Rules Check) and DRC, and export netlists/PDF/Gerbers. - ngspice — SPICE simulator for validating the analog audio circuits before we commit copper (op-amp stages, filters, input loading, etc.).
- python3 — scripting, BOM munging, optional code-defined-schematic helpers.
Why a container?
The system KiCad here is 7.0, whose CLI can't run ERC (that arrived in KiCad 8). Rather than fight the host, we pin a known toolchain. Anyone — including future-you — rebuilds the exact environment with one command.
Use it
cd hardware/eda
./run.sh # interactive shell, lands in hardware/kicad/
./run.sh kicad-cli version # confirm KiCad 9
./run.sh kicad-cli sch erc pm_k1_core.kicad_sch # run ERC on the schematic
./run.sh ngspice -b ../eda/sim/input_loading.cir # run a simulation (cwd is kicad/)
run.sh builds the image on first use, then mounts the whole repo at /work (so KiCad sees
hardware/). Use RUNTIME=docker ./run.sh … to use Docker instead of Podman.
Layout
eda/
Containerfile # the pinned toolchain (KiCad 9 + ngspice + python)
run.sh # build-if-needed + run with the repo mounted
sim/ # ngspice decks (SPICE simulations of the analog circuits)