From 4521366a5b5b87fb46d3cafabbe3ee156697e71c Mon Sep 17 00:00:00 2001 From: maziggy Date: Thu, 26 Mar 2026 10:32:44 +0100 Subject: [PATCH] Fix Read Tag diagnostic failing on NTAG tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The read_tag.py diagnostic script had stale PN5180 NTAG methods: TX CRC was off (should be on), no Crypto1 clear, no IDLE→TRANSCEIVE state reset. Multi-batch reads failed because the PN5180 enters an unrecoverable state after an NTAG READ — requires a full GPIO hardware reset between 4-page batches. Also rejected SAK 0x04 as unsupported, and failed hard when reading past the end of smaller tags (MIFARE Ultralight has 16 pages vs NTAG's 44+). Synced write methods with daemon. --- spoolbuddy/scripts/read_tag.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spoolbuddy/scripts/read_tag.py b/spoolbuddy/scripts/read_tag.py index 0bd62a361..0d7437d2d 100644 --- a/spoolbuddy/scripts/read_tag.py +++ b/spoolbuddy/scripts/read_tag.py @@ -423,6 +423,10 @@ class PN5180: rx_status = self.read_reg(0x13) rx_len = rx_status & 0x1FF if rx_len < 16: + # Tag may have fewer pages than requested (e.g. MIFARE Ultralight + # has only 16 pages). Return what we have so far. + if result: + return bytes(result) print(f" NTAG read page {start_page + pages_read}: rx_len={rx_len} (expected >=16)") return None