# pm-daisy — PolyMeter click engine on the Daisy Pod A time-boxed spike (see [`docs/daisy-spike.md`](../../docs/daisy-spike.md)): play the PolyMeter groove engine on real Cortex-M7 hardware to judge whether the [Electrosmith Daisy Pod](https://electro-smith.com/products/pod) (STM32H750, onboard audio codec) is a credible home for the audio engine if PolyMeter ever grows into a real-time audio workstation. It boots playing a hardcoded 124-BPM 909 pattern (`pm_synth::SPIKE_PROGRAM`) out the Pod's audio jack, flashing the Daisy Seed's USER LED on each click. ## What runs here - **Shared engine, verified on host.** The audio is produced by `pm_synth::Player` — the *exact* same code the host `synthrender` renders to `pm-daisy-preview.wav`. Listen to that WAV to hear what the hardware should play before you flash anything. - **Transport only is new.** This crate is a thin board-support binary: heap + board bring-up + the SAI audio-DMA interrupt feeding `Player::next_sample()` into stereo frames. Structure follows the `daisy` crate's `examples/audio.rs`. ## ⚠️ Set the board revision (or you get silence) The Daisy Seed comes in revisions with different audio codecs. Pick the one on **your** Seed (check the sticker / silkscreen) — it's a Cargo feature: | Your Seed | Codec | Build with | |---|---|---| | Daisy Seed (original) | AK4556 | `./build.sh seed` | | **Daisy Seed 1.1** (default) | WM8731 | `./build.sh` (or `seed_1_1`) | | Daisy Seed 1.2 / Seed2 DFM | PCM3060 | `./build.sh seed_1_2` | ## Build ```sh ./build.sh [revision] # containerized (pm-rust:2); produces pm-daisy.bin + pm-daisy.elf ``` ## Flash — two options **A. Debug probe (recommended — gives you defmt logs over RTT):** A probe wired to the Seed's SWD pins (e.g. the Raspberry Pi Debug Probe you already use for pm-grid/pm-kit — see [`rust/probe-flash.md`](../probe-flash.md)). ```sh probe-rs run --chip STM32H750VBTx pm-daisy.elf # or `cargo run --release` from this dir ``` **B. USB DFU (no probe needed):** Hold the Daisy's **BOOT** button, tap **RESET**, release BOOT — the Seed enumerates as STM32 system DFU. Then: ```sh dfu-util -a 0 -s 0x08000000:leave -D pm-daisy.bin -d ,0483:df11 ``` ## Too big for 128 KB? The STM32H750 has only **128 KB internal flash**. If the linker reports a `FLASH` overflow, flash via the **Daisy Bootloader** to the 8 MB QSPI instead: 1. Install the bootloader once at (Bootloader tab, v6.x). 2. In [`memory.x`](memory.x), set `FLASH : ORIGIN = 0x90040000, LENGTH = 8M - 0x40000` (commented there). 3. Rebuild, then enter the bootloader (tap BOOT within 2 s of reset; LED pulses) and: ```sh dfu-util -a 0 -s 0x90040000:leave -D pm-daisy.bin -d ,0483:df11 ``` ## Beyond the spike (Pod extras, not yet wired) The Pod adds 2 buttons, 2 knobs, an encoder, and 2 RGB LEDs on Seed GPIO/ADC pins. Obvious next steps once audio is confirmed: knob → tempo, button → start/stop, RGB LED → beat/downbeat color. Wiring those needs the Pod pin map from Electrosmith's pinout (verify before assigning pins). This spike deliberately uses only the always-present Seed USER LED to avoid guessing the Pod pinout.