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.

TRF7964A: Using TRF7970ABP_RFID_Reader_Demo code

Part Number: TRF7964A
Other Parts Discussed in Thread: MSP-EXP430G2ET

Hi ,

I am using the code from TRF7970ABP_RFID_Reader_Demo\NFC for ISO14443a card reading. When I reach the function ISO14443A_sendSelectCmd (shown below), g_sTrfStatus never equals RX_COMPLETE. Up until this point it seems ok. Can you offer any help?

Attached are the MISO, CLK, and MOSI for the communication during this function. It seems that I am getting collision even though only one tag is being presented. At any rate, the MISO in the last image does not seem to be synced correctly.

Thanks, 

Becky

uint8_t ISO14443A_sendSelectCmd(tISO14443A_UidStatus sCascade, uint8_t * pui8UID, bool bSendCT)
{
uint8_t ui8Offset = 0;
uint8_t ui8Status = STATUS_FAIL;
uint8_t ui8Select = SEL_CASCADE1;

if (sCascade == CASCADE1)
{
ui8Select = SEL_CASCADE1;
}
else if (sCascade == CASCADE2)
{
ui8Select = SEL_CASCADE2;
}
else if (sCascade == CASCADE3)
{
ui8Select = SEL_CASCADE3;
}
else
{
return ui8Status = STATUS_FAIL;
}

g_pui8TrfBuffer[ui8Offset++] = 0x8F; // Reset FIFO
g_pui8TrfBuffer[ui8Offset++] = 0x91; // Transmit with CRC
g_pui8TrfBuffer[ui8Offset++] = 0x3D; // Write Continuous
g_pui8TrfBuffer[ui8Offset++] = 0x00; // Length of packet in bytes - upper and middle nibbles of transmit byte length
g_pui8TrfBuffer[ui8Offset++] = 0x70; // Length of packet in bytes - lower and broken nibbles of transmit byte length
g_pui8TrfBuffer[ui8Offset++] = ui8Select; // Select Command; can be 0x93, 0x95 or 0x97
g_pui8TrfBuffer[ui8Offset++] = NVB_FULL; // Number of valid bits
if (bSendCT == true)
{
g_pui8TrfBuffer[ui8Offset++] = 0x88; // CT
g_pui8TrfBuffer[ui8Offset++] = *pui8UID; // UID Bytes
g_pui8TrfBuffer[ui8Offset++] = *(pui8UID + 1);
g_pui8TrfBuffer[ui8Offset++] = *(pui8UID + 2);
g_pui8TrfBuffer[ui8Offset++] = ( 0x88 ^ *pui8UID ^ *(pui8UID + 1) ^ *(pui8UID + 2) ); // Calculate BCC Byte
}
else
{
g_pui8TrfBuffer[ui8Offset++] = *pui8UID; // UID Bytes
g_pui8TrfBuffer[ui8Offset++] = *(pui8UID + 1);
g_pui8TrfBuffer[ui8Offset++] = *(pui8UID + 2);
g_pui8TrfBuffer[ui8Offset++] = *(pui8UID + 3);
g_pui8TrfBuffer[ui8Offset++] = ( *pui8UID ^ *(pui8UID + 1) ^ *(pui8UID + 2) ^ *(pui8UID + 3) ); // Calculate BCC Byte
}

TRF79xxA_writeRaw(&g_pui8TrfBuffer[0], ui8Offset); // Issue the Select Command

g_sTrfStatus = TRF79xxA_waitRxData(5,15); // 5 millisecond TX timeout, 15 millisecond RX timeout

if (g_sTrfStatus == RX_COMPLETE)
{
ui8Status = STATUS_SUCCESS;

g_ui8Iso14443aSAK = g_pui8TrfBuffer[0];
}
else
{
// Do nothing
}

return ui8Status;
}

  • Hello Becky,

    this function is called inside a loop, which increases the cascade level. Does this issue occur in all loop rounds for all cascade levels?

    Best regards,

    Andreas.

  • Hi Andreas, 

    Yes I see it is inside a while loop, but because this function does not return STATUS_SUCCESS, it exits the loop. Are you referring to the recursive call?

    Later in ISO14443A_selectTag, the function calls itself.

    But at no point do does ISO14443A_sendSelectCmd go past CASCADE1. It never advances - just retries cascade 1.

    unsigned char ISO14443A_selectTag(unsigned char ui8Command)
    {

        .
        .
        .

        while (sUidProgress != UID_COMPLETE)

        {
             sCollisionStatus = ISO14443A_sendAnticollisionCmd(sUidProgress, NVB_INIT, &g_pui8CompleteUid[0]); // Call anticollision loop function

            // Process the response
            if (sCollisionStatus == NO_COLLISION)
            {
                // Store the UID and keep track if the CT byte needs to be sent
                bSendCT = ISO14443A_storeUID(sUidProgress,&g_pui8TrfBuffer[0]);

                // Issue Select command
                if (ISO14443A_sendSelectCmd(sUidProgress,&g_pui8CompleteUid[g_ui8UidPos],bSendCT)) // Issue the Select Command
                {
                    .
                    .
                    .
                }
                else
                {
                    // Break to hit the re-try loop
                    sUidProgress = UID_INCOMPLETE;
                    break;
                }
            }
            .
            .
            .
        }

        .
        .
        .

        if (sUidProgress == UID_INCOMPLETE)

        { // Some error occurred, attempt to find the tag again

            if (g_ui8RecursionCount < g_ui8MaxRecurviseCalls)
            {
                g_ui8RecursionCount++;
                ui8Status = ISO14443A_selectTag(ui8Command);
            }
            else
            {
                g_ui8RecursionCount = 0; // Reset the recursion count for the anticollision loops
                return ui8Status;
            }
        }

        .
        .
        .

    }// end ISO14443A_selectTag


    .Best regards, 

    Becky

  • Hello Becky,

    I would suggest to analyze the UID inside the function call ISO14443A_sendSelectCmd and to find out why this function call never ends in status success. Is there a UID received at all? Does the RX interrupt occur? etc...

    Btw, which MCU hardware are you using? The MSP-EXP430G2ET LaunchPad?

    Best regards,

    Andreas.

  • I am using Microchip PIC18F67J11 on our product's hardware.

  • I'm asking because in this case it might be worth to buy a MSP-EXP430G2ET LaunchPad and run the original code for reference and to compare the results.

    I'm just brainstorming...

    Best regards,

    Andreas.

  • That's what I am trying to analyze. 

    The pictures of the SPI I sent are from inside ISO14443A_sendSelectCmd,  from this function call 

    TRF79xxA_writeRaw(&g_pui8TrfBuffer[0], ui8Offset);

    until after this line

    g_sTrfStatus = TRF79xxA_waitRxData(5,15);

    I receive TRF79XXA_IRQ_STATUS_TX_COMPLETE after sending, but then eventually TRF79XXA_IRQ_STATUS_NO_RESPONSE. This is what I'm trying to figure out. What would cause the TRF to send NO_RESPONSE? The Mifare card doesn't respond to the TRF?

  • Hello Becky,

    I would recommend to compare against the reference solution with the MSP-EXP430G2ET LaunchPad. This way you could rule out several things like the tag and the reference software. And you could compare firmware parameters and timing. Otherwise it is really hard to debug.

    Best regards,

    Andreas.

  • Hi Andreas, 

    I have requested EVM so I can debug. In the meantime I have downloaded the IDE and tried to compile the project, but apparently don’t have the correct compiler, or am missing something. I do not know what I need.

    Can you help with this?

    Thanks, 

    Becky

     

     

  • Hello Becky,

    you are right. I just noticed that this old code projects seems not being supported by CCS version 12.

    I don't know at which exact version the support broke, but I was able to compile the code with CCS version 10.2, which I still had on my computer. But some extra steps were necessary, which I will explain later. But first I would suggest to install CCS version 10.2. You can find older versions at the CCS download section by pressing "View all versions":

    Then scroll down to version 10.2.0.00009 and select it. Then you can download the corresponding installer file.

    Make sure to select "MSP430 ultra-low power MCUs" support during the custom installation setup.

    Once the CCS 10.2 installation is completed, you have to add the older MSP430 compiler version 4.3.3 to CCS.

    From the menu: Help - Install New Software...

    Then select the Code Generation Tools Update page from the drop down list:

    Uncheck the box "Show only the latest version of available software" (1.) and then expand the arrow in front of "TI Compiler Updates" (2):

    Scroll down until you find "MSP430 Compiler Tools" - version 4.3.3, select it and press next:

    Once installed you can import the "TRF7970ABP_RFID_Reader_Demo" project to your CCS workspace and compile it.

    Let me know if you need further assistance.

    Best regards,

    Andreas.

  • Hi Andreas,

    Thank you, now I am able to build the project successfully.