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.

Problem in transmitting select command for ISO14443A

Other Parts Discussed in Thread: TRF7970A

Hi,

I have the TRF7970A EVM, and I manage it directly using our own MCU.The communication between both devices is over SPI. I use source code from TI for TRF7970A as a reference.

1.In the first phase I have transmitted the REQA command and successfully gets ATQA response from the TAG.

SS line low

buf[0] = 0x8f;                            /* Reset FIFO command */
buf[1] = 0x90;                           /* send with CRC */
buf[2] = 0x3d;                          /* write continuous from register 1D */
buf[3] = 0x00;                          /* Data for register 1D */
buf[4] = 0x0f;                           /* Data for register 1E */
buf[5] = 0x26;                          /* ISO14443A REQA command byte*/

SS line high

2.In the next phase i execute a anticollision loop with the anticollission command and again i succesfully got response from the tag and collect 5 bytes of UID of the ISO14443A Tag from the FIFO of the TRF7970a

SS line low

buf[0] = 0x8f;                                       /* Reset FIFO */
buf[1] = 0x91;                                      /* Transmit with no CRC for ANTICOLLISION command */
buf[2] = 0x3d;                                      /* Write continuous to register 0x1D */
buf[3] = 0x00;                                       /* Data for register 0x1D */
buf[4] = NVB & 0xf0;                            /* Data for register 1E */
if ((NVB & 0x07) != 0x00)                   /* Number of complete bytes – Data for reg. 0x1E */
buf[4] |= ((NVB & 0x07) << 1) + 1;    /* Number of broken bits with Broken byte flag set in reg. 0x1E */
buf[5] = select;                                    /* Can be 0x93, 0x95 or 0x97 */
buf[6] = NVB;                                       /* Number of valid bits = 0x20*/
buf[7] to buf[7+searchlength] = UID search criterion

SS line high

3.But when i goes further and transmit the SELECT command with the Collected UID(at cascade level 1),the TRF7970A chip behave abnormally.

SS line low

buf[0] = 0x8f;                                                          /* Reset FIFO */
buf[1] = 0x90;                                                         /* Transmit with CRC for SELECT command */
buf[2] = 0x3d;                                                         /* Write continuous to register 0x1D */
buf[3] = 0x00;                                                         /* Data for register 0x1D */
buf[4] = NVB & 0xf0;                                              /* Data for register 1E */
if ((NVB & 0x07) != 0x00)                                     /* Number of complete bytes – Data for reg. 0x1E */
buf[4] |= ((NVB & 0x07) << 1) + 1;                       /* Number of broken bits with Broken byte flag set in reg. 0x1E */
buf[5] = select;                                                       /* Can be 0x93, 0x95 or 0x97 */
buf[6] = NVB;                                                           /* Number of valid bits = 0x70 */
buf[7] to buf[7+searchlength] = UID search criterion

SS line high

When I was trying to transmit select command with UID, I get interrupt on the IRQ line of TRF7970a before the complete transmission. Because When I read IRQ status register of TRF7970a I get a value 0xa0 which means TX is active . Then I wait for the completion of the transmission. Again it sends a interrupt on the IRQ line but this time the value of IRQ status register is 0xc0 which means Response of the tag( RX flag of IRQ status register of TRF7970A ) got mixed with the TX completion flag. So I am not able to collect the UID correctly.

