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) callAliroNfcFrontend(), which returns the singleINfcFrontendimplementation 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 returnDRIVER_REINIT_REQUESTEDpromptly whenRequestReinit()is called
Reference ST25R Stack#
Component | Provides / requires | Contents |
|---|---|---|
|
|
|
|
|
|
| RFAL library | Vendored ST sources (mutually exclusive) |
| Board hardware abstraction layer (HAL) |
|
|
| Sets |
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#
Open the project in Simplicity Studio.
Select Software Components → Aliro → NFC Drivers.
Install ST25R200 or ST25R300 matching your board.
If other ST NFC components are present, remove them.
Preprocessor defines are added automatically:
ST25R200:
#define ST25R200 1ST25R300:
#define ST25R300 1and#define ST25R500 1
Port Checklist (Custom IC)#
Implement
INfcFrontend.See
aliro/aliro_actuator/hw_driver/nfc_frontend/nfc_frontend.h. Methods:Start(),Init(),Disconnect(),WaitForTag(),SendMessage(),ReceiveMessage(),RequestReinit().Provide the factory in your driver source.
namespace aliro { namespace hw_driver { static AcmeNfcFrontend gAcme; INfcFrontend & AliroNfcFrontend() { return gAcme; } }}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}Wire the bus and pins.
The reference uses Serial Peripheral Interface (SPI) through
platform_spi_*and pin-tool entries inplatform_config.h(ST25R_IRQ,ST25R_RST,ST25R_SS). Inter-Integrated Circuit (I2C) or UART frontends can use a parallel bus binding without changingINfcFrontend.Swap project components.
Replace
aliro_nfc_driver_st25randst25r200/st25r300with your driver (and dropspidrv_usartif 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
Customizing the Application — Where the
INfcFrontendinterface and hardware driver code fit in the source treeProject Configuration — SLC Components in the Example Project, BLE Side Channel, and Enabling Low-Power Mode