Pivot from LP5562 to GPIO-direct PWM LEDs, add NTAG5 EH provisioning

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>
This commit is contained in:
michael
2026-03-07 10:44:12 -08:00
parent f437e4e281
commit 5cd728c298
11 changed files with 1459 additions and 1099 deletions

View File

@@ -1,7 +1,7 @@
# xblink Project Status
**Current Milestone**: M7 — Sleep/Wake
**Last Updated**: 2026-03-05
**Current Milestone**: GPIO-Direct LED Pivot (replacing LP5562)
**Last Updated**: 2026-03-07
---
@@ -76,16 +76,37 @@
- [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
- [ ] Configure SAMD21 EIC for FD pin wake
- [ ] Implement STANDBY sleep after LP5562 programming
- [ ] Verify LP5562 keeps running during MCU sleep
- [ ] Measure current: active vs standby vs total system
- [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
@@ -96,28 +117,17 @@
### M9: Power Characterization
- [ ] Measure current at various LED current settings
- [ ] Test NTAG5Link EH output with phone NFC
- [ ] Find optimal brightness vs EH budget balance
- [ ] 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 — Abstraction + Polish
### M10: LedController Trait
- [ ] Define trait based on proven usage patterns from Groups A-C
- [ ] Implement for LP5562 wrapper
- [ ] Refactor main.rs to trait-based API
### M11: SimplePwm Driver
- [ ] Implement only if single-color LED hardware is available
## Group E — Future
## 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
@@ -135,23 +145,21 @@
| Question | Status | Notes |
|----------|--------|-------|
| Energy harvesting power budget | TBD | Multimeter measurements in M9 |
| Optimal LED current per channel | TBD | Probably 2-5mA/ch, verify in M9 |
| 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 |
| NTAG5Link I2C slave address | Assumed 0x54 | Verify in M4 with Click board |
| Pattern binary format | Deferred to M5 | Design after M2-M3 engine experience |
| Hall sensor + EN circuit | Designed | Wired-AND: hall + MCU open-drain on EN with 1M pull-up. See `docs/plans/2026-03-03-hall-en-design.md` |
| Hall sensor part selection | Decided | DRV5032FB (SOT-23, 8.4mT, prototype) → DRV5032FE (X2SON 1x1mm, final PCB) |
| EN pull-up value | Decided | 1M — zero steady-state draw, 3µA when EN low, ~10µs rise time |
| 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 | TI eval module, RGBW LEDs, I2C addr 0x30 |
| Mini-USB cable | Available | USB-C, used for flashing XIAO M0 |
| LP5562EVM | Available (unused) | Removed from design (VDD > 2.7V) |
| NTAG5 Link Click | Available, partially wired | Missing I2C jumper to XIAO |
| Hall effect sensor | Not available | Need to source — TI DRV5032FB (SOT-23) for prototype |
| 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 |