This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TRF7970A - How to properly respond to WTX from Android HCE?

Other Parts Discussed in Thread: TRF7970A, MSP430F5529

I'm trying to read a tag from Android HCE using TRF7970A. I've managed to get Select AID command to properly send to the Android side. Android properly processes the APDU and responds with a message.

I/CardService: Received APDU: 00A4040007D276000085010100
I/CardService: Sending account number: 0001724354

But on the TRF7970A side, the response is met with 0xF2 0x01, which if I'm not mistaken, is WTX request from S-block. 

How do you properly handle this on the reader side? I couldn't find any code example from TI that handles this particular request

u08_t NDEF_ApplicationSelect(void)
{
	u08_t ui8SelectSuccess = STATUS_FAIL;
	u08_t ui8Offset = 0;

	g_ui8TrfBuffer[ui8Offset++] = 0x8F;		// Reset FIFO
	g_ui8TrfBuffer[ui8Offset++] = 0x91;		// Send with CRC
	g_ui8TrfBuffer[ui8Offset++] = 0x3D;		// Write Continuous
	g_ui8TrfBuffer[ui8Offset++] = 0x00;		// Length of packet in bytes - upper and middle nibbles of transmit byte length
	g_ui8TrfBuffer[ui8Offset++] = 0xE0; 	// Length of packet in bytes - lower and broken nibbles of transmit byte length
	g_ui8TrfBuffer[ui8Offset++] = 0x02 | g_bBlockNumberBit;	// I-Block PCB: Read Block 0 or Block 1, with CID = 0, NAD = 0, no chaining
	g_ui8TrfBuffer[ui8Offset++] = 0x00;		// CLA
	g_ui8TrfBuffer[ui8Offset++] = 0xA4;		// INS = Select (Application in this case)
	g_ui8TrfBuffer[ui8Offset++] = 0x04;		// P1
	g_ui8TrfBuffer[ui8Offset++] = 0x00;		// P2
	g_ui8TrfBuffer[ui8Offset++] = 0x07;		// Lc
	g_ui8TrfBuffer[ui8Offset++] = 0xD2;		// Data = 0xD2760000850101 - per NFC Forum Type 4 Tag Operation
	g_ui8TrfBuffer[ui8Offset++] = 0x76;
	g_ui8TrfBuffer[ui8Offset++] = 0x00;
	g_ui8TrfBuffer[ui8Offset++] = 0x00;
	g_ui8TrfBuffer[ui8Offset++] = 0x85;
	g_ui8TrfBuffer[ui8Offset++] = 0x01;
	g_ui8TrfBuffer[ui8Offset++] = 0x01;
	g_ui8TrfBuffer[ui8Offset++] = 0x00;		// Le

	Trf797xRawWrite(&g_ui8TrfBuffer[0], ui8Offset);	// Issue the NDEF Command

	Trf797xIrqWaitTimeout(200,200);	// 10 millisecond TX timeout, 20 millisecond RX timeout

	g_sTrfStatus = Trf797xGetTrfStatus();

	// If data received, should return same PCB, SW1 = 0x90, SW2 = 0x00
// But reading data from Android HCE always gives 0xF2 0xF1 if (g_sTrfStatus == RX_COMPLETE) { if((g_ui8TrfBuffer[0] == 0x02 | g_bBlockNumberBit) && (g_ui8TrfBuffer[1] == 0x90) && (g_ui8TrfBuffer[2] == 0x00)) { ui8SelectSuccess = STATUS_SUCCESS; } } g_bBlockNumberBit = !g_bBlockNumberBit; // Toggle the PCB Block Number McuDelayMillisecond(1); // Short delay before sending next command return ui8SelectSuccess; }

  • Hello Sokwhan,

    The firmware which can handle this along is from our Reader/Writer application note: www.ti.com/.../sloa227.pdf

    You can download the example firmware from this link: www.ti.com/.../sloa227

    The projects included in SLOA227 allow you to run the firmware on the MSP430F5529 LaunchPad, MSP430F5529 Experimenter's Board, and the MSP432P401R LaunchPad.

    The firmware base you are using only supports very basic NDEF functionality. It does not handle responses such as the WTX. If you want to leverage a firmware example for the TRF7970A which properly handles all aspects of the NFC forum defined NDEF messaging, you will want to use the SLOA227 firmware.