Comments (4)
For the NTAG213, that is completely incorrect. The lock bytes are saying "Lock at page 0x28, 16 bytes per lock bit, 16 lock bits". The lock is at page 0x28 but there are 8 bytes per lock bit and 12 lock bits. No NTAG has 16 bytes per lock bit - The 215/216 are 64 bytes per lock bit.
Lock control TLV section 2.2.2 says "can be present" not "shall be present". But I believe it does matter, at least for the NTAGS. The spec says that the lock area starts from the first byte after the data area. Also it has a default view for the number of lock bits (103 by default for NTAG216!)
However for some bizarre reason, the CC for the NTAG215 indicates a space that is 8 bytes short. The NTAG216 is 16 bytes short. If you used the CC to find the size of the data area and thus the dynamic lock area and, beyond that, the cfg pages, well... you'd be pretty wrong!
Eg: NTAG216: The CC has the value "0x6D". Multiply that by 8 = 872 bytes or DA blocks. Which means the lock area should be at 0xDE. Which is wrong because the NTAG216 data area is 888 bytes placing the lock area at 0xE2.
PS: The NTAG "get version" call returns the stupidest values imaginable. It returns a memory size as a range 2^n to 2^n + 1. In tandem with the incorrect default CC values you need a lookup table to determine the type of NTAG, it's actual memory size and thus the location of the config area! What are NXP smoking!?
from adafruit-pn532.
I wonder what the purpose of the NDEF Lock Control TLV element is. To make any sense, it would have to provide information that is not otherwise present (e.g. via GET_VERSION). The information must also be "useful" in the sense that e.g. a future new NTAG chip can be used without updating the reader/writer software.
I don't see this with the NTAG2xx chips. If a new one comes to market (say one with more memory), the presence of an NDEF Lock Control TLV element would not help at all to avoid updating a tag writing software. For reading an NDEF message, the lock bytes are irrelevant, so the Lock Control in not needed anyway.
IMHO, the NDEF Lock Control TLV element should not be written at all when an NTAG2xx is used for NDEF purposes. This gives you five more bytes of user data to use, without sacrificing anything.
I sill don't know what the correct value would be. NXP themselves say that you can only determine the number of lock bits, and the start address of the lock bytes. They claim "Note that it is not possible to retrieve the locking structure of the dynamic lock bits i.e. location of the block-locking bits and the lock bit – locked area association."
So all the more: How does it help me as a programmer when I only know half of the information I need in order to lock? In order to lock, I need to know the used chip in detail, and program this information into my application. I guess I would never rely on the NDEF Lock Control TLV element, and thus is seems superfluous.
from adafruit-pn532.
Hmm. Yes, what you say is absolutely true as I'm finding out myself (I'm writing NTAG/NFC code now. In Pic assembly for some reason). Get version (indirectly) tells me which NTAG I have. Which I need to know in order to "format" it to use it for NDEF messages. Even if the CC was right (which it isn't) by default, it can be changed so that doesn't help. And a TLV is totally pointless in this regard because some NTAGs have them and some don't.
The tag 2 specification does indeed tells you about the locking bits not, as you say, other structure - ie: the block-locking bits. I did assume that the lock-bit to locked area association was linear. I can't find an NTAG which isn't - ie: doesn't run LSBbit to MSbit, byte 0 to byte 1. The size of the lock area is dictated (in the tag 2 spec) by a default (which is 8) or by the Lock TLV.
BTW, the dynamic lock area is one time programmable (0->1 only) even though the datasheet doesn't tell you.
Ok. So the only device a lock TLV would help is one that is reading an pre-created properly formatted tag and would like to lock it to read-only. In which case it could read the Lock TLV to find out where the dynamic lock area starts and then just write 0xFF to both bytes. Which would do the job because the block-locking bits don't matter then.
Er. Does anyone actually do this? Or care? I can't imagine someone has an Android app that has a "lock this tag permanently" button. So I'm conflicted at the moment as to whether I'll bother writing them. For the NTAG212,213,215,216 I work them out as:
- NTAG212 = 90 0A 34
- NTAG213 = A0 0C 34
- NTAG215 = 88 08 66
- NTAG216 = E8 0E 66
from adafruit-pn532.
Closing for now due to age of issue. Can reopen if a simple example sketch can be provided that demonstrates an issue.
from adafruit-pn532.
Related Issues (20)
- ESP32 I2C sharing was working fine HOT 2
- ESP32 + SPI mode in a thread = nightmare
- Android HCE random ID HOT 1
- bool isready() function can be public? HOT 2
- buffer allocation too small HOT 1
- buffer allocated is too small HOT 1
- I2C PN532 on Pi Pico doesnt work updating to 1.3.0 HOT 8
- PN532 as_target change uid
- iso15693
- No ACK Frame on ESP32 + SPI, hangs after first tag read or no tag reads (With solution) HOT 5
- Compilation error when enabling debug in Adafruit_PN532 lib HOT 3
- Compilation error with RESET_PIN on GPIO0 on ESP32 HOT 2
- Hardware SPI not working on Arduino Giga R1 HOT 1
- IRQ functionality not working as expected. HOT 4
- InDataExchange() has wrong size limits
- UART, I2C do not work with esp32 HOT 5
- Clarification about "as target" example
- np532 (i2C) soft-powerdown mode
- Problems combining Adafruit_PN532.h V1.2.2 (SPI) with Ethernet.h V2.0 HOT 1
- PN532 Shield - can you start/stop the read function? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit-pn532.