A Rust firmware for reading and writing ST25TB RFID chips (commonly used in printer cartridges) using the LilyGO T-Embed CC1101 device.
Menu Screen Chip Data View
- Read ST25TB chips - Full chip dump (up to 256 blocks)
- Write ST25TB chips - Write modified data back to chip
- Serial Dump - Export chip data via serial monitor
- Serial Load - Import chip data by pasting hex dump
- TFT Display UI - Menu navigation with rotary encoder
- Audio Feedback - Beep on successful operations
- LilyGO T-Embed CC1101 (ESP32-S3)
- PN532 NFC Module (connected via I2C)
| Function | GPIO |
|---|---|
| PN532 SDA | GPIO8 |
| PN532 SCL | GPIO18 |
| PN532 IRQ | GPIO17 |
| PN532 RST | GPIO45 |
| Display CS | GPIO41 |
| Display DC | GPIO16 |
| Display BL | GPIO21 |
| Encoder A | GPIO4 |
| Encoder B | GPIO5 |
| Encoder BTN | GPIO0 |
| Back Button | GPIO6 |
| Power Enable | GPIO15 |
- Install Rust and ESP toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install espup
espup install- Source the environment:
source ~/export-esp.shUsing just (recommended):
# Install just
cargo install just
# Build
just build
# Flash and monitor
just flash
# Monitor only
just monitorOr manually:
# Build
cargo build --release
# Flash
cargo espflash flash --port /dev/cu.usbmodem1201 --release
# Monitor
espflash monitor --port /dev/cu.usbmodem1201 --non-interactivePre-built binaries are available in Releases:
| File | Description |
|---|---|
rfid-reader.bin |
App binary for Launcher bootloader |
rfid-reader-full.bin |
Full firmware with bootloader (flash at 0x0) |
Using Launcher: Copy rfid-reader.bin to SD card, select from Launcher menu SD. Firmware app and reboot.
Standalone flash:
esptool.py write_flash 0x0 rfid-reader-full.bin- Rotate encoder - Navigate menu / scroll data
- Press encoder - Select / toggle edit mode
- Back button - Go back / cancel
- Select "Read Chip" from menu
- Place ST25TB chip on PN532 antenna
- Wait for beep (success) or error message
- First read or load chip data
- Select "Write Chip" from menu
- Place same chip on antenna
- Wait for verification
Export dump:
- Select "Dump Serial"
- Copy output from serial monitor
Import dump:
- Select "Load Serial"
- Paste data in format:
B000: 0F FF FF FF
B001: 9F FF FF FF
...
END
- Type
ENDand press Enter
- ST25TB04K (512 bytes)
- ST25TB512
- ST25TB02K
- SRI512 / SRIX4K (ISO14443-B)
src/
├── main.rs # Application entry & UI logic
├── board.rs # Pin definitions
├── drivers/
│ ├── pn532.rs # PN532 NFC driver (I2C)
│ └── audio.rs # I2S audio (beep)
├── protocol/
│ └── st25tb.rs # ST25TB read/write protocol
└── ui/
├── display.rs # TFT display rendering
└── editor.rs # Chip data editor
- MCU: ESP32-S3 (Dual-core LX7, 240MHz)
- Framework: esp-hal (bare metal, no_std)
- Display: ST7789V 170x320 TFT
- NFC: PN532 via I2C at 100kHz
- Protocol: ISO14443-B
- "Observer Effect" - Device may only work reliably with serial monitor connected (USB power initialization quirk)
- PN532 Wakeup - First SAM config may fail; firmware retries automatically
MIT License - see LICENSE file.
Contributions welcome! Please open an issue or PR.
- esp-hal - ESP32 Hardware Abstraction Layer
- LilyGO - Hardware documentation
- PN532 Datasheet
- ST25TB Datasheet

