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.

TRF7970A: reading mifare card with msp430f5529

Part Number: TRF7970A
Other Parts Discussed in Thread: MSP430F5259, MSP-EXP430F5529LP

Hi,

We design the pcb with msp430f5259 + trf7970a for reading/writing mifare cards.

I copy & paste project code from the F5529LP_TRF7970A_ALL_NFC_MODES which in the nfclink software(sloc333a - TRF7970A\examples\boards\MSP-EXP430F5529LP and with required library)

We don't need usb connection. Therefore I remove the usb codes. Now I want to have 4 byte UID of mifare card with NFC_B_getNfcBId function. That's all.

Is this enough for reading mifare card? Is there anything else to do like a some code modification etc.?

And I saw this line of code in the mcu.c file. Timer vector adress(TIMER0_A1_VECTOR) is diffrent from timer base adress(TIMER_A0_BASE) and it causes ISR_TRAP. How can I fix it?

#pragma vector= TIMER0_A1_VECTOR
__interrupt void TIMERA0_ISR (void)
{
    TIMER_A_clearTimerInterruptFlag(TIMER_A0_BASE);
    *g_timeout_ptr = 0x01;
//    MCU_timerDisable();
    __bic_SR_register_on_exit(LPM0_bits);
}

  • Hello unusual,

    I am not aware of any Type 4B Mifare cards, can you please clarify which tag you are trying to read? All Mifare tags are Type 2 or 4A.

  • Hi Ralph,

    I'm so sorry, I wrote wrong. ISO14443-A (NFC forum refers to they as Type 2).

  • Hello unusual,

    Looking at the source code, while the names are a bit off, the code says:

    #define TIMER0_A1_VECTOR        (52 * 1u)                    /* 0xFFE8 Timer0_A5 CC1-4, TA */
    
    and
    
    #ifdef __MSP430_HAS_T0A5__
                                                                            #define TIMER_A0_BASE           __MSP430_BASEADDRESS_T0A5__
    #endif
    
    

    So they point to the same timer base, and that should then have no issue. We haven't had an issue with that.

    If the USB functionality is properly removed, you should be able to read UID's from Type 2 tags.

    I'd suggest getting a logic state analyzer, like what Saleae offers, and look at the SPI lines to see if you are getting data packets sent out.

    Also you should verify you can read/write registers for the TRF7970A as well.

  • Hi again Ralph,
    No problem with Timer setup. Thanks for explanations...
    I want to ask a question about NFC_A_getSAK function return value. I have a mifare classic card and the code is :

    eTempNFCState = NFC_run();

    if(eTempNFCState == NFC_DATA_EXCHANGE_PROTOCOL)
    {
    if(NFC_RW_getModeStatus(&sRWMode,&sRWBitrate))
    {
    if( sRWMode.bits.bNfcA == 1)
    {
    // At this line I read 0x08 as a return value of NFC_A_getSAK function.
    //therefore code doesn't operate T2T_stateMachine() or T4T_stateMachine()...
    if(NFC_A_getSAK() == 0x00)
    T2T_stateMachine();
    else
    if(NFC_A_getSAK() & 0x20)
    T4T_stateMachine();
    }
    else
    if(sRWMode.bits.bNfcB == 1)
    { .......
  • Hello unusual,

    If you are using Mifare Classic that makes your task quite a bit more complicated. Mifare classic, while it does use the ISO14443A standard for getting tag UID etc., is ultimately a non-ISO standard compliant technology and considered a proprietary tag technology. Therefore the NFCLink solution you are using which is designed only for ISO/NFC standard tags isn't capable of supporting Mifare Classic by default. You can however, integrate that support into the code if you wish.

    That said, the only way that would make sense for you to do, is if you need to support Mifare Classic tags in addition to standard ISO/NFC tags. In all the applications I've supported, no one has needed to support both. Mifare Classic tends to be it's own standalone/closed-loop solution, whereas general NFC tag reading/writing applications focus on tags which are not proprietary.

    Anyways, we do have a full example for reading Mifare Classic tags as well, which you can reference. If you only need to do Mifare Classic, you should be able to port it to the F5529 easily enough.

    App note w/ software example included: http://www.ti.com/lit/pdf/sloa214

  • Dear Ralph,
    Now we read the mifare classic tags UID as you said before.
    Thanks for advice but
    With the example of sloa214 we only read mifare classic tags? is it valid for writting to the tags? If not how can we solve this problem...
  • Hello unusual,

    Correct the SLOA214 firmware only reads Mifare Classic tags. We don't have any collateral for writing to them. If you need to do that for your application, you will need to create the API's that handle the write process. The important part aspect of the code we provide is the TRF driver to handle Special Direct Mode. With that in hand, applying further commands like the Write API's becomes an application specific consideration which is to be handled on your end.