RFID & NFC · lesson 6 of 8
Find the limits on your own bench
Seven experiments that each push one setting until something breaks: the SPI clock, receiver gain against distance, how fast the card answers, how long each step takes, polling against the IRQ wire, the chip's CRC unit against the ESP32, and hundreds of reads in a row. Each one draws a chart on the screen and prints a table you can paste below.
Measure where your own bench breaks, and compare it with the datasheet.
You're done when
- You know the highest SPI clock with 0 errors, your card's reply time, and the read success rate held still.
- Your tables are pasted into the Experiments panel above, next to the example.
On the board
You will learn
- measured vs datasheet
- SPI signal integrity
- timeouts & reply time
- IRQ vs polling
- offloading
- reliability statistics
uv run pio run -d labs/rfid-lab-r6 -e rfid-lab-r6 -t uploadParts required
Parts library- ESP32-S3-DevKitC-1 + USB-C data cable
- 1.9″ ST7789 screen
- RC522 card reader
- MIFARE card and key fob
Experiments
One tab per experiment: what it pushes, what to look for, the example result, and a box for your own table.
RF read-range and timing benchmark plotting MFRC522 antenna coupling limits across distance and angle. One tab per experiment: what it pushes, what to look for, the example result, and a box for your own table.
- Key concepts: measured vs datasheet, SPI signal integrity, timeouts & reply time, IRQ vs polling, offloading, reliability statistics.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
What the screen shows
The board's screen has six views. A click on the push button (or BOOT) goes to the next one, a double-click runs the action written at the bottom left, a long press pauses card polling. Pick a view to see what each part means; the numbers match the list below it.
Gallery of ST7789 display screens rendered during the RC522 RFID labs. The board's screen has six views. A click on the push button (or BOOT) goes to the next one, a double-click runs the action written at the bottom left, a long press pauses card polling. Pick a view to see what each part means; the numbers match the list below it.
- Key concepts: measured vs datasheet, SPI signal integrity, timeouts & reply time, IRQ vs polling, offloading, reliability statistics.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
Commands, in order
Type these in the serial monitor (uv run pio device monitor) unless the grey tag says otherwise. The coloured tag says what should be near the board while it runs.
uv run pio run -d labs/rfid-lab-r6 -e rfid-lab-r6 -t uploadMac terminalcard: doesn't matter- Does
- Flashes lab R6's own firmware: everything from R5, plus the edge view and the seven edge experiments.
helplists exactly this lab's commands. - You should see
rfid-lab-r6: reader task started, then this lab's command list and views.- If not
- “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
edge spiserial monitorcard: doesn't matter- Does
- FIFO loopback at 1 to 40 MHz, then a chip reset. About 1 s.
- You should see
- A table of % wrong per MHz and a bar chart; the 10 MHz bar is outlined (the datasheet limit).
edge crcserial monitorcard: doesn't matter- Does
- 300 checksums by the chip and by the ESP32.
- You should see
- 0 mismatches; the chip much slower (SPI round trips).
edge irqserial monitorcard: doesn't matter- Does
- 30 WUPAs polling, 30 sleeping on the IRQ wire. Run it with the card on, then off.
- You should see
- SPI accesses per command for each; the gap grows a lot with no card.
- If not
- “IRQ never fired”: the IRQ wire (13) is loose.
edge timeoutserial monitorcard on, held still- Does
- Shrinks the chip's wait timer from 25 ms to 40 µs. About 5 s.
- You should see
- 100 % down to ~100 µs, then 0 %: the card's reply time.
- If not
- All 0 %: the card wasn't on the reader.
edge timingserial monitorcard on, held still- Does
- 40 full cycles, each step timed.
- You should see
- min / avg / max µs for WUPA, SELECT, AUTH, READ.
- If not
- “no complete cycle”: hold the card still.
edge gainserial monitorcard on, held still- Does
- 30 tries at each gain step, at one height. Run it close, then at ~3 cm.
- You should see
- % found per gain: all 100 close up; low gains fail first further away.
edge stress 500serial monitorcard on, then move it- Does
- 500 full read cycles (~10 s). Lift or tilt the card slowly while it runs.
- You should see
- Counts per outcome: ok, absent, CRC, protocol… and reads per second.
Steps
0 of 7 ticked. Ticks are saved in this browser.
Double-click on the edge view runs the next experiment. edge spi resets the chip afterwards, in case a fast, garbled write changed a setting. Pull the IRQ wire and run edge irq: the firmware notices and falls back to polling.
Preview: what you should see
Interactive RC522 13.56 MHz RFID reader simulator showing tag detection, VersionReg 0x92, UIDs, and serial monitor logs.
- Key concepts: measured vs datasheet, SPI signal integrity, timeouts & reply time, IRQ vs polling, offloading, reliability statistics.
- Signals & pins: 3V3 (VCC), 3V3 (RC 3.3V), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC).
Interactive diagram loads after page initialization.
ESP32-S3 peripherals used in this lab
Open interactive GPIO pinoutExplore the hardware blocks, pin rules, and registers behind this experiment.
- GPIO and IO MUX
45 pins, and a matrix that routes almost any signal to almost any pin
- SPI
Fast four-wire bus for screens, card readers and flash
- UART
Three serial ports, the one you see in the serial monitor
- CPU
Two Xtensa LX7 cores at up to 240 MHz
- SRAM
512 KB of fast on-chip RAM for your code and data
- ROM
384 KB of factory code: the bootloader and download mode
Troubleshooting & hardware gotchas
See all 17 ESP32-S3 hardware gotchas- What if it does not work or behaves unexpectedly?
- Double-click on the edge view runs the next experiment. edge spi resets the chip afterwards, in case a fast, garbled write changed a setting. Pull the IRQ wire and run edge irq: the firmware notices and falls back to polling.
- If “uv run pio run -d labs/rfid-lab-r6 -e rfid-lab-r6 -t upload” does not work
- “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
- If “edge irq” does not work
- “IRQ never fired”: the IRQ wire (13) is loose.
- If “edge timeout” does not work
- All 0 %: the card wasn't on the reader.
- If “edge timing” does not work
- “no complete cycle”: hold the card still.
- Four pins are read at reset
- GPIO0, GPIO3, GPIO45 and GPIO46 are sampled the moment the chip comes out of reset: they pick the boot mode, the flash voltage, the ROM log and the JTAG source. Anything wired to them must not pull them the wrong way at power-up. After reset they are normal pins again.
- GPIO3 has no pull resistor at reset
- GPIO0 has a weak pull-up and GPIO45/46 weak pull-downs, but GPIO3 floats. When the eFuses make it choose the JTAG source, an outside circuit has to hold it at a clear level.
- GPIO47 and 48 run at 1.8 V on R16V modules
- Modules with the ESP32-S3R16V chip set the flash voltage to 1.8 V, and GPIO47/48 share that supply. A 3.3 V part on those pins sees the wrong levels.
- The pins are not 5 V tolerant
- A high input may go up to the pin's supply plus 0.3 V, so about 3.6 V on a 3.3 V board, and the power pins are rated to 3.6 V at most. 5 V from a sensor or an Arduino can damage the chip: use a level shifter or a divider.