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: Write to MiFare Classic 1K Cards

Part Number: TRF7970A

Hi, 

We are using a custom built board based on TRF7970A EVM design.  Firmware being used is SLOA214.

We were able to read from MiFare Memory blocks using this code. However, the implementation of write block was commented.

We have implemented the write block function as below 

void RFID_WriteBlock(unsigned char u8Sec_Block, unsigned char* pu8BlockData)
{
unsigned char buf[18];
//unsigned char i;

	unsigned short* u16FlagRFidWR;

        //  --> 010A000304 C8 A0 xx 0000
        /* encrypted request mode - Write */
         buf[0] = 0xA0;
         buf[1] = u8Sec_Block;


         u16FlagRFidWR = MifareTransceiveCommand(&buf[0], 2, 0, 0);
         if (u16FlagRFidWR != 0)
         {
             //  for(i = 0; i < 16 ; i++)
             //  buf[i] = pu8BlockData[i];
          u16FlagRFidWR = MifareTransceiveCommand(pu8BlockData, 16, 0, 0);
          if (u16FlagRFidWR != 0)
          {
#ifdef ENABLE_UART
          UartSendCString("Data Written - ");
#endif

          }
         }
}

But with this code, data is written correctly to only One MiFare Card, just after power Up.

For all other writes, junk values are written..

Any suggestions to rectify would be of great help.

thanks in advance

Saagar