Near Field Communication (NFC) Hardware and Porting#

This page describes the reference ST25R NFC stack shipped with the Aliro extension and how to replace it with a different NFC reader integrated circuit (IC).

Architecture#

Aliro reader code that depends on the NFC frontend is vendor-neutral:

  • Access protocol (reader.cpp) and NFC transport (nfc.cpp) call AliroNfcFrontend(), which returns the single INfcFrontend implementation linked into the project.

  • Exactly one Simplicity SDK Component (SLC) component must provide: aliro_nfc_driver. The SLC solver rejects two providers.

The frontend must implement NFC-A polling and ISO 14443-4 Data Exchange Protocol (ISO-DEP) Application Protocol Data Unit (APDU) half-duplex exchange. Minimum requirements are:

  • NFC-A poller, one device at a time

  • ISO-DEP activation and transceive

  • APDU payloads up to 512 bytes

  • Interruptible waits: blocked WaitForTag() / SendMessage() must return DRIVER_REINIT_REQUESTED promptly when RequestReinit() is called

Reference ST25R Stack#

Component

Provides / requires

Contents

aliro_nfc_driver_api

provides: aliro_nfc_driver_api

INfcFrontend, aliro_nfc_config.h

aliro_nfc_driver_st25r

provides: aliro_nfc_driver

St25rNfcFrontend (RFAL wrapper), ST eval analog config

st25r200 or st25r300

RFAL library

Vendored ST sources (mutually exclusive)

aliro_platform

Board hardware abstraction layer (HAL)

platform_spi, platform_gpio, platform_timer, pin map

aliro_reader_transport_nfc

requires: aliro_nfc_driver

Sets ALIRO_READER_TRANSPORT_NFC

Typical NFC .slcp fragment:

- id: aliro_reader_transport_nfc
  from: aliro
- id: aliro_nfc_driver_st25r
  from: aliro
- id: st25r200
  from: aliro
- id: spidrv_usart
  instance: [exp]

ST NFC Library Components#

The Aliro extension ships ST25RFAL as Simplicity SDK components. No separate ST NFC SDK extension is required.

Component

ST ICs

Evaluation board

ST25R200

ST25R200 / ST25R100

X-NUCLEO-NFC10A1

ST25R300

ST25R300 / ST25R500

X-NUCLEO-NFC12A1

Install exactly one component matching your hardware. Aliro Minimal Reader and AliroMatterLock NFC templates include st25r200 by default.

Select ST25R200 or ST25R300#

  1. Open the project in Simplicity Studio.

  2. Select Software Components → Aliro → NFC Drivers.

  3. Install ST25R200 or ST25R300 matching your board.

  4. If other ST NFC components are present, remove them.

Preprocessor defines are added automatically:

  • ST25R200: #define ST25R200 1

  • ST25R300: #define ST25R300 1 and #define ST25R500 1

Port Checklist (Custom IC)#

  1. Implement INfcFrontend.

    See aliro/aliro_actuator/hw_driver/nfc_frontend/nfc_frontend.h. Methods: Start(), Init(), Disconnect(), WaitForTag(), SendMessage(), ReceiveMessage(), RequestReinit().

  2. Provide the factory in your driver source.

    namespace aliro { namespace hw_driver {
      static AcmeNfcFrontend gAcme;
      INfcFrontend & AliroNfcFrontend() { return gAcme; }
    }}
  3. Ship an SLC component.

    For example, aliro_nfc_driver_acme.slcc.

    id: aliro_nfc_driver_acme
    provides:
      - name: aliro_nfc_driver
    requires:
      - name: aliro_nfc_driver_api
      - name: aliro_platform
    source:
      - {path: .../acme_nfc_frontend.cpp}
  4. Wire the bus and pins.

    The reference uses Serial Peripheral Interface (SPI) through platform_spi_* and pin-tool entries in platform_config.h (ST25R_IRQ, ST25R_RST, ST25R_SS). Inter-Integrated Circuit (I2C) or UART frontends can use a parallel bus binding without changing INfcFrontend.

  5. Swap project components.

    Replace aliro_nfc_driver_st25r and st25r200/st25r300 with your driver (and drop spidrv_usart if SPI is not used).

No changes to aliro_actuator, the reader loop, or Matter integration code are required.

BLE-Only Builds#

Projects that use the Bluetooth Low Energy (BLE) transport component aliro_reader_transport_ble do not include any NFC driver, ST RFAL, or spidrv_usart components. NFC transport source (nfc.cpp) is excluded at compile time.

Hardware Setup#

See Hardware and Setup for supported boards and the EFR32MG24 ↔ ST25R pin map.

Related Topics#