The idea is to read all bytes of the NDEFMessage and then parse them with the following call:
var ndefMessage = NdefLibrary.NdefMessage.fromByteArray(byteArray);
I managed to load the minified version of the library within espruino, I just need to read all the bytes of the tag.
So I started modifying the PN532 module in an own fork and created the function findCardsAllBytes, which looks like this:
PN532.prototype.findCardsAllBytes = function(callback) {
this.cmd([C.PN532_COMMAND_INLISTPASSIVETARGET,
1, // max targets (max=2)
C.PN532_BRTY_ISO14443A // modulation type
]);
var p = this;
setTimeout(function() { // wait for NFC poll (30ms)
var d = p.i2c.readFrom(C.PN532_I2C_ADDRESS, 20+1).slice(1);
if (d[6]==C.PN532_COMMAND_INLISTPASSIVETARGET+1) {
if (d[7]!=1) print("Expecting 1 tag, got "+d[7]);
callback(d);
}
}, 30);
};
Do you have an idea which I2C commands I need to read all the raw bytes of the tag?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I would like to create an NFC tag reader using a PN532. In the end I would like to read NDEF messages from any NDEF tag.
The general interfacing already works. I wired up the MDBT42Q breakout and a PN532 breakout board.
Using the PN532 module I am able to read the card id, as it's shown in the tutorial.
Now, I would like to read all bytes and parse an NDEF message with the library https://github.com/andijakl/ndef-nfc/.
The idea is to read all bytes of the NDEFMessage and then parse them with the following call:
I managed to load the minified version of the library within espruino, I just need to read all the bytes of the tag.
So I started modifying the PN532 module in an own fork and created the function findCardsAllBytes, which looks like this:
Do you have an idea which I2C commands I need to read all the raw bytes of the tag?
Thank you!
Martin