Giter Club home page Giter Club logo

nfc_pn532_spi's People

Contributors

carglglz avatar dracode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nfc_pn532_spi's Issues

using your library to read ntag213

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 !

read_passive_target() not recognizing tags not present from the start

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!

How to write single byte

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:

  • record header;
  • byte 0x01h should be the number of successive byte(s) for the real length of the payload;
  • payload length ;
  • payload type, example 0x54h (T = Text);
    -this byte 0x02h is the UTF8 encoding byte with two bytes for the language;
  • first byte language;
  • second byte language.
    After this list, I put the payload as the second value in the list, and so on until the end of the records.
    Now let's get to the point, if you help me write a function in NFC_PN532.py
    that allows me to directly write the single byte in the memory location that interests me, I would be able to change the value of the payload. always staying within its length. This can be done knowing that the value of the record header contains the length of the payload.
    Very important, the length of the payload starts from the UTF encoding byte, so a dump of a part of the NDEF message like this :
    03 ... 91 01 06 54 02 65 6e 61 61 61
    it means :
  • 03 ISO14333-3A
  • ... length of message ;
  • 91 that the records are more than 1;
  • 01 next byte is payload length;
  • 06 payload length 6 bytes;
  • 54 the payload is of text type;
  • UTF8 encoded (it's also the beginning of the payload);
  • e ;
  • n ;
  • a;
  • a;
  • a.

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

Emulate Mifare UID

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.