2021-06-24 08:20 AM
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
Solved! Go to Solution.
2021-07-20 02:05 AM
Hi Ulysses ,
so in void* pthread_func()
/* poll interrupt line forever */
while (true)
{
/* read() blocks the calling thread until some data becomes available */
/* The port is used to contain the file descriptor of a given pin! */
ssize_t s = read(fd_readGPIO, &event, sizeof(event));
/* Call RFAL Isr */
platformIsr();
/* Unlock Semaphore */
sem_post(&rfal_sem);
}
2021-07-20 02:12 AM
sorry i have clicked on answer too soon. this is the following .
while (true)
{
/* read() blocks the calling thread until some data becomes available */
/* The port is used to contain the file descriptor of a given pin! */
ssize_t s = read(fd_readGPIO, &event, sizeof(event));
/* Call RFAL Isr */
platformIsr();
/* Unlock Semaphore */
sem_post(&rfal_sem);
}
I think it still going to play the same role as the original one , what do you think please ?
We don't want for now to build the libgpiod in our current image as we don't have time and we want to make a very minimal changes .
Many thanks
2021-07-20 03:30 AM
Hi Franklin,
Not sure, above code looks more like polling the GPIO state and not the events(interrupts) coming from it.
AFAIK we are not using the userspace libgpiod but are relying on low level ioctl for accessing the character device interface.
If you want to use the deprecated sysfs interface then I could send you the previous version of STSW-ST25R013. Just let me know.
Regards, Ulysses
2021-07-20 03:39 AM
Hi Ulysses ,
Yes please that would be appreciated to send me the previous version of STSW-ST25R013 ( with deprecated sysfs) because we are currently using the sysfs we don't have libgpiod.
Many thanks
2021-07-21 04:19 PM
Hi Ulysses ,
Here is the brief state of the issue
Case 1 :
Case 2 : ( Issue 1 )
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 ?? )
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
2021-07-21 04:40 PM
Hi
General questions please , there are 2 mode of detecting card :
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
2021-07-21 11:49 PM
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
2021-07-21 11:51 PM
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