The NFC UART Example shows how to exchange custom data over NFC between the tag device and the poller device. Each of these devices collects incoming UART data and sends it over NFC. Similarly, the devices also collect incoming NFC data and send it over UART.
When the application starts, it initializes the NFC tag and the UART peripheral. Then, it sets up the NFC library for Type 4 Tag platform, which senses the external NFC field and handles NFC communication. In this example, the library works in Raw ISO-DEP mode, which is always configured by default. In this mode, all APDU exchanges are handled by the application.
Events handled by the application are mostly the NFC events. Each of these events is related to the following LED actions:
NFC event | LED action |
---|---|
NFC field on | LED 1 is lit. |
NFC data indication | LED 2 is lit, when ISO-DEP chaining is active. |
NFC field off | All LEDs are turned off. |
When the NFC tag is selected by the poller device (indicated by LED 1), the UART data exchanges can start.
The NFC UART Example shows the usage of the NFC Type 4 Tag module.
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\nfc\nfc_uart\tag
The example requires the Adafruit PN532 NFC Shield.
When the example application starts, it initializes the Adafruit PN532 NFC Shield and the UART peripheral. Then, it waits for a Type 4 Tag to appear in the field. When a tag is detected, the UART data exchanges can start.
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\nfc\nfc_uart\poller
Test the NFC UART Example with a smartphone or a tablet with NFC support by performing the following steps: