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.

TF7960 interrupt problem while reading a MIFARE card

Other Parts Discussed in Thread: TRF7960

Hello,

I am trying to read a MIFARE card. The odd thing is that after sending the REQA command after the first Interrupt with 0x80 (tx done) in the interrupt status register (0x0C) a second interrupt occurs with the value 0xC0 in the interrupt status register. The FIFO status register (0x1C) has the value 0x01 so there should be 2 bytes in the FIFO register to be read but I only read 0x00, 0x00. here is an excerpt of my code:

init procedure (taken from the StellarisWare "iso14443a.c"   implementation:

WriteRFIDReg(0x00, (ReadRFIDReg(0x00, 1)|0x29), 1);                //Enable RF field and receiver, 5V operation
 __delay32(160000);                                                                     //Wait 5ms (as per ISO 14443-3 clause 5)
 WriteRFIDReg(0x06, 0x20, 1);                                                      //Set the TX pulse to 106ns (0x20 * 73.7ns)
 WriteRFIDReg(0x07, 0x0e, 1);                                                       //Set the RX No response wait time ->
                                                                                                    //to 529us (0xe * 37.76us).
 WriteRFIDReg(0x08, 0x07, 1);                                                      //Set the RX wait time to 66us (7 * 9.44us)
 WriteRFIDReg(0x09, 0x31, 1);                                                     //Set the SYSCLK to 13.56MHz and ->
                                                                                                  //the Modulation Depth to OOK 
 WriteRFIDReg(0x0A, ((ReadRFIDReg(0x0A, 1)&0x0F)|0x20), 1);   //Configure the Special Settings Register
 WriteRFIDReg(0x0B, 0x80, 1);                                                   //Set the regulator voltage to be automatic 
 WriteRFIDReg(0x0D, (ReadRFIDReg(0x0D, 1)|0x01), 1);               //enable no-response interrupt

WriteRFIDReg(0x01, 0x08, 1);                                                   //Set the ISO format to ISO1443A 106Kbps, CRC

The REQA command sequence (taken from the TRF7960EVM_SPI_REQ_A.lpf logic analyzer file):

  ReadWriteSPI1 (0x8F);   
  ReadWriteSPI1 (0x90);   //no CRC
  ReadWriteSPI1 (0x3D);
  ReadWriteSPI1 (0x00);
  ReadWriteSPI1 (0x0F);
  ReadWriteSPI1 (0x26); //REQA

This at least provokes an interrupt. I also tried the following sequence but this had no effect:

  ReadWriteSPI1 (0x8F);  
  ReadWriteSPI1 (0x90);   //no CRC
  ReadWriteSPI1 (0x3D);
  ReadWriteSPI1 (0x00);
  ReadWriteSPI1 (0x30);
  ReadWriteSPI1 (0x26); //REQA
  ReadWriteSPI1 (0x01);
  ReadWriteSPI1 (0x00);

The oscillator status register (0x03F) has always different values like 0x00, 0x40, 0x7F.

Any ideas what is wrong?

Best regards,

Dejan

  • Dejan -

    if you are sending out command string for no CRC (which is correct), then you should set ISO Control register (0x01) up for 0x88, no?  

  • Hi Josh,

    You are absolutely right! It's a typing error. The correct line (which I am using) is:

     WriteRFIDReg(0x01, 0x88, 1);        //Set the ISO format to ISO1443A 106Kbps, no CRC

    This results in an IRQ status of 0xC0 and FIFO Status of 0x01. Reading of the FIFO results in 0x00, 0x00.

    The oscillator status register (correct address is 0x0F) varies as a function of the distance between the card and the antenna (0x7F, when I lay the card onto the antenna, 0x48 for a distance of 4.5cm between the card and the antenna).

    BR - Dejan

  • Dejan -

    Here is what we do for reading ISO14443A cards (in this case that standard applies for Mifare up to Select Command, but not afterwards)

    Set register

    0x09 to 0x21

    0x01 to 0x88

    0x1A to 0x40

    then send

    0x8F, 0x90, 0x3D, 0x00, 0x0F, 0x26

    then about 85uSec later (at least on our MSP430 platform) we get first IRQ, which is end of TX and when read should be 0x80 (and should be followed by dummy clock cycle (per SPI errata) and then followed with reset of FIFO with dummy clock, per SPI errata)

    then about 236uSec later we get second IRQ, which is end of RX, yields a 0x40 and should be followed by dummy clock cycle (per SPI errata)

    then we can read the FIFO status register which should be 0x01, since ATQA is two bytes and FIFO register value is n+1

    [This is where you have gotten to i think, but there are more steps to Type A in order to retrieve UID]

    Then you can reset the FIFO with Direct Command 0x8F and dummy clock (again, per SPI errata)

    Then you can write the ISO Control Register again with 0x88 (or just read it to make sure it is set) and issue the Anticollision Command

    0x8F, 0x90, 0x3D, 0x00, 0x20, 0x93, 0x20

    then about 190uSec later we get first IRQ for end of TX (handle same as before), then about 500uSec later we get second IRQ, indicating that RX is complete, so then we read the FIFO status register which in this case/example yields 0x24, since i put single size UID card in the field, indicating there are 5 bytes to retrieve (UID + CRC)

    After this we go read the RSSI register for the value, and follow that with reset of the FIFO(handled as before, per SPI errata)

    this is example sequence with no collision, so then you keep going and transmit Select Command (with CRC now) to get back Select Acknowledge (SAK) which would then be the point at which the response takes you into the proprietary Mifare operations you will see later in the code.

     

     

     

     

  • Hi Josh,

    So I finally got some time to work on my implementation. Thank you for the information. I have set the registers according to your proposal (by the way: I haven't found any information on register 0x1A, can you help me on that? What is the purpose of this register?). So even though I followed your advice I still get on the first IRQ 0xC0 (RX and TX together, this happens when I start the procedure with the card already on the antenna).

    Anyway, continuing the above described procedure I receive the same result as you do (FIFO status register yields 0x24). Then I read the FIFO (expecting 5 bytes) but all I read are 0x00, 0x00, 0x00, 0x00, 0x00.

    On the logic analyzer grafic (TRF7960EVM_SPI_REQ_A.LPF) you are writing also to register 0x18 (well a 0x58 during 2 clock cycles where you read a 0x01) any information on that?

    So what do think what could be the problem reading only 0x00 fron the FIFO?

     

    Best regards,

    Dejan

  • Dejan -

    as i mentioned before, registers 0x1A and 0x1B are test registers. They set up the IC for test or direct chip (special connections) use.

    regarding your issue - which hardware and card are you using? Your own board/antenna design or our EVM? Are you setting the protocol correctly beforehand? have you checked the card with our EVM or any other reader to see what the ATQA is? if using your own hardware, what is antenna tuning, BW and resulting Q, what is fres of the card? Do you have any LSA shots or pictures of your setup of your own to share? these would be most helpful in troubleshooting your problem here.  

     

  • After sending of the first command 0x8F, 0x90, 0x3D, 0x00, 0x0F, 0x26 there is a first interruption, but not after 85uSec, later

    The register of the status of interruptions - 0x80

    After the second interruption comes, but the register of the status of interruptions doesn't contain a code 0x40, and contains a code - 0x42 that causes procedure of reading FIFO of contents bytes of collisions 

    What is such reason?

  • Alex -

    the 0x42 you are seeing indicates that the RX is completed, but there is a collision present - main reason would be there is more than one Type A card in the field.

    Please see DS on page 31 for the bit definitions for the register 0x0C ==> http://focus.ti.com/lit/ds/symlink/trf7960.pdf 

     

  • DS has been read from cover to cover... And that that was the collision I wrote above, but all charm in that that a card one and nearby isn't present more what cards

    Mind I will not put why there is a collision error.

  • Alex -

    trying to understand your last post...are you still seeing a problem? Are you using the TRF7960EVM and it's firmware/GUI or your own hardware, firmware, PC interface?

     

  • I use microcircuit TRF7960 and the software of work with it from TI. The Printed-circuit board of my working out, but the aerial is made under recommendation TI, and I use microcircuit AVR. GUI I create for myself

  • Alex -

    thanks - so as the layout and antenna tuning is always part of a working circuit and as ISO14443 Type A is most inferior card technology available (high speed and ASK both ways) as it is the most subject to to ambient noise problems...i must ask you if you have:

    1. double checked the antenna, meaning ==> measured the complex impedance of the antenna coil you produced and then matched it back to 50 Ohms/and verified that it is tuned correctly with proper bandwidth setting.

    2. made sure that on your layout you have good seperation distance from TX and the two RX in lines.

    3. Check your power out of the impedance match of the TX circuit for ~+23dBm (if running at +5VDC, ~18.25dBm if running at 3.3VDC) with power meter (to ensure you have good impedance match to your antenna)

    4. Made sure that you do not have any noise coming from any power supply caps or from the microcontroller...(i had one customer have trouble here with similar circumstance and we found that placement of the caps for the Microchip IC power supply was root cause of noise being coupled into the RX lines.

    5. Made sure the card you are using is decent quality part, meaning the resonant frequency is close to range of 13.56MHz to 14.2MHz.  (i have seen more than several Type A card devices be way off tune - like 16MHz to 19MHz - and they spell trouble for you (with any RFID reader system)  

    these are a few things to start out with for troubleshooting your problem - please let us know how it goes.

     

  • Thanks that have responded to my problem. 

     

    1. I can't check up aerial parameters, as not the necessary equipment.

     

    2. Lines TX and RX are carried, but not as on an example from TI, it is possible that and disturbs to correct work.

     

    3. To spend capacity measurement it is not obviously possible, in the absence of the equipment

     

    4. Amplitude of pulsations on a food at the disconnected transmitter and the included microcontroller no more 8mV,

    Other sources of hindrances aren't present.

     

    5. Has measured frequency of the transmitter - 13,5614 MHz

    Amplitude on input RX1 (АМ) ~2,08 Volt

    Amplitude on input RX2 (РМ) ~1,92 Volt

    At a card present to the aerial, the amplitude on RX1 falls and on RX2 grows

    Frequency thus fluctuates in a limit from 13,2 MHz to 13,84 MHz

  • Alex -

    I would highly recommend that you double check the antenna tuning here, please - devices such as the MFJ devices you will find here are not expensive and work fairly well for this task if you do not have access to network analyzer, power meter or oscilliscope

    http://www.mfjenterprises.com/Catergories.php?sec=41

    http://www.mfjenterprises.com/Catergories.php?sec=13

     

  • I'm facing the same problems. Did you found any solution for that ?

    Best regards,

    Valentin