Jump to content
43oh

[Energia Library] NFC card reading with Energia - MF RC 522


Recommended Posts

Hi everybody,

 

>>> UPDATE - Made "proper" Energia Library out of it. Now with proper named methods/class members<<<

 

>>> UPDATE 2 - Added "keywords.txt" file for syntax highlighting, added comments to "Mfrc522.cpp" file explaining methods (thanks to Grant) - Added example to read cards contents of block 1 <<<

 

>>> UPDATE 3 - You need to apply the USCI SPI fix proposed by Spirilis (post #22) in the following thread: http://forum.43oh.com/topic/3237-energia-library-nordic-nrf24l01-library/page-2 , otherwise the card reader won't work! <<<<

 

I wanted to share my results with the MF RC522 RFID reader. I found an article from Grant Gibson (http://www.grantgibson.co.uk/blog/2012/04/how-to-get-started-with-the-mifare-mf522-an-and-arduino/#commentswhere he used a cheap reader from eBay to read Mifare cards.  (http://www.ebay.com/itm/Mifare-RC522-RFID-13-56Mhz-Module-SPI-Interface-with-a-IC-Card-/370690680474?pt=LH_DefaultDomain_0&hash=item564ee2e69a)

 

The command set and technical aspects of the MFRC522 chip can be found in the datasheet: http://www.nxp.com/documents/data_sheet/MFRC522.pdf

 

I have ported the example to Energia. Very simple by removing all Chinese comments and replacing uchar with unsigned chars. 

 

After these changes it works like a charm. 

 

Just connect the following lines:

MOSI LP -> Pin 3 of the module

MISO LP -> Pin 4 of the module

PIn 1.3 LP -> Pin 1 of the module (SS)

Pin 2.2 LP -> Pin 7 of the module (RST)

Pin 1.5 LP -> Pin 2 of the module (SCK)

GND LP -> Pin 6 of the module

VCC LP -> Pin 8 of the module

Pin 5 is not connected.

 

Included is the sketch (Mfrc522.zip) I used. Now onto opening doors and paying electronically!

 

Kind regards, 

 

Eelco

post-298-0-75634400-1372001881_thumb.jpg

post-298-0-50916500-1372001891_thumb.jpg

Link to post
Share on other sites
  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi everybody,   >>> UPDATE - Made "proper" Energia Library out of it. Now with proper named methods/class members<<<   >>> UPDATE 2 - Added "keywords.txt" file for synta

Hi! I got my RC522 up and running this morning and just thought I'd share what worked for me..   I tried running three different Energia-versions of the library, but none of them worked. I tried pri

Okay guys,   Did some work this morning to transform the test code into a proper library. It should be more usable and generic. I haven't made a "keywords.txt". The methods should be self explanator

Posted Images

Well,

 

It is actually not a library, but a simple program using the SPI library. It should be possible to change it into a library though.

 

Quite strange that my source code hasn't been included. I will make it into a zip file and include it in the top post.

 

Kind regards,

 

Eelco

Link to post
Share on other sites

Okay guys,

 

Did some work this morning to transform the test code into a proper library. It should be more usable and generic. I haven't made a "keywords.txt". The methods should be self explanatory when consulting the datasheet. There is only one example that reads cards and recognizes specific cards. 

 

I works like a charm however and can be added to the Energia libraries.

 

I have replaced the original file with the library zip in the top post. I think the library also works with the stellaris launchpad.

 

Kind regards, Eelco

Link to post
Share on other sites
  • 4 weeks later...
  • 2 weeks later...

Hi Eelcor

Not working for me. The sketch (Block1) compiles and uploads but it's not reading cards.

I've tested the reader on an Uno and it works fine using Grant's sketch.

I'm not getting anything at all in the serial display.

I've setup the Launchpad (G2553) and Duino as below:

RC522 MSP430 Arduino Colour
SAD   1.3   10      Purple
SCK   1.5   13      Blue
MOSI  1.7   11     Green
MISO  1.6   12     Yellow
IRQ     NA   NA
GND   GND GND Orange
RST    2.2   5       Red
3.3V   VCC 3.3V  Brown
 
Do I need To make any changes to the launchpad?
Any help appreciated
Link to post
Share on other sites

Whoa,

 

I haven't been checking this library lately because it has been very busy at work. And now I have a news item...how cool!!! (Sorry kinda new to these things).

 

I am going to check your setup now and compare it to mine. Another detail that might work is to correct the SPI bug. @bluhash I forgot where the fix is, can you remember. I needed it to get the nrf24l01 working and this could be also the solution for D69.

 

Greetings, Eelco

Link to post
Share on other sites

Yup,

 

That should do the trick. I think I have reproduced your error. The card is detected 2 times in my case, but the data is corrupted, so it gives the wrong output. I applied the usci spi fix from my earlier post et voila, it works like charm! Can you try it as well?

 

Kind regards, Eelco

Link to post
Share on other sites

Yes! That sorted it (well that and me stopping being a window-licker and changing the TX/RX jumpers, but did that 1st and got corrupted output) thanks ever so much. Now I just need to get it to recognise my phone :D

Fantastic work!

 

Cheers

Dean

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...