carglglz / nfc_pn532_spi Goto Github PK
View Code? Open in Web Editor NEWPartial Port of Adafruit CircuitPython to Micropython of PN532 NFC/RFID control library (SPI)
License: MIT License
Partial Port of Adafruit CircuitPython to Micropython of PN532 NFC/RFID control library (SPI)
License: MIT License
Sorry for bothering you but I was looking at your NFC library with the hope I could use it for (at least) reading NTAG213 tags (ultimately I would like to read the NDEF data).
With limited micropython experience as my luggage I looked at the coding. Although it refers to methods labeled NTAGxxx_read/write, it is not apparent to me how to make this work.
Any suggestion you are able & willing to share it highly appreciated.
Thx a lot !
Hello,
I'm running your library on an ESP32. In my testing, if the tag is present at the reader when I call read_passive_target(), things work as expected.
But if I present the tag to the reader after the call has already been made, but before the timeout period (left at default, 1 second) has expired, I get no response.
Expected behavior: a tag presented before the timeout expiration would be returned.
Am I misunderstanding something or is this not working as intended?
Thanks for porting this code!
Hi, I put this post in the issuu, but actually it's not a real problem. I'm implementing a couple of new functions to your library the first one involves reading single, byte given the specific number of bytes to read. I need this because to read a multi-record tag, I need to know certain bytes. But now I find it difficult to write a certain byte.
The function :
def mifare_classic_read_block(self, block_number):
expects that you pass it the block and a 4-byte data array. I need to write the byte directly, is this possible?
I attach the lines of code that I wrote to be able to read the single byte
`
def ntag2xx_read_byte(self, byte_number):
"""Read a block of data from the card. Block number should be the block
to read. If the block is successfully read a bytearray of length 16 with
data starting at the specified block will be returned. If the block is
not read then None will be returned.
position = (byte_number-4*(byte_number//4))-1
block_number = byte_number//4
"""
posiyion = (byte_number-4*(byte_number//4))
block_number = (byte_number//4)+4
return self.mifare_classic_read_block(block_number)[position:1+position] # only 1 bytes per page``
`
As you can see, I pass the position of the byte and the function returns the value.
This feature allows me to read a single byte memory dump, which makes things easier for me when parsing the NDEF Message.
From my research, an NDEF Message begins with 0x03h (should be a byte indicating the ISO 14333-3A encoding) the second byte indicates the length of the message, the actual message starts from the third byte.
The message is divided into records and records have a header and a payload.
The header is made up of N bytes, it depends on 8 bits which act as flags.
I made a couple of functions to establish the value of the header and then its subsequent bytes, The payload starts with the byte of the UTF8 or UTF16 encoding type, I have always encountered UTF8 which is 0x02h which are then the next two bytes for the encoding , in most cases, "en" for english.
finally the real payload starts.
in my test, I manage to extrapolate all single records, which I load into a multiple array, where the first value is an array representing the first bytes, in order:
So, if I could write to the 10th byte, say 62, the payload would be UTF8 "en" baa instead of UTF8 "en" aaa
Thanks for your attention and I hope you can/want to help me
I'm pretty new to programming in general but is working on a solution to emulate different kinds of Mifare-tags to be read by external Mifare readers.
I have a Pycom MCU and from what I'm reading the PN532 should make it possible to emulate a Mifare Classic UID tag. Is this correct? Also I'm wondering which function I should call in the library and if you have any more information on how it works?
The idea is to send a pre-defined UID number to the Pycom and have it forward it through the PN532 to be read by an external reader.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.