TOP Contributors

  1. MIKROE (2654 codes)
  2. Alcides Ramos (352 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 (136742 times)
  2. FAT32 Library (69952 times)
  3. Network Ethernet Library (55942 times)
  4. USB Device Library (46267 times)
  5. Network WiFi Library (41887 times)
  6. FT800 Library (41173 times)
  7. GSM click (28983 times)
  8. PID Library (26413 times)
  9. mikroSDK (26361 times)
  10. microSD click (25376 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 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: RFID/NFC

Downloaded: 42 times

Not followed.

License: MIT license  

NFC click is a mikroBUS™ add-on board with a versatile near field communications controller from NXP — the PN7120 IC. NFC devices are used in contactless payment systems, electronic ticketing, smartcards, but also in retail and advertising — inexpensive NFC tags can be embedded into packaging labels, flyers or posters.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


NFC click

NFC click is a mikroBUS™ add-on board with a versatile near field communications controller from NXP — the PN7120 IC. NFC devices are used in contactless payment systems, electronic ticketing, smartcards, but also in retail and advertising — inexpensive NFC tags can be embedded into packaging labels, flyers or posters.

nfc_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Mar 2023.
  • Type : I2C type

Software Support

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

Standard key functions :

  • nfc_cfg_setup Config Object Initialization function.

    void nfc_cfg_setup ( nfc_cfg_t *cfg );
  • nfc_init Initialization function.

    err_t nfc_init ( nfc_t *ctx, nfc_cfg_t *cfg );
  • nfc_default_cfg Click Default Configuration function.

    void nfc_default_cfg ( nfc_t *ctx );

Example key functions :

  • nfc_hw_reset HW reset function.

    void nfc_hw_reset( nfc_t *ctx );
  • nfc_get_data Get data function.

    uint8_t nfc_get_data ( nfc_t *ctx, uint8_t *p_rx_data );
  • nfc_cmd_disable_standby_mode Disable standby mode command function.

    void nfc_cmd_disable_standby_mode ( nfc_t *ctx );

Example Description

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

The demo application is composed of two sections :

Application Init

Initializes driver and logger, then performs hardware reset, puts the device in operating mode by disabling standby mode, performs test procedure, and configures the device to start discovery.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    nfc_cfg_t nfc_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.
    nfc_cfg_setup( &nfc_cfg );
    NFC_MAP_MIKROBUS( nfc_cfg, MIKROBUS_1 );
    err_t init_flag = nfc_init( &nfc, &nfc_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" );
    nfc_hw_reset( &nfc );
    Delay_ms ( 100 );

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

    nfc_read_ctrl_packet_data( &nfc, &ctrl_pck_data );
    Delay_ms ( 100 );

    nfc_cmd_core_init( &nfc );
    Delay_ms ( 100 );

    nfc_read_ctrl_packet_data( &nfc, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    while ( nfc_check_irq( &nfc ) == NFC_IRQ_STATE_HIGH );

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

    nfc_read_ctrl_packet_data( &nfc, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    nfc_test_antenna( &nfc, &ctrl_pck_data );

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

    nfc_read_ctrl_packet_data( &nfc, &ctrl_pck_data );
    Delay_ms ( 100 );
    display_packet( &ctrl_pck_data );

    nfc_hw_reset( &nfc );
    Delay_ms ( 100 );

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

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

    nfc_read_ctrl_packet_data( &nfc, &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 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 ( nfc_check_irq( &nfc ) == NFC_IRQ_STATE_HIGH ) 
    {
        nfc_read_nfc_data ( &nfc, &ctrl_pck_data );
    }

    while ( nfc_check_irq( &nfc ) == NFC_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.NFC

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

GSM 3 click

0

GSM3 click is a complete quad-band GSM cellular network communication solution, featuring the SIM800H-BT, a quad-band 2G GSM/GPRS module. This module is GSM Phase 2/2+ compliant, featuring a full set of options for the cellular networking and communication. It has a network status indication, jamming detection, embedded internet protocols including TCP/IP, UDP, FTP, PPP, HTTP, E-mail, MMS, and more. It also features advanced voice/audio functions, including the FM radio interface. The GPRS multislot class 12 implementation allows 4 uplink and 4 downlink slots, with 5 slots open in total.

[Learn More]

OPTO 4 click

0

Opto 4 click is a galvanically isolated power switch, which uses a power MOSFET in combination with an optocoupler.

[Learn More]

Accel 24 click

0

Accel 24 Click is a compact add-on board that contains an acceleration sensor. This board features the MXC6655XA, a 12-bit three-axis accelerometer from MEMSIC. It allows selectable full-scale acceleration measurements in ranges of ±2g, ±4g, or ±8g in three axes with a compatible I2C serial interface with 400KHz fast mode operation. Alongside low offset and temperature signal with high accuracy, the MXC6655XA also detects six orientation positions, X/Y shake, and shake directions with an appropriate interrupt signal for these states.

[Learn More]