Skip to main content
FNana.1
Associate
June 24, 2021
Solved

X-NUCLEO-NFCC06A1: long time to read RFID Card Tag

  • June 24, 2021
  • 12 replies
  • 4485 views

I using the Demo code for ST25R3916 It takes long time to read RFID Card Tag , what might be causing that ?

I am using X-NUCLEO-NFCC06A1 eval board with ST25R3916 CHIP

This topic has been closed for replies.
Best answer by Ulysses HERNIOSUS

Hi,

ERR_IO is not normal and indicates an issue on SPI/IRQ. The other two cases you hinted are likely just different manifestations of the same problem.

As hinted before Logic Analyzer traces are key in such a case.

Regards, Ulysses

12 replies

FNana.1
FNana.1Author
Associate
July 21, 2021

Hi Ulysses ,

Here is the brief state of the issue

Case 1 :

  • When card is presented some it works normally ( detect presence of card - read ....etc fine )

Case 2 : ( Issue 1 )

  • Work fine ( detect card and read perfect
  • If you remove the card and present it again sometime it is still fine
  • If you remove the card and present it again several time by repeating sometime it takes several secs ( less than min ) to detect and read card. i falls into the case below in this function static void rfalTransceiveRx( void ) : if( ((irqs & ST25R3916_IRQ_MASK_NRE) != 0U) && ((irqs & ST25R3916_IRQ_MASK_RXS) == 0U) )
case RFAL_TXRX_STATE_RX_WAIT_RXS:
 
 /*******************************************************************************/
 irqs = st25r3916GetInterrupt( (ST25R3916_IRQ_MASK_RXS | ST25R3916_IRQ_MASK_NRE | ST25R3916_IRQ_MASK_EOF) );
 if( irqs == ST25R3916_IRQ_MASK_NONE )
 {
 break; /* No interrupt to process */
 }
 
 /* Only raise Timeout if NRE is detected with no Rx Start (NRT EMV mode) */
 if( ((irqs & ST25R3916_IRQ_MASK_NRE) != 0U) && ((irqs & ST25R3916_IRQ_MASK_RXS) == 0U) )
 {
 gRFAL.TxRx.status = ERR_TIMEOUT;
 gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_FAIL;
 //<<< ISSUE IS HERE : Keeps falling into this althougth the card is presented in the RF field 
 break;
 }
 
 /* Only raise Link Loss if EOF is detected with no Rx Start */
 if( ((irqs & ST25R3916_IRQ_MASK_EOF) != 0U) && ((irqs & ST25R3916_IRQ_MASK_RXS) == 0U) )
 {
 /* In AP2P a Field On has already occurred - treat this as timeout | mute */
 gRFAL.TxRx.status = ( rfalIsModeActiveComm( gRFAL.mode ) ? ERR_TIMEOUT : ERR_LINK_LOSS );
 gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_FAIL;
 break;
 }
 
 if( (irqs & ST25R3916_IRQ_MASK_RXS) != 0U )
 {
 /*******************************************************************************/
 /* REMARK: Silicon workaround ST25R3916 Errata #TBD */
 /* Rarely on corrupted frames I_rxs gets signaled but I_rxe is not signaled */
 /* Use a SW timer to handle an eventual missing RXE */
 rfalTimerStart( gRFAL.tmr.RXE, RFAL_NORXE_TOUT );
 /*******************************************************************************/
 
 gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_WAIT_RXE;
 }
 else
 {
 gRFAL.TxRx.status = ERR_IO;
 gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_FAIL;
 break;
 }
 
 /* remove NRE that might appear together (NRT EMV mode), and remove RXS, but keep EOF if present for next state */
 irqs &= ~(ST25R3916_IRQ_MASK_RXS | ST25R3916_IRQ_MASK_NRE);
 
 /* fall through */
 

It can stay there for less than a minute before reading the card

Case 3: ( Issue 2 Maybe ?? )

  • Some time when card is presented in the RF field and removed quickly ( it is relative ) , it successfully detects the Technology  err = rfalNfcaPollerTechnologyDetection( gNfcDev.disc.compMode, &sensRes );/* Poll for NFC-A devices */ But doesn't find thE NFCA Passive ISO-DEP device UID

static ReturnCode rfalNfcPollTechDetetection( void )

 /*******************************************************************************/
 /* Passive NFC-A Technology Detection */
 /*******************************************************************************/
 if( ((gNfcDev.disc.techs2Find & RFAL_NFC_POLL_TECH_A) != 0U) && ((gNfcDev.techs2do & RFAL_NFC_POLL_TECH_A) != 0U) )
 {
 
 #if RFAL_FEATURE_NFCA
 
 rfalNfcaSensRes sensRes; 
 
 if( !gNfcDev.isTechInit )
 {
 EXIT_ON_ERR( err, rfalNfcaPollerInitialize() ); /* Initialize RFAL for NFC-A */
 EXIT_ON_ERR( err, rfalFieldOnAndStartGT() ); /* Turns the Field On and starts GT timer */
 gNfcDev.isTechInit = true;
 }
 
 if( rfalIsGTExpired() ) /* Wait until Guard Time is fulfilled */
 {
 err = rfalNfcaPollerTechnologyDetection( gNfcDev.disc.compMode, &sensRes );/* Poll for NFC-A devices */
 if( err == ERR_NONE )
 {
 gNfcDev.techsFound |= RFAL_NFC_POLL_TECH_A;
 }
 else //Testing added to be removed
 {
 // platformLog("rfalNfcPollTechDetetection error code : %d errno %d\r\n", err, errno);
 }
 gNfcDev.isTechInit = false;
 gNfcDev.techs2do &= ~RFAL_NFC_POLL_TECH_A;
 }
 
 return ERR_BUSY;
 
 #endif /* RFAL_FEATURE_NFCA */
 }

Case 3( GENERAL ) :

Is that normal that when it manage to detect and read the card UID successfully ( no delay ...) if fall into this case below

ReturnCode rfalISO14443ATransceiveShortFrame( rfal14443AShortFrameCmd txCmd, uint8_t* rxBuf, uint8_t rxBufLen, uint16_t* rxRcvdLen, uint32_t fwt )
{
 ---
---
/* Wait for TXE */
 if( st25r3916WaitForInterruptsTimed( ST25R3916_IRQ_MASK_TXE, static_cast<uint16_t>(MAX( rfalConv1fcToMs( fwt ), RFAL_ST25R3916_SW_TMR_MIN_1MS ) )) == 0U )
 {
 // HERE : it falls here sometime after card detected and read UID read successfully 
 ret = ERR_IO;
 }
 else
 {
 /*Check if Observation Mode is enabled and set it on ST25R391x */
 rfalCheckEnableObsModeRx();
 
 /* Jump into a transceive Rx state for reception (bypass Tx states) */
 gRFAL.state = RFAL_STATE_TXRX;
 gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_IDLE;
 gRFAL.TxRx.status = ERR_BUSY;
 
 /* Execute Transceive Rx blocking */
 
 ret = rfalTransceiveBlockingRx();
 platformLog("rfal ISO14443ATransceiveShortFrame %d \r\n", ret);
 }
--
--
--
}

ps : I have used scope , everything looks OK ( data flowing as expected ....)

So far i can't resume the work like this : It is Randomly working still some stuffs ( see above cases ) to fix

Many thanks

Ulysses HERNIOSUS
Technical Moderator
July 22, 2021

Hi,

ERR_IO is not normal and indicates an issue on SPI/IRQ. The other two cases you hinted are likely just different manifestations of the same problem.

As hinted before Logic Analyzer traces are key in such a case.

Regards, Ulysses

FNana.1
FNana.1Author
Associate
July 21, 2021

Hi

General questions please , there are 2 mode of detecting card :

  1. Polling : more CUP related issue : waste of CPU
  2. Wake-up

Is there any difference in term of response time to detect and read the card uid ?

How can we switch to configure the demo to be used with Wake up mode ?

Thanks

Ulysses HERNIOSUS
Technical Moderator
July 22, 2021

Hi,

Wake-up is completely different from Polling: Wake-up reacts just to detunings of the LC-tank. Cards, metal, temperature change may already trigger it. It is a way of saving power to not do polling unless there is indication that there may be a card.

Regards, Ulysses