Loading...

You have no items in your shopping cart.

 
 
 
×

Registration

Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

To Drive ITEAD PN532 NFC Module with Raspberry PI (obsolete blog)

ITEAD PN532 NFC module is equipped with double-row pin, which can be connected directly to the Raspberry Pie via connection cable and then drive the module for non-contact near field communication operations, such as reading and writing 13.56M IC card with our ITEAD PN532 NFC SPI Library.

First, before installing the library offered by us, we need to modify some of the configurations of Raspberry Pie to make SPI module automatically activated when powering on:
cd / etc / modprobe.d /
Enter the Configuration folder
sudo nano raspi-blacklist.conf
Open the configuration file as super user
# blachlist sip-bcm2708
Comment out that line, to achieve SPI module loading when powering on.

Then, you can unzip the library we provided. Let’s take placing to the desktop as an example:
cd / home/pi/Desktop/ITEAD_PN532_NFC
Enter the Library folder
make install
Install ITEAD PN532 NFC library
Thus our database has been compiled and installed. As long as the project file contains nfc.h, functions in the library can be called. During compiling, the called library functions can be compiled by adding –INFC in the command line.

Take DEMO provided in our library as an example:
gcc readID.c -o readID -l NFC
Compile readID routine file
sudo. / readID
Run the compiled routine file – as long as 13.56M IC card approaches NFC module, the ID N.O, of the card will be displayed on the monitor.

Following is a brief description of some of the functions in the library:

FUNCTIONS:

Begin(): Begin to communicate with the ITEAD NFC module
Parameters:NULL
Return:NULL
Usage:begin();

SAMConfig(): Configure RPI to read RFID tags and cards
Parameters:NULL
Return: false or true
Usage:SAMConfig();

getFirmwareVersion(): Get the firmware version of the NFC module
Parameters:NULL
Return: the number of the firmware version(fail will return 0);
Usage: I = getFirmwareVersion();

readPassiveTargetID(uint8_t cardbaudrate): Get the passive target card ID
Parameters: cardbaudrate;
Return: the ID of the card(fail will return 0);
Usage: I = readPassiveTargetID(PN532_MIFARE_ISO14443A);

authenticateBlock(cardnumber, cid, blockaddress, authtype, * keys): Authenticate the block
Authenticate the block
authenticateBlock(cardnumber, cid, blockaddress, authtype, * keys)
Parameters: 
uint8_t cardnumber: 1 or 2;
uint32_t cid: Card NUID; 
uint8_t blockaddress:0 to 63;
uint8_t authtype: Either KEY_A or KEY_B; 
uint8_t * keys
Return: true or false;
Usage: authenticateBlock(1,id,0x08,KEY_A,keys);
readMemoryBlock(cardnumber, blockaddress, block): Read a block(16 bytes) from the tag and stores in the parameter
Parameter:
-uint8_t cardnumber, can be 1 or 2; 
-blockaddress, range from 0 to 63;
-uint8_t* block, will save 16bytes that read from tag.   
Return: true or false 
Usage: readMemoryBlock(1,0×08,block);

writeMemoryBlock( cardnumber, blockaddress, * block): Write a block(16 bytes) to the tag
Parameter:
-uint8_t cardnumber,can be 1 or 2; 
-blockaddress,range from 0 to 63;
-uint8_t* block,saves 16bytes that will write to the tag.  
Return: true or false
Usage: writeMemoryBlock(1,0×08,writeBuffer);

  ITEAD Raspbrerry PI PN532 NFC Library (36.0 KiB, 7,364 hits)

Related article: