LP5562 requires 2.7V min but NFC energy harvesting produces only 1.8V. New architecture: SAMD21 drives 6 red LEDs directly via TCC0/TCC1 hardware PWM through current-limiting resistors. Key changes: - Add TCC PWM driver (src/led/pwm.rs) for 6 GPIO-direct LED channels - Rewrite pattern engine: software waveform LUTs (sine/triangle/square/ heartbeat) replace LP5562 hardware execution engines - Add XBLK v2 EEPROM format with 16-byte pattern entries + playlist - Add TC4 50Hz ISR for animation, power governor for current budget - Add NTAG5 EH provisioning: persistent config + session trigger - Critical finding: SRAM passthrough in persistent EEPROM blocks all NFC access when MCU unpowered — CONFIG_1 must be session-only - Add provision_eh.py PCSC tool for ACR1552 reader - Update CLAUDE.md and STATUS.md for new architecture Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
166 lines
6.8 KiB
Markdown
166 lines
6.8 KiB
Markdown
# xblink Project Status
|
|
|
|
**Current Milestone**: GPIO-Direct LED Pivot (replacing LP5562)
|
|
**Last Updated**: 2026-03-07
|
|
|
|
---
|
|
|
|
## Phase 0 — Project Setup (COMPLETE)
|
|
|
|
- [x] Initialize git repository and Rust project
|
|
- [x] Configure build target (thumbv6m-none-eabi)
|
|
- [x] Create project documentation (README, CLAUDE.md, STATUS, DEVELOPMENT_PLAN)
|
|
- [x] Verify `cargo build --release` compiles
|
|
- [x] Initial git commit
|
|
|
|
## Group A — LP5562 Only
|
|
|
|
**Hardware needed**: XIAO M0 + LP5562EVM + mini-USB cable
|
|
|
|
### M1: LED Smoke Test
|
|
|
|
- [x] Copy LP5562 driver from `../ntag5-samd21-lp562/src/lp5562.rs`
|
|
- [x] Create `src/led/mod.rs` with re-exports
|
|
- [x] Update `main.rs` with I2C init + GPIO EN + LP5562 direct PWM test
|
|
- [x] Verify `cargo build --release` compiles
|
|
- [x] Verify LP5562 I2C control via EVM USB-to-I2C bridge (`tools/lp5562_evm.py`)
|
|
- [x] Flash XIAO M0 and verify RGBW LED channels with Rust firmware
|
|
|
|
### M2: Engine Patterns
|
|
|
|
- [x] Build breathing pattern (1 engine, ramp up/down, branch loop)
|
|
- [x] Build heartbeat pattern (1 engine, fast ramp, slow decay)
|
|
- [x] Build RGB cycle (3 engines, trigger-synced phase offset)
|
|
- [x] Verify LP5562 runs patterns autonomously (MCU idle loop)
|
|
- [x] Verify MCU can stop and switch patterns (8s cycle between all 3)
|
|
|
|
### M3: Hardcoded Pattern Library (COMPLETE)
|
|
|
|
- [x] Define 5 const patterns in firmware (breathe, heartbeat, slow_pulse, rgb_cycle, color_wash)
|
|
- [x] Implement pattern selector (cycle through patterns, 15s each)
|
|
- [x] Reduce LED current to 2mA/ch (EH-realistic budget)
|
|
- [x] Document engine program structures (`docs/lp5562-engine-reference.md`)
|
|
|
|
## Group B — Add NTAG5Link
|
|
|
|
**Hardware needed**: + NTAG5Link Click board + I2C jumper
|
|
|
|
### M4: NTAG5 EEPROM Read/Write (COMPLETE)
|
|
|
|
- [x] Write `Ntag5Link<I2C>` driver (`src/ntag5/mod.rs`)
|
|
- [x] Implement session register access (CONFIG_0, CONFIG_1, EH_CONFIG)
|
|
- [x] Implement EEPROM block read/write with write-verify
|
|
- [x] Config check: read session regs, compare against expected, write NDEF result
|
|
- [x] NDEF Type 5 text record writer for config check output
|
|
- [x] Verified on hardware: config check passes, NDEF readable via NFC
|
|
- [ ] Register map module (`src/ntag5/registers.rs`) — deferred, constants in mod.rs for now
|
|
|
|
### M5: Boot-from-EEPROM (COMPLETE)
|
|
|
|
- [x] Design XBLK binary pattern format (`docs/plans/2026-03-05-eeprom-pattern-format.md`)
|
|
- [x] Implement XBLK deserializer (`src/pattern/mod.rs`: parse_header, parse_pattern_entry)
|
|
- [x] Implement XBLK serializer (`src/pattern/mod.rs`: serialize_pattern_entry, serialize_header, crc16)
|
|
- [x] Update main.rs: boot → read EEPROM → parse → program LP5562 → idle, with fallback
|
|
- [x] MCU self-provisioning: write hardcoded patterns to EEPROM on first boot
|
|
- [x] Write Python serializer tool (`tools/xblk_serialize.py`) for PCSC pattern uploads
|
|
- [x] Verified on hardware: self-provisioning writes XBLK, subsequent boots load from EEPROM
|
|
|
|
### M6: SRAM Mailbox (COMPLETE)
|
|
|
|
- [x] Design SRAM mailbox protocol (`docs/plans/2026-03-05-sram-mailbox-protocol.md`)
|
|
- [x] Add NTAG5 `write_register`, SRAM read/write, FD pin configuration
|
|
- [x] Implement command protocol types and CRC helpers (`src/ntag5/sram.rs`)
|
|
- [x] Implement all 7 command handlers (WRITE_PATTERN, GET_STATUS, SET_ACTIVE, SYNC_START/END, READ_LIBRARY/NEXT)
|
|
- [x] Streaming transfer: single NFC hold for full library sync (one pattern per SRAM round-trip)
|
|
- [x] FD pin polling in main idle loop (200ms interval, A1/PA04)
|
|
- [x] I2C bus swapping for LP5562 reprogramming after pattern updates
|
|
- [ ] Hardware test: flash and verify with PCSC reader / phone app (pending FD pin wiring)
|
|
|
|
## GPIO-Direct LED Pivot (2026-03-07)
|
|
|
|
LP5562 requires VDD >= 2.7V, incompatible with 1.8V NFC energy harvesting.
|
|
Replaced with SAMD21E GPIO-direct PWM driving 6 red LEDs.
|
|
See `docs/plans/2026-03-06-gpio-led-pivot.md` for full design.
|
|
|
|
### LED Pivot Implementation
|
|
|
|
- [x] Design GPIO-direct PWM architecture (`docs/plans/2026-03-06-gpio-led-pivot.md`)
|
|
- [x] Implement software pattern engine with waveform LUTs (`src/pattern/mod.rs`)
|
|
- [x] Implement XBLK v2 EEPROM format (16-byte entries, playlist support)
|
|
- [x] Implement TCC PWM driver for 6 LED channels (`src/led/pwm.rs`)
|
|
- [x] Implement TC4 50Hz animation timer ISR
|
|
- [x] Implement power governor (proportional brightness scaling)
|
|
- [x] Update main.rs for GPIO-direct boot flow
|
|
- [x] Update SRAM mailbox protocol for v2 format (`src/ntag5/sram.rs`)
|
|
- [x] Update Python serializer (`tools/xblk_serialize.py`)
|
|
- [x] Verify `cargo build --release` compiles
|
|
- [ ] Hardware test: wire LEDs to A1/A2/D2/D3, flash and verify animations
|
|
- [ ] Measure power consumption with multimeter
|
|
|
|
## Group C — Power + Recovery
|
|
|
|
**Hardware needed**: + Hall sensor + multimeter
|
|
|
|
### M7: Sleep/Wake
|
|
|
|
- [x] Configure SAMD21 EIC for FD pin wake
|
|
- [x] Implement IDLE sleep during animation (TC4 ISR drives LEDs)
|
|
- [x] Implement STANDBY sleep when no pattern active
|
|
- [ ] Measure current: IDLE (animating) vs STANDBY vs total system
|
|
|
|
### M8: Recovery Mode
|
|
|
|
- [ ] Wire hall sensor to EIC-capable GPIO
|
|
- [ ] Implement boot-time hall sensor check
|
|
- [ ] Recovery: load default pattern, skip EEPROM, stay awake
|
|
- [ ] Test with magnet
|
|
|
|
### M9: Power Characterization
|
|
|
|
- [ ] Measure current at various LED brightness / resistor values
|
|
- [ ] Test NTAG5Link EH output with phone NFC at 1.8V
|
|
- [ ] Tune power governor budget for optimal brightness
|
|
- [ ] Document real power numbers
|
|
|
|
## Group D — Future
|
|
|
|
### Custom PCB (SAMD21E)
|
|
|
|
- [ ] Port to `atsamd-hal` with `samd21e` feature
|
|
- [ ] Add LEDs 2-5 on PA06/PA07 (freed from I2C conflict on custom PCB)
|
|
- [ ] Custom `memory.x` linker script
|
|
- [ ] PCB design and fabrication
|
|
|
|
### Companion App (React Native)
|
|
|
|
- [ ] NFC communication + pattern editor + upload
|
|
|
|
### Firmware Update (NFC OTA)
|
|
|
|
- [ ] Custom bootloader if needed post-implant
|
|
|
|
---
|
|
|
|
## Open Questions
|
|
|
|
| Question | Status | Notes |
|
|
|----------|--------|-------|
|
|
| Energy harvesting power budget | TBD | Multimeter measurements at 1.8V |
|
|
| Optimal LED resistor value | TBD | 10-47 ohm, affects brightness vs power |
|
|
| Power governor budget default | Set to 50 | Configurable via companion app |
|
|
| Firmware update strategy | Deferred | UF2 for dev, NFC OTA evaluated later |
|
|
| Hall sensor part selection | Decided | DRV5032FB (SOT-23, 8.4mT, prototype) |
|
|
|
|
## Hardware Inventory
|
|
|
|
| Item | Status | Notes |
|
|
|------|--------|-------|
|
|
| Seeed XIAO M0 | Available | Dev board MCU (SAMD21G18A) |
|
|
| LP5562EVM | Available (unused) | Removed from design (VDD > 2.7V) |
|
|
| NTAG5 Link Click | Available, partially wired | Missing I2C jumper to XIAO |
|
|
| Low-Vf red LEDs | Need to source | Kingbright APTD1608 or similar, Vf ~1.7V |
|
|
| Resistors (10-47 ohm) | Need to source | Current limiting for GPIO-direct LEDs |
|
|
| Hall effect sensor | Not available | Need to source — TI DRV5032FB (SOT-23) |
|
|
| ACR1552 PCSC reader | Available | For ntag5sensor Python tooling |
|
|
| Multimeter | Available | For power budget measurements |
|