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.

Questions and problems with processing IRQ requests from TRF7963A Reader/Writer IC

Other Parts Discussed in Thread: TRF7963A, TRF7960A, TRF7964A, TRF7970A

Hello,

I am using the TRF7963A Reader/Writer IC to read and write tags that use an NXP NTAG213 device.

I was wondering if there is a recommended method for determining what actions to take in the interrupt handler based on the bits that are set in the IRQ Status Register when an IRQ service request is raised by the device. In particular are there certain conditions that take priority over others, and are any of the bits in the IRQ Status register mutually exclusive?

I believe I am not processing the IRQ interrupts correctly because I am encountering some unexpected results when going through the procedure for selecting a tag. I am also not obtaining the data I expect when reading from a (selected) tag using the NFC Forum READ command.

 

Some additional information:

-          The NXP NTAG213 device is compliant with NFC Forum Type 2 Tag and ISO/IEC14443 Type A specifications

-          It has a 7-byte NFCID1

-          I am not implementing any of the anti-collision procedures.

 

To show what the interrupt handler is seeing I am logging the value of the IRQ Status Register (0x0C) each time the IRQ request is processed.

Example 1

One example of something I am encountering occurs when sending an SDD_REQ command for cascade level 2. This problem does not always occur and when it does not happen I am able to successfully select the device and obtain its UID. I ask the TRF7963A to transmit the following (so the listening tag should transmit back the complete cascade level 2 of its NFCID1):

 0x95 0x20

I then receive 2 successive IRQ interrupts with the bits of the IRQ status register as shown (note that only the positions numbers of bits that are set are shown and zero bits are represented by underscores):

First interrupt                    {7_______}         (End of transmit phase)

Second interrupt              {_6_____0}        (Receive started AND no response timeout)

The logic I use in my interrupt handler stops processing the transaction because the “no response” (bit 0) is set. However it seems contradictory that the both the “RX start” (bit 6) and the “no response” bits are set at the same time.

If I re-try the same transaction again, the next interrupt has the IRQ status register as:

{76______}

My interrupt handler ends the transaction on account of bit 6 being set without the “FIFO high/low” (bit 5) also set. However, I haven’t found anything in the documentation to indicate how to proceed when both bits 7 and 6 are set at the same time.

If I re-try the same transaction a third time I see the following, which is typically what I will see for any transaction when there are no listening devices in the field:

First interrupt                    {7_______}

Second interrupt              {_______0}

Example 2

A second problem I am having occurs when I have a tag properly selected and I send the READ command and expect to receive 16 bytes.  Below are the IRQ service requests I see and how I process each.

IRQ Status

FIFO Status

Actions / Interpretation

Transmit READ

Command

(0x30 0x00)

{7_______}

(0x80)

-

Read IRQ Status register

End of transmit READ command so nothing to do

Receive data

{_65_____}

(0x60)

0x69

Read IRQ Status register

Receive in progress, FIFO is high

Read FIFO Status register

FIFO Level high, 9+1=10 bytes not yet read out

Read 10 bytes out of the FIFO

Receive data

{_6______}

(0x40)

0x25

Read IRQ Status register

Receive complete

Read FIFO Status register

5+1=6 bytes not yet read out

Read 6 bytes out of the FIFO

 When the transaction is finally over I have received the expected number of bytes (16), however when I compare them to what I expect to receive there is a discrepancy (see table below). The first 10 bytes read from the FIFO are correct. However the next 6 bytes are not. It appears that either data is missing or possibly the internal FIFO buffer pointer is offset by one position for the second read (hard to tell for sure because of the multiple zero values).

Byte

Expected

Data

Data Read from TRF7963A FIFO

0

0x4

0x4

1

0xf

0xf

2

0x17

0x17

3

0x94

0x94

4

0x4a

0x4a

5

0xa1

0xa1

6

0x3e

0x3e

7

0x81

0x81

8

0x54

0x54

9

0x48

0x48

10

0x0

0x0

11

0x0

0xe1

12

0xe1

0x10

13

0x10

0x12

14

0x12

0x0

15

0x0

0x0

 

If anyone can point out any mistakes that I am making in processing these interrupts, or point me to some guidelines on how to do this I would really appreciate it.

Thank you,

