Beginner
10 min

Add advanced NFC capabilities into your projects with ST25R3918 and MK22FN512VLH12

NFC transceiver compatible with multiple standards, including ISO14443, ISO15693, and NFC Forum Tag types 1, 2, 4, and 5

NFC 5 Click with Kinetis Clicker

Published Apr 08, 2024

Click board™

NFC 5 Click

Dev Board

Kinetis Clicker

Compiler

NECTO Studio

MCU

MK22FN512VLH12

Fast and efficient NFC communication is just a Click away!

A

A

Hardware Overview

How does it work?

NFC 5 Click is based on the ST25R3918, a multipurpose NFC transceiver from STMicroelectronics that enables NFC reader capabilities, passive peer-to-peer functions, and NFC card emulation. This component is designed to meet the needs of Internet of Things (IoT) applications and various consumer or industrial uses, providing outstanding analog performance. The ST25R3918 chip is adept for many NFC and HF RFID tasks, including applications in consumer electronics, IoT for accessory recognition, parameter adjustments, brand security, access management, customer engagement, and more. It complies with ISO14443 and ISO15693 standards, facilitating various NFC functions such as accessory recognition, brand protection, and consumer interaction, alongside supporting NFC Forum Tag types 1, 2, 4, and 5 in reader mode.

Thanks to its noise-reduction receiver technology, the chip stands out for its excellent read range with minimal power output, even in challenging conditions. It incorporates an advanced analog front end (AFE) and a comprehensive data framing system for NFC-A/B (ISO 14443A/B) readers, offering higher bit rates, and supports NFC-V (ISO 15693) reading up to 53 kbps. Additionally, it facilitates ISO 18092 passive initiation and targeting, along with NFC-A / NFC-F card emulation, enhancing device interaction with Android™ phones and enabling the use of Apple® App Clips through simple NDEF data exchanges. The ST25R3918 also features a low-power wake-up mode that detects cards by measuring the antenna signal's amplitude or phase, coupled with a low-power RC oscillator and wake-up timer that activates the device at set intervals to search for

tags. NFC 5 Click offers flexibility through its support for both SPI and I2C interfaces, selectable via the COMM SEL jumpers. By default, the I2C interface is active, supporting High-speed mode operation up to 3.4MHz, whereas the SPI mode accommodates clock frequencies up to 10MHz. To notify the host MCU of completed commands or external events, like the peer device field, the ST25R3918 signals an interrupt on the IRQ pin. The ST25R3918 has separated power and logic supply pins, and thanks to two onboard jumpers, labeled VCC and VIO, this Click board™ can operate with either 3.3V or 5V power/logic voltage levels. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used for further development.

NFC 5 Click hardware overview image

Features overview

Development board

Kinetis Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit ARM Cortex-M4 microcontroller, the MK22FN512VLH12 from NXP Semiconductor, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access

anywhere and under any circumstances. Each part of the Kinetis Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Kinetis Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for Kinetis programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB-MiniAB connection provides up to 500mA of current, which is more than enough to operate all

onboard and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. Kinetis Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

Kinetis Clicker double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

512

Silicon Vendor

NXP

Pin count

64

RAM (Bytes)

131072

You complete me!

Accessories

RFID tag operating at 13.56MHz adheres to the ISO14443-A standard, ensuring high-frequency communication. This proximity card technology, often exemplified by MIFARE cards, facilitates secure and contactless interactions in applications like access control, public transport, and payment systems. The ISO14443-A standard defines the communication protocol, incorporating anti-collision mechanisms for simultaneous card handling. These RFID tags possess variable memory capacities, ranging from a few bytes to kilobytes, catering to diverse application needs. Ensuring data security, the standard integrates features such as encryption and authentication. These tags, exemplified by MIFARE technology, are widely used for their efficiency and are vital in enhancing convenience and security in diverse identification and access scenarios.

NFC 5 Click accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
ID SEL
PTB3
RST
SPI Select / ID COMM
PTC4
CS
SPI Clock
PTC5
SCK
SPI Data OUT
PTC7
MISO
SPI Data IN
PTC6
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Interrupt
PTD0
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PTB0
SCL
I2C Data
PTB1
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

NFC 5 Click Schematic schematic

Step by step

Project assembly

Kinetis Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Kinetis Clicker as your development board.

Kinetis Clicker front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Kinetis Mini B Connector Clicker Access - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Kinetis Clicker HA MCU/Select Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for NFC 5 Click driver.

Key functions:

  • nfc5_get_mifare_tag_uid - This function reads the UID of a mifare tag

  • nfc5_write_reg - This function writes a desired data to the selected register

  • nfc5_read_reg - This function reads a desired data from the selected register

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * @file main.c
 * @brief NFC 5 Click example
 *
 * # Description
 * This example demonstrates the use of NFC 4 Click board by reading
 * MIFARE ISO/IEC 14443 type A tag UID.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * If there's a tag detected, it reads its UID and displays it on the USB UART every 500ms.
 *
 * @note
 * Only ISO14443-A type tags are compatible with this example.
 * We recommend MIKROE-1475 - an RFiD tag 13.56MHz compliant with ISO14443-A standard.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "nfc5.h"

static nfc5_t nfc5;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    nfc5_cfg_t nfc5_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    nfc5_cfg_setup( &nfc5_cfg );
    NFC5_MAP_MIKROBUS( nfc5_cfg, MIKROBUS_1 );
    err_t init_flag = nfc5_init( &nfc5, &nfc5_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( NFC5_ERROR == nfc5_default_cfg ( &nfc5 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint8_t tag_uid[ NFC5_NFCA_CASCADE_3_UID_LEN ] = { 0 };
    uint8_t tag_uid_len = 0;
    
    if ( NFC5_OK == nfc5_get_mifare_tag_uid( &nfc5, tag_uid, &tag_uid_len ) )
    {
        log_printf( &logger, " TAG UID: " );
        for ( uint8_t cnt = 0; cnt < tag_uid_len; cnt++ )
        {
            log_printf( &logger, "0x%.2X ", ( uint16_t ) tag_uid[ cnt ] );
        }
        log_printf( &logger, "\r\n----------------------------------\r\n" );
        Delay_ms( 500 );
    }
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources