TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136951 times)
  2. FAT32 Library (70064 times)
  3. Network Ethernet Library (56015 times)
  4. USB Device Library (46333 times)
  5. Network WiFi Library (41955 times)
  6. FT800 Library (41265 times)
  7. GSM click (29050 times)
  8. mikroSDK (26479 times)
  9. PID Library (26446 times)
  10. microSD click (25411 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

NFC 4 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.12

mikroSDK Library: 2.0.0.0

Category: RFID/NFC

Downloaded: 215 times

Not followed.

License: MIT license  

NFC 4 Click is a compact add-on board that contains an NFC transceiver for contactless communication. This board features the ST25R3916, a multi-purpose NFC transceiver supporting passive peer-to-peer functionality and NFC card-emulation mode, as well as NFC reader operation from STMicroelectronics. It features high RF output power to directly drive an antenna etched on the PCB, alongside its tuning circuit, at high efficiency.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "NFC 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "NFC 4 click" changes.

Do you want to report abuse regarding "NFC 4 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


NFC 4 click

NFC 4 Click is a compact add-on board that contains an NFC transceiver for contactless communication. This board features the ST25R3916, a multi-purpose NFC transceiver supporting passive peer-to-peer functionality and NFC card-emulation mode, as well as NFC reader operation from STMicroelectronics. It features high RF output power to directly drive an antenna etched on the PCB, alongside its tuning circuit, at high efficiency.

nfc4_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jul 2021.
  • Type : I2C/SPI type

Software Support

We provide a library for the NFC4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for NFC4 Click driver.

Standard key functions :

  • nfc4_cfg_setup Config Object Initialization function.

    void nfc4_cfg_setup ( nfc4_cfg_t *cfg );
  • nfc4_init Initialization function.

    err_t nfc4_init ( nfc4_t *ctx, nfc4_cfg_t *cfg );
  • nfc4_default_cfg Click Default Configuration function.

    err_t nfc4_default_cfg ( nfc4_t *ctx );

Example key functions :

  • nfc4_get_mifare_tag_uid This function reads the UID of a mifare tag.

    err_t nfc4_get_mifare_tag_uid ( nfc4_t *ctx, uint8_t *uid, uint8_t *uid_len );
  • nfc4_write_register This function writes a desired data to the selected register.

    err_t nfc4_write_register ( nfc4_t *ctx, uint8_t reg, uint8_t data_in );
  • nfc4_read_register This function reads a desired data from the selected register.

    err_t nfc4_read_register ( nfc4_t *ctx, uint8_t reg, uint8_t *data_out );

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.


void application_init ( void )
{
    log_cfg_t log_cfg;      /**< Logger config object. */
    nfc4_cfg_t nfc4_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.
    nfc4_cfg_setup( &nfc4_cfg );
    NFC4_MAP_MIKROBUS( nfc4_cfg, MIKROBUS_1 );
    err_t init_flag  = nfc4_init( &nfc4, &nfc4_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    NFC4_SET_DATA_SAMPLE_EDGE;

    if ( NFC4_ERROR == nfc4_default_cfg ( &nfc4 ) )
    {
        log_error( &logger, " Default Config Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

If there's a tag detected, it reads its UID and displays it on the USB UART every 500ms.


void application_task ( void )
{
    uint8_t tag_uid[ 10 ] = { 0 };
    uint8_t uid_len = 0;

    if( NFC4_OK == nfc4_get_mifare_tag_uid( &nfc4, tag_uid, &uid_len ) )
    {
        log_printf( &logger, " Tag UID: " );
        for ( uint8_t cnt = 0; cnt < uid_len; cnt++ )
        {
            log_printf( &logger, "%.2X", ( uint16_t ) tag_uid[ cnt ] );
        }
        log_printf( &logger, "\r\n" );
        Delay_ms ( 500 );
    }
}

Note

For testing purposes we used MIKROE-1475 - an RFiD tag 13.56MHz compliant with ISO14443-A standard.

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.NFC4

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

Boost 8 click

0

Boost 8 Click is a compact add-on board that steps up the voltage from its input (supply) to its output (load).

[Learn More]

TempHum 18 click

0

Temp&Hum 18 Click is a compact add-on board that represents temperature and humidity sensing solutions. This board features the HS3003, a highly accurate, fully calibrated relative humidity and temperature sensor from Renesas. It features proprietary sensor-level protection, ensuring high reliability and long-term stability. Integrated calibration and temperature-compensation logic provides fully corrected RH and temperature values via standard I2C output. No user calibration of the output data is required. The high accuracy, fast measurement response time, and long-term stability make this Click board™ ideal for various temperature and humidity-related applications and a vast number of applications ranging from portable devices to products designed for harsh environments.

[Learn More]

Thermo 22 click

0

Thermo 22 Click is a compact add-on board that provides an accurate temperature measurement. This board features the TMP75C, a high-precision digital temperature sensor from Texas Instruments. The TMP75C houses an integrated digital temperature sensor with a 12-bit analog-to-digital converter (ADC), a reference circuit, and serial interface logic functions in one package. Characterized by its high accuracy (up to ±0.25°C typical) and high resolution of 0.0625°C, this temperature sensor provides temperature data to the host controller with a configurable I2C interface. This Click board™ is appropriate for thermal management and protection of various consumer, industrial, and environmental applications.

[Learn More]