cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R100 NFC Tag Read Problems

William_RnD
Visitor

Hi everyone,

I’m trying to interface an ST25R100 NFC reader with my MCU, and I’m having trouble reading ISO15693 tags. My initialization seems to work, but I never get any response from the tag. I’m hoping someone can spot what I might be missing.

This is what my uart debugging spits out:
INIT - NFC
NFC: Init start (POR -> RESET -> POWER-DOWN -> Ready Mode)
ROP_REG_OPERATION = 0x00 (after PD write)
ROP_REG_GENERAL = 0x01 (after write)
ROP_REG_REGULATOR = 0x08 (after write)
NFC IRQ triggered!
IRQ: I_osc Oscillator ready
ROP_REG_OPERATION = 0x0A (after enable)
ROP_REG_OPERATION = 0x0A (check mode)
Chip is in READY mode (en = 1)
STATUS register = 0x00
NFC Reader Operation
ROP_REG_PROTOCOL = 0x85 (after write)
ROP_REG_OPERATION = 0x3A (after write)
NFC IRQ triggered!
IRQ: I_txe End of transmission
NFC IRQ triggered!
IRQ: I_nre No-response timer expired

This is consistent with what the datasheet says on page 22.

But now I don't quiet see how I can get it to read data from my NFC-Tag

void NFC_Init(void)
{
	uint8_t status, val;
	printf("\tNFC: Init start (POR -> RESET -> POWER-DOWN -> Ready Mode)\r\n");

	/* 1. Hardware reset: enter reset mode (optional if POR occurred) */
	HAL_GPIO_WritePin(NFC_RST_GPIO_Port, NFC_RST_Pin, GPIO_PIN_SET);
	HAL_Delay(10); // hold RESET low 10 ms
	/* 2. Release RESET pin */
	HAL_GPIO_WritePin(NFC_RST_GPIO_Port, NFC_RST_Pin, GPIO_PIN_RESET);
	HAL_Delay(2); // small delay for POR completion

	/* 3. Ensure device is in Power-Down mode (en = 0), (wk = 0) */
	NFC_WriteReg(ROP_REG_OPERATION, 0x00);
	val = NFC_ReadReg(ROP_REG_OPERATION);
	printf("\tROP_REG_OPERATION = 0x%02X (after PD write)\r\n", val);
	HAL_Delay(2);

	/* 4. Configure general register (safe in PD) */
	NFC_WriteReg(ROP_REG_GENERAL, 0x01);
	val = NFC_ReadReg(ROP_REG_GENERAL);
	printf("\tROP_REG_GENERAL = 0x%02X (after write)\r\n", val);

	/* 5. Configure regulators (recommended) */
	NFC_WriteReg(ROP_REG_REGULATOR, 0b00001000); // 3.26V
	val = NFC_ReadReg(ROP_REG_REGULATOR);
	printf("\tROP_REG_REGULATOR = 0x%02X (after write)\r\n", val);

	/* 6. Enable device: set en = 1 to transition to READY */
	NFC_WriteReg(ROP_REG_OPERATION, 0b00001010);
	val = NFC_ReadReg(ROP_REG_OPERATION);
	HAL_Delay(5);
	printf("\tROP_REG_OPERATION = 0x%02X (after enable)\r\n", val);

	/* 7. Verify device is in the correct mode */
	val = NFC_ReadReg(ROP_REG_OPERATION);
	printf("\tROP_REG_OPERATION = 0x%02X (check mode)\r\n", val);

	if ((val & 0x01) != 0)
	{
		printf("\tChip is in Wake up mode (wu_en = 1)\r\n");
	}
	else
	{
		printf("\tChip is in READY mode (en = 1)\r\n");
	}

	/* Optional: read STATUS register for additional info */
	status = NFC_ReadReg(ROP_REG_STATUS);
	printf("\tSTATUS register = 0x%02X\r\n", status);

	//init in reader mode
	configureReaderOperation();
	//NFC_WakeUpConfigure();
}


void configureReaderOperation(void)
{
	uint8_t val;

	printf_yellow("\tNFC Reader Operation\r\n");

	//1. Set protocol register: OM bits, TX rate, RX rate
	NFC_WriteReg(ROP_REG_PROTOCOL, 0b10000101);
	val = NFC_ReadReg(ROP_REG_PROTOCOL);
	printf("\tROP_REG_PROTOCOL = 0x%02X (after write)\r\n", val);

	// 2. Enable TX and RX in Operation register
	NFC_WriteReg(ROP_REG_OPERATION, 0b00111010);
	val = NFC_ReadReg(ROP_REG_OPERATION);
	printf("\tROP_REG_OPERATION = 0x%02X (after write)\r\n", val);

	HAL_Delay(10);

	//Recommended preparation and execution of a transceiver operation:
	// 1. Stop all activities
	NFC_DirectCmd(0x62); // stop all
	HAL_Delay(1);

	// 2. Reset Rx gain
	NFC_DirectCmd(0x66); // reset RX gain
	HAL_Delay(1);

	// 3. Configure timers
	NFC_WriteReg(ROP_REG_MRT, 0x10);
	NFC_WriteReg(ROP_REG_NRT1, 0x50); 

	// Define the length of data to be transmitted (ntx<12:0> and nbtx<2:0>)
	// 6. Prepare FIFO for transmission
	NFC_WriteReg(ROP_REG_TX_FRAME1, 0x26); // REQA command example
	NFC_WriteReg(ROP_REG_TX_FRAME2, 0x00); // unused here
	// set ntx = 7 bits, nbtx = 7 in relevant registers (datasheet Sec 5.10.1)

	//NFC_WriteReg(0x1C, 0x01);

	// 7. Send transmit command
	NFC_DirectCmd(0x6A); // Transmit Data
	//NFC_DirectCmd(0xE6); // MRT timer start

	// Now wait for I_txe IRQ to know TX finished

	// sq_en is enabled by default.
	// agc_en is enabled by default.
}

NFC-Tag:

- ISO 15693
- NfcV, Ndef technology
- 196 Bytes of data
Any help is greatly appreciated!

 

 

 

 

 

1 REPLY 1
Brian TIDAL
ST Employee

Hi,

ST provides a middleware for the ST25R100 NFC readers: the RF Abstraction Layer (RFAL). This RFAL is available in the ST25 Embedded Library. It is portable and scalable C code. This library also includes NDEF API to read, write, encode et decode messages and various ready to use demos (such as NDEF read and write). I recommend using this library. 

Regarding the code:

// 6. Prepare FIFO for transmission
	NFC_WriteReg(ROP_REG_TX_FRAME1, 0x26); // REQA command example
	NFC_WriteReg(ROP_REG_TX_FRAME2, 0x00); // unused here
  1. REQA is dedicated to ISO14443-A technology, not for ISO15693. You may rather want to use an ISO15693 INVENTORY command.
  2. TX frame register 1 and TX frame register 2 define the length of data to be transmitted (ntx<12:0> and nbtx<2:0>). This is not designed to store the data to be sent. 0x26 0x00 is likely not the correct data size for a ISO15693 INVENTORY command
  3. The FIFO seems to be empty. An INVENTORY command such as 0x26 0x01 0x00 should be written to the FIFO and ntx (resp. nbtx) should be set to 3 (resp. 0) in the TX frame register 1 and TX frame register 2.

Rgds

BT

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.