Please help me to resolve this issue.

  • Tanveer - 

    when you send out the REQA, since you get the ATQA, then this means you have set the ISO Control register to 0x88, which is correct.  Then you should leave the ISO Control register set for 0x88 when you send out the SEL + NVB command and i see you are telling the reader to send with CRC (0x91) (please correct your comments in your code, they are backwards) so that you are sending then: 

    0x8F, 0x90, 0x3D, 0x00, 0x20, 0x93, 0x20...this should result in retrieving the (possibly first) 4 bytes of UID + BCC (if first byte of this is 0x88, then you know its a double or triple size and you will then have to do cascade) 

    either way, then you need to then set ISO Control register to 0x08 so that you can then send with and receive CRC correctly for the SELECT command. 

    which should be: 0x8F, 0x91, 0x3D, 0x00, 0x70, 0x93, 0x70 + 4 bytes UID received + 1 byte BCC received, to then get the SAK, which confirms the UID is complete (or not, which would then result in going around again)

    you can also reference this document, which shows a lot more detail on this part of ISO14443A tag handling.

    8037.NFC Forum Type 2 Tag Platform Operations with TRF7970A_02_2014.pptx

  • Hi Josh,

    Thanks for your quick response.but the problem is not resolved. I am  describing you with more detail.

    After transmitting REQA command and retrieving ATQA response when i run anti-collision loop and transmit 0x8F, 0x90, 0x3D, 0x00, 0x20, 0x93, 0x20 ....tag responds with 0x88 (first byte)+ 4 UID byte. (but i see there is no BCC byte in retrieved bytes.)

    Then i set ISO control register to 0x08 and send SELECT + NVB + 0x88 + 4 UID byte

    which is : 0x8F, 0x91, 0x3D , 0x00, 0x70, 0x93, 0x70, 0x88 + 4 UID byte............then i get two interrupts. At the first interrupt the status of IRQ status register is 0xA0( but i was expecting 0x80) which means TX is active. then i wait for completion of Transmission. And again i gets the interrupt but this time status is 0xC0(which is confusing me either this is for TX completion or for RX completion). So in both the situation i am unable to service the interrupt properly.

     And i do not gets SAK response after sending SELECT command.

  • so if the first byte (UID0) is 0x88, then this means the tag is a double or triple size UID. Which then means that the reponse you are getting is UID0 = 0x88, then first three bytes of UID and one byte BCC (which is nothing more than XOR of these bytes) for example....if we get a response of 0x88, 0x05, 0x34, 0x00, then the BCC of those preceding four bytes is 0xB9.

    so, to summarize, you are receiving the first three bytes of the UID and there are at least four more to retrieve by going through the cascade levels. when you send the select command...then you will get back the SAK, which should tell you that UID is not complete and need to increment the cascade level. 

    Do you reset the FIFO after getting the TX complete IRQ? Do you have any logic analyzer shots to share from your system? 

       

  • Hi josh,

    it means after running the anti collision loop i am getting 0x88(first byte) and 3 UID bytes these are : 0x04, 0x1F, 0x1C and 1 more BCC byte which is 0x8F.

    But still i was sending them correctly if i send these like this SELECT + NVB + 0x88 + 4 byte because i am sending 3 UID bytes combined with1 BCC byte

    which is: 0x8f, 0x91, 0x3D,0x00, 0x70,0x93, 0x70, 0x88, 0x04, 0x1F, 0x1C, 0x8F

    And after sending these i expect TX complete and RX Complete IRQ. but it doesn't happen TRF7970A sends me interrupt before the complete TX.

    I am sharing with you screenshots of logic analyzer.

     

  • Tanveer -  go ahead and send over the *.LPF file - we have same LSA

  • Hi Josh,

    I have attached *.LPF file.

    4426.SPI.zip

  • do you have one of entire thing (including writing of registers), plus IRQ line? you should be using it. what i see here is you poll the IRQ until you get 0x80 but then don't do anything afterwards.

    plus what is your data clock speed

    i was expecting something more like this: 

  • Josh,

    I have written these settings in registers.

    0x00(Chip status control register) :   0x20 (RF on and 3V operation)

    0x09 ( Modulator control register)  :   0x01(  not using SYS_CLK and 100% OOK)     

    0x01(ISO Control register)              :   initial 0x88 and after runing anti-collision loop 0x08

    After receiving I also wait for the RX complete IRQ. But i didn't get RX IRQ.the DATA_CLK value is 2 MHz.

    I have also attached the*.LPF file with IRQ details.

    1258.SPI.zip

  • Hi,

    I can conclude now that after running anti collision loop and transmitting SELECT +NVB + 0x88 + 3 bytes UID + 1 BCC byte, TRF7970A only sending TX IRQ and it is not sending antoher IRQ for RX IRQ. but why it is not sending RX IRQ?

  • The problem is  resolved now. 

    "Earlier i was simply by passing and not clearing the interrupt bit of MCU when i was getting status (0xA0) after transmitting SELECT + NVB + 0x88 + 3 UID bytes + 1 BCC byte. Because of this,interrupt handler runs again and   this time i was getting status 0x80 (which means TX complete).But In between of  this,RX complete IRQ was getting lost and i was never getting RX complete IRQ."

    Now i clear the interrupt bit  of MCU even when i was getting status 0xA0 of IRQ status register of TRF7970A. And after doing this i am getting three IRQ.

    At first IRQ status is 0xA0(means TX active).After this i get second IRQ and status is 0x80(means TX complete). And after this i get third interrupt and now status is 0x40(means RX complete). And now i am getting SAK.

    Thanks for the quick response.