Steve

  • Steve - 

    See the attached. Slide 5 in particular - Type A requires requires anti-collision. I think what you meant to say is that you are not doing more than one tag at a time and therefore you don't do the loop on the right of that diagram which involves sending the anti-collision command with the UID CLn. (steps 7 & 8)

    now then - with these tags, make sure you are setting the ISO control register to 0x88 and sending out your command with 0x90 (instead of 0x91) (see slide 3) -  until you get to selection, when you need to send out 0x95 0x70, then you need to set ISO Control to 0x08 and send with 0x91. Then you have to loop back again to repeat process to send out 0x95 0x20...and select it again. Walk through the slides you will see what i mean. 

    0005.NFC Forum Type 2 Tag Platform Operations with TRF7970A_02_18_2014.pdf

    Since these tags do not follow ISO14443-4, you may also need to switch to TRF7960A (see ) or TRF7964A or TRF7970A for ops after that - since to then read and write tags and get back ACK/NACK, which means you need register 0x10, which is not available in the TRF7963.

    good news is all the TRF79xxA devices are pin for pin compatible. So if you switch to the TRF7960A at a minimum, you are OK for that - if you just need to get UID out, then you can stick with the TRF7963. 

  • Hi Josh,

    Thank you for your response, and for correcting my mistake re. not implementing anti-collision. Indeed, what I meant was that in my application the detection (collision) of more than one tag can be treated as an error condition so I don’t need to go through the trouble of resolving individual UIDs.

    The slides you provided in your link were extremely useful. I went through them in detail and as far as I can see I am at least conceptually performing the operations described for sensing and selecting a tag. The biggest difference between the described procedure and my implementation is that I don’t always string together a series of commands, reads and writes etc. in a buffer and write them all to the TRF7963A device in a single SPI transaction. For example, I tend to send individual commands, set up the TX Length bytes and write to the FIFO each as separate SPI transactions. That said I am able to get through the selection/anti-collision procedure most of the time and obtain the UID of the selected tag, so it appears that my approach does work.

    Your comments about possibly needing to switch to a different device in order to utilize the READ and WRITE commands of the NTAG 213 tags caught me by surprise. Can you definitively confirm that the TRF7963A device cannot be used? It was chosen for our application based on its low price and the belief that it was capable of doing simple reads and writes to the user memory space of the tags.

    In my previous post I indicated that I was not getting back the expected data when using the READ command. In the example I gave, the tag is responding with 16 bytes of data + CRC (so not a NAK response). I would think that would constitute a valid transaction for the TRF7963A. However, as I indicated some data read from the FIFO is either missing or is misaligned. Could this be attributed to the TRF7963A not being suitable for READ and WRITE commands?

    I have also (just) tested using the WRITE command. What I am finding is that while the four bytes of data are actually written to the tag, the TRF7963A always indicates a “no response”. Could that be explained because the tag is always responding to the WRITE command with a 4-bit ACK/NAK, and the TRF7963A reports that as a “no response”?

    I would prefer not to have to upgrade to a different Reader/Writer device if possible so if you could say for sure that the TRF7963A is or is not suitable for my application that would be ideal.

    (By the way, the datasheet for the TRF7960A device does not show it to implement the Special Function Register (0x10) that you mentioned is needed to handle the 4-bit ACK/NAK without CRC.)

     

    Thanks again for your help,

    Steve

  • Steve - glad that the document helped. Regarding the device - as long as you are OK with handling what you do get back for four bit ACK or NACK when writing with this device, then by all means its OK to use. Sorry if I went too far there in recommending a device which handles it correctly - just want you to be happy. 

    you are right the data sheet needs  to be updated - the register 0x10 (for the TRF7960A) is documented here at the moment. (page 3)

     

  • Hi Josh,

    No worries, I appreciate you making me aware that the TRF7963A is not the best choice for receiving 4-bit ACK/NAK responses. Unfortunately the way it is working right now is not suitable for my application since I do need to be able to confirm an ACK response when I write to the tag. I went ahead and ordered some TRF7964A devices (I had already ordered them before you mentioned that the TRF7960A does actually have the register 0x10). I'm finding that I am not able to get past the very first stage of sensing the tags and I have run out of ideas.

    What I see (consistently) is that I send an ALL_REQ command (WUPA) and I get no response from the tag. I send that same command a second time and I get the expected 2-byte response. I then proceed to send out my SDD_REQ and always get no response from the tag, even after 3 attempts.

    Could you suggest what differences there are between the TRF7963A and the TRF7964A that might explain why the methods that I was using that worked on the 73A device do not work on the 74A device?

    I have already identified that the SPI clock mode is different, and that the 'Modulator and SYS_CLK Control Register (0x09)' has bit that is set by default to enable the 27.12MHz crystal (I clear this bit before any transaction with the tag). In the 'Special Functions Register (0x10)' bit 1 can be used to disable anti-collision frames but it is cleared by default so that should not be the problem.

    Anything you could suggest would be much appreciated.

    Thanks,

    Steve
  • the TRF7960A should drop right in because SPI is same as TRF7963A

    with the TRF7964A,
    1. you send 0x83 0x80 to make sure SPI is working correctly - you already noted that clock polarity does not change
    2. you have the register 0x09 to take care of (bit 7 needs to be cleared when using 13.56MHz crystal) - you covered that
    3.at the same time you clear B7 in register 0x09, you are writing bit 0 with 1, so in one write to register 0x09, you write in a 0x01
    4. you write 0x00 to register 0x18 to make sure its 0x00 for reader mode
    that should be it for differences - now then for all what would remain the same
    5. you set ISO control register 0x01 to 0x88
    6. turn on TX (register 0x00 set to 0x21 or 0x31 or 0x20 or 0x30)
    7. then issue your command REQA or WuPA (0x26 or 0x52)
    8. get ATQA
    etc.
    it would not be until you go to read or write the blocks that you would need what register 0x10 adds.

    do you have any logic shots of what you are configuring for, sending and then getting back?
  • Hi Josh,

    Thanks for the detailed response. I discovered the main issue behind not being able to get through selecting a tag and it lies in how I was breaking up the individual commands and register read/write operations into individual SPI transactions. For example, whenever I wished to transmit something I would do the following:

    A) Lower CS, send the Reset command, Raise CS
    B) Lower CS, send the appropriate Transmit command, Raise CS
    C) Lower CS, send a write, continuous to register address 0x1D followed by the two TX length bytes, Raise CS
    D)Lower CS, send a write, continuous to register address 0x1F (FIFO) followed by the data to be transmitted by the reader, Raise CS

    I discovered that if changed the position of step A) in that list I would get different results. After some more digging around I discovered that if I used the order B,C,A,D and using the debugger executed step A without going to step D, I could see the TRF7964A start transmitting and eventually raise the IRQ even though I had not yet put any data into the FIFO. So from all this I have concluded that it is essential to set up the transmit length registers, place data into the FIFO and issue the appropriate Transmit Command all withing the same SPI transaction (i.e. without ever raising the CS). Otherwise what the device actually transmits appears to be very much dependent on how quickly the correct data can be be placed in the FIFO. Unfortunately that is not something that is mentioned in the datasheet.

    The good news is that that I am back to being able to select the tag (now reliably and on the first try). I can read from the tag using the READ instruction and the data that I get back is correct, in the right order and without missing any bytes. However I am stuck on the last thing that I need to do which is to write to the tag using the WRITE command.

    Just as I experienced when I was using the TRF7963A, I am getting 'no response' from the tag whenever I attempt to write to it. However, I am seeing that the 4 bytes of data are written to the tag. Before initiating the transmission I do the following:
    - Register 0x10, set bits 1 and 2 (normal framing, 4-bit receive)
    - Register 0x01, set bit 7 (CRC not present in response)

    I also use the Transmit With CRC command (0x11). In fact, other than the actual block address and data I am doing what is described in slides 16 and 17 of that guide you pointed me to earlier.

    I am actually "sniffing" the modulated RF field as the air-interface transactions take place and as far as I can tell, the tag really is not replying with either an ACK or a NAK.

    Can you think of anything in the reader configuration that might explain this?

    Also, in point #4 of your last post you mention register 0x18 but it does not exist in the 64A or 60A devices. Was that a typo?

    Thanks,

    Steve
  • Hi Josh,

    Just to give you an update, I now have the WRITE command working. It turns out that the tag was actually returning an ACK but I neglected to take into account that the tag was writing to its internal EEPROM so the ACK response took a long time to appear.

    The reason I was getting a 'no response' was because I had set bit 0 in the Interrupt Mask Register (0x0D). I'm now not clear on how to use that feature of the reader/writer device. Is it something that I can set up and use for any protocol by configuring the' RX No Response Wait Time' register (0x07)? Table 6-28 in the datasheet states "only for ISO15693". Up until I ran into a problem with the WRITE operation I found it extremely useful to have an IRQ notification that no device responded. That allowed my driver to distinguish between the case where no device responds, and one where something is wrong with the state of the reader/writer device and it is not capable of generating IRQ service requests (in which case I typically reset it to try and recover).

    Could you let me know if it is reasonable to use the 'no response' interrupts for my particular application?

    Thanks again for your help,

    Steve