RoadTest: NXP NTAG I²C Demo Kit
Author: bose
Creation date:
Evaluation Type: Independent Products
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: PN532 NFC Shield for Arduino
What were the biggest problems encountered?: Programming of the demo board is not possible without the RF field and do debugging is possible without dedicated power injection into the system.
Detailed Review:
I received the NTAG Demo Kit after bit of issues with the delivery. It was a Friday evening and a nice time to begin hacking into NFC.
First let me introduce the idea and the problem use-case that I wished to address using this board.
One of the common use case scenarios for coupon or feedback at restaurants.
Its usually not so straight forward to process, share stuff and get info from customers.
The Restaurants try to attract visitors and make repeat visitors by distribution of coupons or collecting feedback.
In bigger restaurants they offer the customer with android tablet for feedback or at least a paper form to be filled.
Generally there are too many things and people hesitate to share their contacts.
NFC can be put to good use in this scenario.
The NTAG I2C device is a Type 2 NFC forum card. Hence it can store and respond data via NFC NDEF format.
The customer after a meal can tap their phone to obtain coupons directly from the table with the embedded NTAG-I2C board.
The restaurant owner can offer future discounts and coupons directly to the Customer's phone via the NTAG-I2C enabled into the table.
The customer now has the code to be used for their next visit without sharing too much info.
The same can be used for publicity. The NTAG I2C device can store special NDEF messages that trigger hyperlinks or apps on the smartphone with NFC.
If the customer taps their mobile phone with NFC on the table, the app in the phone publish an update to twitter or Facebook.
That way they share what they had that time in the particular restaurant among their friends and family.
This is great publicity opportunity for the restaurant owners.
Update of information can be processed via the microcontroller talking to the NTAG-I2C chip via I2C bus.
Also using same microcontroller one can obtain feedback on how many times the phone is tapped.
That can be used to input the number of stars the customer wishes to give for that meal.
There are so many possibilities that can be derived out of this board.
Keeping this use-case in mind lets now look at how good the NTAG-I2C demo kit actually performs.
Well this kit definitely lacks the schematics. Although all the design files are available but the schematics are missing.
One needs to open the design fines in Eagle to actually obtain the info on the schematics.
I am attaching the PDF of the LPC812 board (Schematics-NTAG_I2C_LPC812_Demoboard_CW1442) and the NTAG-I2C side ( Schematics-NTAG_I2C_Class5_V13.pdf ).
Apart from this, the application notes are in good detail and help to understand the Android Application.
However in my case I am using a Windows Phone. The default app is not available for Windows Store yet.
Hence I have to patch that by using another app called NFC Commander.
The NDEF messages required to trigger the specific use cases in the demo program were not very clear.
Primary Documentation Link: Demoboard for NFC connected tag chips :: NXP Semiconductors
The example application provided under the SW309111 is a simple example of LED changing colors. However since I did not have an Android phone so I tried my luck with the NFC enabled Windows phone.
I have modified this code to make it easy to demonstrate the functionality in a Video.
int main(void) { Setup(); // Initialize main buffer used to read and write user memory uint8_t rxbuffer[4 * NFC_BLOCK_SIZE]; uint8_t txbuffer[2 * NFC_BLOCK_SIZE]; memset(rxbuffer, 0, 4 * NFC_BLOCK_SIZE); memset(txbuffer, 0, 2 * NFC_BLOCK_SIZE); // prepare defined state for SRAM NFC_DisableSRAM(ntag_handle); // If Button1 is pressed, read NDEF message from EEPROM and light up according LED color uint8_t Buttons = 0; check_Buttons(&Buttons); if (Buttons == 0x01) { //Read NDEF from EEPROM NFC_ReadBytes(ntag_handle, NFC_MEM_START_ADDR_USER_MEMORY, rxbuffer, 4 * NFC_BLOCK_SIZE); // find the start position of the NDEF message short int start_idx = findNDEFStartIdx(rxbuffer, 4 * NFC_BLOCK_SIZE); // light up the according LED if (strncmp((char*) &rxbuffer[start_idx], "red", 3) == 0) { HW_switchLEDs(REDLED); } if (strncmp((char*) &rxbuffer[start_idx], "blue", 4) == 0) { HW_switchLEDs(BLUELED); } if (strncmp((char*) &rxbuffer[start_idx], "green", 5) == 0) { HW_switchLEDs(GREENLED); } } else if (Buttons == 0x02) { reset_AAR(); } else { // Discrete Test for data in NTAG-I2C memory // Default Update NFC_ReadBytes(ntag_handle, NFC_MEM_START_ADDR_USER_MEMORY, rxbuffer, 4 * NFC_BLOCK_SIZE); // find the start position of the NDEF message short int start_idx = findNDEFStartIdx(rxbuffer, 4 * NFC_BLOCK_SIZE); // light up the according LED if (strncmp((char*) &rxbuffer[start_idx], "red", 3) == 0) { HW_switchLEDs(REDLED); } if (strncmp((char*) &rxbuffer[start_idx], "blue", 4) == 0) { HW_switchLEDs(BLUELED); } if (strncmp((char*) &rxbuffer[start_idx], "green", 5) == 0) { HW_switchLEDs(GREENLED); } } #ifdef INTERRUPT // If Interrupted Mode is enabled set the FD Pin to react on the SRAM NFC_WriteRegister(ntag_handle, NTAG_MEM_OFFSET_NC_REG, NTAG_NC_REG_MASK_FD_OFF | NTAG_NC_REG_MASK_FD_ON, NTAG_NC_REG_MASK_FD_OFF | NTAG_NC_REG_MASK_FD_ON); #endif // Main Loop while (1) { // Enable Passthrough Mode RF->I2C NFC_SetPassThroughRFtoI2C(ntag_handle); NFC_EnableSRAM(ntag_handle); // wait for RF Write in the SRAM terminator page while (NFC_WaitForEvent(ntag_handle, NTAG_EVENT_RF_WROTE_SRAM, SRAM_TIMEOUT)) { // check if PT is off(happens when NTAG is not in the field anymore) // and switch it back on uint8_t reg = 0; NFC_ReadRegister(ntag_handle, NFC_MEM_OFFSET_NC_REG, ®); if (!(reg & NFC_NC_REG_MASK_TR_SRAM_ON_OFF)) { NFC_SetPassThroughRFtoI2C_withEn(ntag_handle); } LED_blink(GREENLED);// Adding Activity LED } // get the SRAM Data memset(sram_buf, 0, NFC_MEM_SIZE_SRAM); NFC_ReadBytes(ntag_handle, NFC_MEM_START_ADDR_SRAM, sram_buf, NFC_MEM_SIZE_SRAM); // Check for requested action Speedtest or LEDDemo // ---- Speedtest ---- if (sram_buf[NFC_MEM_SIZE_SRAM - 4] == 'S') { // run speed test error_code = speedTest(); // let the Green LED blink if Speedtest was successful if (error_code) { HW_switchLEDs(LEDOFF); } else { LED_blink(GREENLED); } } // ---- LedDemo ---- else if (sram_buf[NFC_MEM_SIZE_SRAM - 4] == 'L') { // turn on the according LED if (sram_buf[NFC_MEM_SIZE_SRAM - 3] == '1') { HW_switchLEDs(REDLED); } if (sram_buf[NFC_MEM_SIZE_SRAM - 3] == '2') { HW_switchLEDs(BLUELED); } if (sram_buf[NFC_MEM_SIZE_SRAM - 3] == '3') { HW_switchLEDs(GREENLED); } if (sram_buf[NFC_MEM_SIZE_SRAM - 3] == '0') { HW_switchLEDs(LEDOFF); } // Check Buttons and Temperature, put data in SRAM buffer uint8_t Temperature[2]; check_Buttons(&Buttons); HW_getTemp(Temperature); sram_buf[NFC_MEM_SIZE_SRAM - 6] = Temperature[0]; sram_buf[NFC_MEM_SIZE_SRAM - 5] = Temperature[1]; sram_buf[NFC_MEM_SIZE_SRAM - 2] = Buttons; // write back Data NFC_SetPassThroughI2CtoRF(ntag_handle); NFC_WriteBytes(ntag_handle, NFC_MEM_START_ADDR_SRAM, sram_buf, NFC_MEM_SIZE_SRAM); // waiting till RF has read while (NFC_WaitForEvent(ntag_handle, NTAG_EVENT_RF_READ_SRAM, 10)) ; } else if (sram_buf[NFC_MEM_SIZE_SRAM - 4] == 'V') // ---- Version information ---- { memset(sram_buf, 0, NFC_MEM_SIZE_SRAM); int index = 0; memcpy(&sram_buf[index], "Board Ver.: ", 12); index = 12; sram_buf[index++] = CHAR_BOARD_MAJ; sram_buf[index++] = '.'; sram_buf[index++] = CHAR_BOARD_MIN; sram_buf[index++] = '\n'; memcpy(&sram_buf[index], "FW Ver.: ", 12); index += 12; sram_buf[index++] = CHAR_FW_MAJ; sram_buf[index++] = '.'; sram_buf[index++] = CHAR_FW_MIN; sram_buf[index++] = '\n'; // write back Version information NFC_SetPassThroughI2CtoRF(ntag_handle); NFC_WriteBytes(ntag_handle, NFC_MEM_START_ADDR_SRAM, sram_buf, NFC_MEM_SIZE_SRAM); // waiting till RF has read while (NFC_WaitForEvent(ntag_handle, NTAG_EVENT_RF_READ_SRAM, 10)) ; } } // never leave this function while (1) { __WFE(); } return 0; }
There are two Key changes in the Code:
1. Additional Direct data read for the NDEF block: Line 35 in the Above code
2. Indication of Activity using the Green LED: Line 78 in the Above code
The similar modification into the code can help to actually demonstrate the customer feedback.
Here is a video demonstrating this code in action:
The performance of the board was very good. Also its very easy to interface the actual NTAG-I2C device since it takes very few components.
The software driver to access the the NTAG I2C functions on the higher layer have been written in a modular manner and hence easy to port to any microcontroller.