Ntag i2C plus passthrough mode from NFC to I2C stops working after two SRAM write operations

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ntag i2C plus passthrough mode from NFC to I2C stops working after two SRAM write operations

382 Views
_Damien_
Contributor I

Hello everyone,

I've been stuck on this issue for a while and would greatly appreciate any insights you might have.

Hardware:

  • Okdo e1 with LPC55S69 MCU
  • NXP Flex Antenna Class 6 with NTAG I2C 2k Plus (NT3H2111_2211)

Software:

  • LPCXpresso55S69_NTAG_I2C_Explorer_Blink (modified for passthrough mode)

I'm trying to use the NTAG's passthrough mode to send data from a phone to the MCU.

The size of the data is larger than the SRAM capacity.

I've configured the NC_REG as follows:

00111101b

NFCS_I2C_RST_ON_OFF: 0b (Disabled)

PTHRU_ON_OFF: 0b (Disabled but enabled later in the code)

FD_OFF: 11b

FD_ON: 11b

SRAM_MIRROR_ON_OFF: 0b (Disabled)

TRANSFER_DIR: 1b (RF to I2C)

Process I go through into the code :

  1. Check NS_REG for RF field presence (last bit).
  2. If detected, enable passthrough mode (PTHRU_ON_OFF = 1b).
  3. Phone detects the field and writes data to the NTAG's SRAM.
  4. Check NS_REG for SRAM_I2C_READY bit.
  5. If set, read the data from SRAM via I2C.

Passthrough itself seems to be working for the first two iterations (data sent and received correctly).

The loop stops after 2 iterations. The I2C_LOCKED, SRAM_I2C_READY bits reset to 0, and the RF_LOCKED bit goes back to 1, stoping communication. Therefore, the rest of the data is not sent nor received.

 

Here is the part of the example I modified for this:

int main(void) {
 
/* Init Board hardware. */
Setup();
 
uint8_t ns_reg = 0; // Session register
uint8_t FD = 1;
BOOL status = FALSE;
unsigned char response[64];
 
/* Configuration register NC_REG setup for operation in passthrough mode. */
 
// Set NFCS_I2C_RST_ON_OFF
NTAG_SetI2CRstOnOff(ntag_handle, FALSE);
/* The PTHRU_ON_OFF bit is handled later in the code */
// Set FD_ON bits and FD_OFF bits to 11b corresponding to passthrough operation.
NTAG_SetFDOnFunction(ntag_handle, DATA_READY_BY_I2C_OR_DATA_READ_BY_RF_11b);
NTAG_SetFDOffFunction(ntag_handle,I2C_LAST_DATA_READ_OR_WRITTEN_OR_RF_SWITCHED_OFF_11b );
// Set SRAM_MIRROR_ON_OFF bit to 0b to disable SRAM Mirror feature
NTAG_SetSRAMMirrorOnOff(ntag_handle, FALSE);
// Set TRANSFER_DIR bit to 1b for passtrough from NFC to I2C.
NTAG_SetTransferDir(ntag_handle, RF_TO_I2C);
 
// Main Loop
while (1) {
// Read NTAG I2C session registers. The last bit of NS_REG indicates whether RF field is detected
status = NFC_ReadRegister(ntag_handle, NTAG_MEM_OFFSET_NS_REG, &ns_reg);
if (status) {
PRINTF("\r\nCommunication Failed!");
}
 
while ((ns_reg & NTAG_NS_REG_MASK_RF_FIELD_PRESENT)) {
// Field detection handler
if (FD) {
FD = 0;
PRINTF("\r\nFIELD DETECTED!");
NTAG_SetPthruOnOff(ntag_handle, TRUE);
}
 
while((ns_reg & NTAG_NS_REG_MASK_SRAM_I2C_READY)) {
 
// Read SRAM content
status = NTAG_ReadBytes(ntag_handle, NTAG_MEM_ADDR_START_SRAM, response, NTAG_MEM_SRAM_SIZE);
if(status) PRINTF("\r\nREADER NOT READING");
 
// we check again for SRAM_i2c_READY
NTAG_ReadRegister(ntag_handle, NTAG_MEM_OFFSET_NS_REG, &ns_reg);
}
 
// we check again if RF field is available
NTAG_ReadRegister(ntag_handle, NTAG_MEM_OFFSET_NS_REG, &ns_reg);
}
 
if (!FD) {
PRINTF("\r\nFIELD LOST!\r\n");
// Reset field detection status.
FD = 1;
 
}
}
}
0 Kudos
Reply
1 Reply

338 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello @_Damien_ 

It's recommended that you refer to the below example to modify and debug your project.

KellyLi_0-1711785207788.png

BR

kelly

0 Kudos
Reply