Skip to main content
Visitor II
January 24, 2018
Solved

ST25R3911B Issue with rlafNfcaPollerSelect

  • January 24, 2018
  • 1 reply
  • 1110 views
Posted on January 24, 2018 at 01:12

Hi I am currently trying to send and receive APDU commands to an NFC PICC. I am using the X-NUCLEO-NFC05A1 (ST25R3911B) and the STM32F401RE Nucleo Board. For software I am using X-CUBE-NFC5  RFAL middleware and STM32CubeF4 HAL.

The Card is a ISO14443A Type 4 ( ISO-DEP)

I can read the UID and Type of the Card, but as soon as I try to select the first card (rfalNfcaPollerSelect), the function responds with timeout error ( 0x04).

I have gone through the RFAL.chm file multiple times and cant seem to find a resolution to my problem. Am I missing some initialization or setting?

Partial Code ( based on example from X-CUBE-NFC5 )

void loop()

{

       rfalWorker();

      //code for inductive wakeup then run scanA() //(code not shown to save space) 

      scanA();

}

void scanA()

{

      rfalNfcaSensRes          sensRes;

      

rfalNfcaPollerInitialize();

      

rfalFieldOnAndStartGT();

      unit16_t err =

rfalNfcaPollerTechnologyDetection

( RFAL_COMPLIANCE_MODE_NFC_11, &sensRes );

      if (err == 0) //tagfound

      {

       rfalNfcaListenDevice nfcaDevList[1];

       uint8_t             devCnt;

       err=

rfalNfcaPollerFullCollisionResolution

(

RFAL_COMPLIANCE_MODE_NFC_11

, 1, nfcaDevList, &devCnt);

      if (nfcaDevList[0].type == RFAL_NFCA_T4T){

                    

activateIsoDep

(nfcaDevList[0]);}

}

void activateIsoDep(rfalNfcaListenDevice lisnDev)

{

      rfalIsoDepDevice isoDepDevice;

      rfalNfcaSelRes    selRes;

     

      uint8_t err =

rfalNfcaPollerSelect

(lisnDev.nfcId1,lisnDev.nfcId1Len,&selRes);  

      

//Here I get err = 0x04 (TIMEOUT)

      //.....

      //       next code for rfalIsoDepPollAHandleActivation

      //      .............................

}

#iso14443a-iso-dep #st25r3911b #x-cube-nfc5 #rfal-al #rfalnfcapollerselect #send-apdu
    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS
    Posted on January 29, 2018 at 10:13

    Hi Marius,

    I rechecked: You are right. There are mainly two cases for devices after rfalNfcaPollerFullCollisionResolution().

    If the isSleep==true you need to issue:

    rfalNfcaPollerCheckPresence() and

    rfalNfcaPollerSelect

    ()  to have it selected. 

    If the device has isSleep==false then it is already selected and it will not answer to a select (you shouldn't even issue it because it would fall back to IDLE)  and you immediately proceed with rfalIsoDepPollAHandleActivation().

    Regards, Ulrich

    1 reply

    Technical Moderator
    January 25, 2018
    Posted on January 25, 2018 at 13:05

    Hi Marius,

    overall your code should work if you have one device only which is known to be a T4T. 

    Could you in your code check after 

    rfalNfcaPollerFullCollisionResolution() 

    the values of err, devCnt and 

    nfcaDevList[0].isSleep please!

    Regards, Ulrich

    Visitor II
    January 28, 2018
    Posted on January 28, 2018 at 18:25

    Hi. Thank you for the reply.

    rfalNfcaPollerFullCollisionResolution() 

    provides no error (err = 0). devCnt = 1 and 

    nfcaDevList[0].isSleep

    = false

    It seems that when I run rfalNfcaPollerFullCollisionResolution() this function goes through all connection and anticollision routines. From REQA up to SEL.  

    So I believe that because the card is awake, I cannot do a select again. But what I don't know yet, is if the card is also activated for APDU communication. ( rfalIsoDepPollAHandleActivation, which also returns error) 

    I am going through the rfal functions now to see if this is correct.

    Technical Moderator
    January 29, 2018
    Posted on January 29, 2018 at 10:13

    Hi Marius,

    I rechecked: You are right. There are mainly two cases for devices after rfalNfcaPollerFullCollisionResolution().

    If the isSleep==true you need to issue:

    rfalNfcaPollerCheckPresence() and

    rfalNfcaPollerSelect

    ()  to have it selected. 

    If the device has isSleep==false then it is already selected and it will not answer to a select (you shouldn't even issue it because it would fall back to IDLE)  and you immediately proceed with rfalIsoDepPollAHandleActivation().

    Regards, Ulrich