Set up Rust embedded project targeting SAMD21 (thumbv6m-none-eabi) with XIAO M0 BSP for dev board prototyping. Includes LP5562 EN pin control on D0/A0, project documentation (README, CLAUDE.md), phased status tracker, and detailed development plan covering LP5562 driver integration, NTAG5Link I2C driver, pattern storage format, power management, NFC communication protocol, recovery mode, and firmware update strategy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.6 KiB
xblink
NFC-powered LED implant using NTAG5Link, SAMD21E, and LP5562.
A battery-free subdermal LED implant that harvests energy from an NFC field. An NTAG5Link provides power and storage, a SAMD21E microcontroller reads stored LED patterns and programs the LP5562 LED driver's autonomous execution engines, then sleeps. Patterns are updated wirelessly via NFC from a phone.
Hardware Overview
I2C (0x30)
Phone/Reader ))) NFC ((( NTAG5Link ---------> LP5562 -----> RGBW LEDs
| | |
| VOUT | FD pin | EN
| (EH) | |
v v |
+--SAMD21E--+ |
| D0/A0 ----------------+ (GPIO enable)
| A4/A5 (I2C bus) ------+
| GPIO <--- Hall Sensor
+----------+
All power comes from NTAG5Link energy harvesting — no battery.
Components
| Component | Part | Role | I2C Addr | Key Specs |
|---|---|---|---|---|
| NFC + Power | NXP NTAG5Link (NTP53x2) | NFC interface, energy harvesting, pattern storage | 0x54 (slave) | 2048B EEPROM, 256B SRAM, ISO15693, 1.8/2.4/3.0V EH output |
| MCU | SAMD21E18A | Firmware (Rust), pattern loading, sleep/wake | — | 256KB flash, 32KB RAM, ARM Cortex-M0+, 32-pin QFN |
| LED Driver | TI LP5562 | RGBW LED control with autonomous patterns | 0x30 | 4ch RGBW, 3 execution engines, 16 cmds/engine, 0-25.5mA/ch |
| Recovery | Hall effect sensor | Safe mode / recovery trigger | — | GPIO input with EIC wake from sleep |
Dev board: Seeed XIAO M0 (SAMD21G18A) + LP5562EVM + MikroElektronika NTAG5 Link Click
Architecture
Boot Sequence
- NFC field detected by NTAG5Link
- VOUT powers SAMD21E and LP5562 (MCU drives EN pin high on D0/A0)
- SAMD21E boots, checks hall sensor GPIO (asserted = recovery mode)
- Normal boot: reads LED pattern from NTAG5Link EEPROM via I2C
- Programs LP5562 execution engines with pattern data
- Enters STANDBY sleep (~5uA)
- LP5562 runs patterns autonomously using internal oscillator
- NFC field drops → VOUT drops → clean power-off
Pattern Update Sequence
- Phone sends new pattern data to NTAG5Link via NFC
- NTAG5Link signals MCU via FD pin (SRAM write indication)
- SAMD21E wakes from sleep via EIC interrupt
- Pauses LP5562 engines (set exec to Hold)
- Reads new pattern from NTAG5Link SRAM mailbox via I2C
- Writes pattern to NTAG5Link EEPROM for persistence
- Reprograms LP5562 engines with new pattern
- Returns to STANDBY sleep
Recovery Mode
If the hall sensor is asserted at boot (magnet held near implant):
- Loads a hardcoded default pattern (solid white, low brightness)
- Ignores EEPROM pattern data
- Sets recovery flag in SRAM for phone app detection
- Remains awake for firmware update if supported
Power Budget
All power from NTAG5Link energy harvesting. Budget is constrained and TBD pending prototype measurements.
| Parameter | Value | Notes |
|---|---|---|
| EH max current | ~12.5mA | Highest threshold setting |
| EH voltage | 3.0V | Required for LP5562 (2.7-5.5V) and SAMD21E (1.62-3.63V) |
| LP5562 per channel | 0-25.5mA | Must limit to ~2-5mA/ch for EH budget |
| SAMD21E active | ~3-5mA | During boot and pattern programming |
| SAMD21E standby | ~5uA | After LP5562 engines are running |
Getting Started
Toolchain Setup
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# Add ARM Cortex-M0+ target
rustup target add thumbv6m-none-eabi
# Install cargo-hf2 for UF2 flashing (XIAO M0)
cargo install cargo-hf2
On Linux, add udev rule for XIAO bootloader (vendor ID 0x2886):
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2886", MODE="0666"' | sudo tee /etc/udev/rules.d/99-xiao.rules
sudo udevadm control --reload-rules
Build and Flash
cargo build --release
# Put XIAO in bootloader mode (double-tap RST), then:
cargo hf2 --release
Dev Board Wiring
Current prototype (XIAO M0 + LP5562EVM):
| XIAO Pin | LP5562EVM | Function |
|---|---|---|
| A4 (SDA) | SDA | I2C data |
| A5 (SCL) | SCL | I2C clock |
| D0/A0 | EN | Hardware enable (GPIO) |
| 3V3 | VCC | Power |
| GND | GND | Ground |
Project Status
See docs/STATUS.md for current progress.
Related Projects
../ntag5-samd21-lp562/— LP5562 Rust driver prototype and SAMD21 test firmware../ntag5sensor/— Python NTAG5Link tooling (PCSC reader, ISO15693, sensor interface)