eelcor 18 Posted June 22, 2013 Share Posted June 22, 2013 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/#comments) where 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 pine, kimikien, Rustik and 5 others 8 Quote Link to post Share on other sites
bluehash 1,581 Posted June 23, 2013 Share Posted June 23, 2013 @@eelcor Good job! You forgot to put in the library. I'll move this to Energia libraries, once you do. Also post a pic of your setup. Quote Link to post Share on other sites
energia 485 Posted June 23, 2013 Share Posted June 23, 2013 Awesome! I love it when code just runs on MSP430 with minimal changes. Keep it up! Quote Link to post Share on other sites
eelcor 18 Posted June 23, 2013 Author Share Posted June 23, 2013 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 Quote Link to post Share on other sites
eelcor 18 Posted June 23, 2013 Author Share Posted June 23, 2013 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 bluehash 1 Quote Link to post Share on other sites
Dwhitfield 0 Posted July 20, 2013 Share Posted July 20, 2013 Doesn't work. Quote Link to post Share on other sites
bluehash 1,581 Posted July 20, 2013 Share Posted July 20, 2013 Doesn't work. You need to provide more information. Welcome to 43oh! Quote Link to post Share on other sites
D69 3 Posted August 2, 2013 Share Posted August 2, 2013 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 Quote Link to post Share on other sites
D69 3 Posted August 2, 2013 Share Posted August 2, 2013 Pic of my setup if it helps. Cheers http://db.tt/DPKIrBAA http://db.tt/Ciz7L2iS Quote Link to post Share on other sites
bluehash 1,581 Posted August 2, 2013 Share Posted August 2, 2013 Pic of my setup if it helps. Cheers http://db.tt/DPKIrBAA http://db.tt/Ciz7L2iS Hi D69, could you upload to 43oh. I cannot see your images. Quote Link to post Share on other sites
eelcor 18 Posted August 2, 2013 Author Share Posted August 2, 2013 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 Quote Link to post Share on other sites
eelcor 18 Posted August 2, 2013 Author Share Posted August 2, 2013 Your setup seems to be okay... Try to fix the spi bug, that could be the problem. What isn't working exactly? Quote Link to post Share on other sites
eelcor 18 Posted August 2, 2013 Author Share Posted August 2, 2013 D69, could you fix the SPI handler? It is described in this thread: http://forum.43oh.com/topic/3237-energia-library-nordic-nrf24l01-library/page-2 It should be post #22 by Spirilis. This is the fix I also applied... If it works I will put it in de the index page as well! Kind regards, Eelco Quote Link to post Share on other sites
eelcor 18 Posted August 2, 2013 Author Share Posted August 2, 2013 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 D69 1 Quote Link to post Share on other sites
D69 3 Posted August 2, 2013 Share Posted August 2, 2013 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 Fantastic work! Cheers Dean Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.