Code Monkey home page Code Monkey logo

mfrc630's Introduction

MFRC630

This is a library for NXP's MFRC630 NFC and reader IC. It is likely that it also works for other IC's in the same family, such as the CLRC663, MFRC631, MFRC630 and SLRC610. The library is platform independent and is likely to work on many different microcontrollers, it is known to work on the Arduino compatible Teensy and on an STM32F0xx chip.

Design

The library itself is written in C, it requires the chip to be connected to the SPI interface, furthermore, it can only deal with a single chip that's connected to the microcontroller. The library does not require time or delay functions neither does it need an interrupt pin, all that is required is the SPI bus. The handling of timeouts is done by using one of the chip's timers.

The library is clearly structured, providing functionality from low level to higher level:

  • HAL: Three functions are to be created to allow the library to interact with the SPI bus.

  • Register interaction: The adresses for all registers are provided as define statements, functions for FIFO reading and writing are available, as well as reading and writing normal registers. For various important registers there are additional define statements available that make it easier to interact with these.

  • Commands: The chip can be instructed to execute various commands, these functions provide wrappers for these and handle the arguments required for each command.

  • ISO14443A: Provides the necessities from ISO14443a to interact with RFID tags: the REQA, WUPA and SELECT procedure (with collision handling) to determine the UID(s).

  • MIFARE: Provides functions to authenticate, read and write blocks on MIFARE cards.

Documentation

The header files are annotated with Doxygen-style comments, running make doxygen in the documentation folder will output the documentation in html form. Additionally, running make will also generate output using Breathe.

An example for an Arduino compatible board is provided as well as some pointers for use on an STM32 microcontroller.

Miscellaneous

This chip seems to be significantly less popular than the MFRC522, if you are starting with RFID, that might be a better choice to use, as there is a well-tested library for that chip.

I came across this chip when I was repurposing off-the-shelf hardware to do my bidding; Surprisingly, no library was available for this chip. Improvements / additional examples are welcome.

License

MIT License, see LICENSE.txt.

Copyright (c) 2016 Ivor Wanders

mfrc630's People

Contributors

iwanders 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mfrc630's Issues

collision bug

I found a collision bug.

      // set it to insert zeros in case of a collision, (1<<7)
      // We want to shift the bits with RxAlign
      uint8_t rxalign = known_bits % 8;
      MFRC630_PRINTF("Setting rx align to: %hhd\n", rxalign);
      mfrc630_write_reg(MFRC630_REG_RXBITCTRL, (1<<7) | (rxalign<<4));

should be

      // set it to insert zeros in case of a collision, (0<<7)
      // We want to shift the bits with RxAlign
      uint8_t rxalign = known_bits % 8;
      MFRC630_PRINTF("Setting rx align to: %hhd\n", rxalign);
      mfrc630_write_reg(MFRC630_REG_RXBITCTRL, (0<<7) | (rxalign<<4));

Bug in read_fifo()

Hello,
when some conditions are met (tag is on the limit of the reader range), then it is possible, that reader return rx_len as 0 in mfrc630_iso14443a_select():

uint8_t rx_len = mfrc630_fifo_length();

Then rx_len is used by

mfrc630_read_fifo(buf, rx_len < 5 ? rx_len : 5);

But mfrc630_read_fifo() can't handle zero len (underflow in for's condition)

for (i=0; i < (len - 1) ; i++) {

I fixed it by checking for zero len in mfrc630_read_fifo(),

void mfrc630_read_fifo(uint8_t* rx, const uint16_t len)
{
    if (len == 0) return;

It's working, but I'm not sure, that this is the best solution.

ISO/IEC 18092?

Hello,

Do you have any info on how to advance this library to read ISO/IEC 18092 tags (with CLRC663) ?

Can’t run the code with delay less than 1000ms

If it were to just try and detect the presence of a card for which just need to run the loop code at 5ms delay and just check if (atqa != 0), but with this the arduino is giving output even without the presence of any card.
Is there something we can do?

Missing Function in Example

Thanks for sharing this project.
I noticed that in the Arduino example code, there're references to function calls such as mfrc630_iso14443a_REQA that is not defined anywhere in the project. Could you please help me understand where those are defined?
I'm surprised that people can compile the example code... Am I missing something?

Help wanted with changeable uid

Hi,

I'm using your libray for my reader, but now i'm stuck with extending the functions. I want to support UID-Change on mifare cards. A library for the RC522 can do this by sending commands to the mifare card directly

If you check https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf on Page 13 you can see the commands "Halt" and "Personalize UID". I need to send this commands,

I guess they are similar to the REQUA that already in your code. Any help on how to make a function that can send this commands?

How do I update the key of the buffer

// Use the manufacturer default key...
uint8_t FFkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

  mfrc630_cmd_load_key(FFkey);  // load into the key buffer

FFkey I need to validate the first key before I update it, but I keep calling mfrc630_cmd_load_key(FFkey); This function will fail to verify success, please tell me how to correctly repeat call it

CLRC663

We are using the custom board with the Reader ic is CLRC663 and SPI is used for the interfacing with microcontroller. SPI is configured as mentioned in the Datasheet of the clrc663 reader.The issue is there is no response from the reader.SiPI is working FIne.

**need help for the communication

ISO15693

Hello,

Do you have any info on how to advance this library to read ISO15693 tags (with CLRC663) ?

MFRC UART Communication

I want to Read Version of my MFRC63002 Card Reader using Serial utility like Docklite. please can someone help me out with the commands?Just to understand if my reader is Communicating, Also how do i read UID of My MiFare Classic Card.

Desfire commands

Hi all,

My RFID project is with CLRC663 using stm32l0. So far with the help of the code here I managed to get ATQA, UID, SAK, ATS and also read and write to Mifare classic card, work. However I can not get it work with desfire commands! I need to create application, select it, create file and so on but I could not get the native commands work, I even tried to wrap it with ISO 7816 but still no gain. Is their any library that i can download? Nxp's library is so complicated .
Many thanks in advance.

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.