For this example we are using the PN532 RFID/NFC shield from Adafruit. This this design writes a MiFare classic RFID card with the URL http://www.cypress.com/?id=4749 . This allows an NFC enabled smartphone to open the Cypress.com PSoC 4 page when the programmed RFID card comes within range.
Forum Post Attachments:
At the bottom of this post we are including the following items:
- Example Project Zip File
- Project Images
The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:
The main.c firmware is included in the example project. Please review the commented sections for more details.
As part of this design we include two design files, Adafruit_NFCShield.h and Adafruit_NFCShield.c that provide the user an interface to the shield using I2C. These two files were adapted from the .h and .cpp files provided on the shield web page. The modifications included porting the C++ code to C and porting the I2C code to use the SCB in PSoC 4. So when performing any MiFare designs it will be helpful to include these files in your design.
This example is design to support a programming flow for the RFID tags. Here’s a description of the firmware’s states:
- State 0: Board has initialized successfully. LED glows green for 2 seconds.
- State 1: Ready/Waiting to program RFID tags. LED glows yellow.
- State 2: Programming RFID tag. LED flashes yellow.
- State 3: Programming finished successfully. LED glows green for 2 seconds. Return to state 1.
- State 4: Programming failed. LED glows red for 2 seconds. Return to state 1.
The shield needs to soldered with the standard headers, as instructed on the Adafruit webpage.
Be sure to include the SCL and SDA connections on the top-left corner of the board. This is how the SCB I2C will communicate with the board.
Test Your Project:
Connect your NFC shield to the pioneer board, program the board, and then configure your RFID tag with the Cypress URL. Verify that the NFC tag works by using an NFC device.
I hope this example can help you in your design.