TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 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 (137111 times)
  2. FAT32 Library (70239 times)
  3. Network Ethernet Library (56129 times)
  4. USB Device Library (46444 times)
  5. Network WiFi Library (42080 times)
  6. FT800 Library (41400 times)
  7. GSM click (29122 times)
  8. mikroSDK (26566 times)
  9. PID Library (26503 times)
  10. microSD click (25491 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 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.11

mikroSDK Library: 2.0.0.0

Category: RFID/NFC

Downloaded: 204 times

Not followed.

License: MIT license  

NFC 2 Click is a compact add-on board that contains a highly integrated NFC transceiver for contactless communication. This board features the PN7150, the best plug&play high-performance full NFC solution with integrated firmware and NCI interface designed for contactless communication at 13.56 MHz from NXP USA Inc.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


NFC 2 click

NFC 2 Click is a compact add-on board that contains a highly integrated NFC transceiver for contactless communication. This board features the PN7150, the best plug&play high-performance full NFC solution with integrated firmware and NCI interface designed for contactless communication at 13.56 MHz from NXP USA Inc.

nfc2_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Aug 2021.
  • Type : I2C type

Software Support

We provide a library for the NFC2 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 NFC2 Click driver.

Standard key functions :

  • nfc2_cfg_setup Config Object Initialization function.

    void nfc2_cfg_setup ( nfc2_cfg_t *cfg );
  • nfc2_init Initialization function.

    err_t nfc2_init ( nfc2_t *ctx, nfc2_cfg_t *cfg );
  • nfc2_default_cfg Click Default Configuration function.

    err_t nfc2_default_cfg ( nfc2_t *ctx );

Example key functions :

  • nfc2_hw_reset HW reset function.

    void nfc2_hw_reset( nfc2_t *ctx );
  • nfc2_core_set_protocol_config Set protocol configuration function.

    void nfc2_core_set_protocol_config ( nfc2_t *ctx );
  • nfc2_cmd_card_disconnected Card disconnected command function.

    void nfc2_cmd_card_disconnected ( nfc2_t *ctx );

Example Description

This is an example which demonstrates the usage of NFC 2 Click board.

The demo application is composed of two sections :

Application Init

Initialization driver enables - I2C, hw reset, reseteting and initialize core, disabling standby mode, starting test procedure, set configuration and start discovery, also write log.


void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    nfc2_cfg_t nfc2_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.
    nfc2_cfg_setup( &nfc2_cfg );
    NFC2_MAP_MIKROBUS( nfc2_cfg, MIKROBUS_1 );
    err_t init_flag = nfc2_init( &nfc2, &nfc2_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    log_printf( &logger, "        HW Reset       \r\n" );
    nfc2_hw_reset( &nfc2 );
    Delay_ms ( 100 );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, " Reset and Init. Core  \r\n" );
    nfc2_cmd_core_reset( &nfc2 );
    Delay_ms ( 100 );

    nfc2_read_ctrl_packet_data( &nfc2, &ctrl_pck_data );
    Delay_ms ( 100 );

    nfc2_cmd_core_init( &nfc2 );
    Delay_ms ( 100 );

    nfc2_read_ctrl_packet_data( &nfc2, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    while ( nfc2_check_irq( &nfc2 ) == NFC2_IRQ_STATE_HIGH );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, " Disabling Standby Mode \r\n" );
    nfc2_cmd_disable_standby_mode( &nfc2 );
    Delay_ms ( 100 );

    nfc2_read_ctrl_packet_data( &nfc2, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    nfc2_test_antenna( &nfc2, &ctrl_pck_data );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "Starting Test Procedure\r\n" );
    nfc2_cmd_test_procedure( &nfc2 );
    Delay_ms ( 100 );

    nfc2_read_ctrl_packet_data( &nfc2, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    nfc2_hw_reset( &nfc2 );
    Delay_ms ( 100 );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "       NFC Config.     \r\n" );
    nfc2_default_cfg ( &nfc2, &ctrl_pck_data );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "     Discovery Start   \r\n" );
    nfc2_cmd_start_discovery( &nfc2 );
    Delay_ms ( 100 );

    nfc2_read_ctrl_packet_data( &nfc2, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    log_printf( &logger, "-----------------------\r\n" );
    log_printf( &logger, "-------- START --------\r\n" );
    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms ( 500 );

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

Application Task

NFC 2 Click board can be used for detection of RFiD tag and displays it's value via USART terminal. All data logs write on USB uart changes for every 1 sec.


void application_task ( void ) {
    while ( nfc2_check_irq( &nfc2 ) == NFC2_IRQ_STATE_HIGH ) {
        nfc2_read_nfc_data ( &nfc2, &ctrl_pck_data );
    }

    while ( nfc2_check_irq( &nfc2 ) == NFC2_IRQ_STATE_LOW );

    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms ( 1000 );
}

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.NFC2

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

RTC 18 click

0

RTC 18 Click is a compact add-on board that accurately keeps the time of a day. This board features the RV-3032-C7, an I2C-configurable real-time clock module that incorporates an integrated CMOS circuit and an XTAL from Micro Crystal AG. The RV-3032-C7 is a temperature compensated RTC with premium accuracy (0.22 sec/day) and extremely low power consumption, allowing it to be used with a single button cell battery for an extended period. It can measure temperature with a typical accuracy of ±1°C and a resolution of 0.0625°C/step with a programmable alarm on top and bottom temperature limits. It features standard RTC functions with automatic leap year correction, and standard interrupt for Periodic Countdown Timer and Periodic Time Update (seconds, minutes), date/hour/minute alarm, and an external event.

[Learn More]

Waveform click

0

Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.

[Learn More]

LTE Cat.1-EU click

0

LTE Cat.1-EU click is a Click board™ based on Thales Cinterion® ELS61 wireless module that delivers highly efficient Cat 1 LTE connectivity for M2M IoT solutions offering seamless fall back to 2G and 3G networks. The best in class solution enables M2M optimized speeds of 10Mbit/s download and 5Mbit/s uplink making it ideal for the vast number of M2M and industrial IoT applications that are not dependent on speed but that requires the longevity of LTE networks, while still providing 3G and 2G connectivity to ensure complete population and geographic coverage as LTE rolls out.

[Learn More]