AnsweredAssumed Answered

The card tag not detected MFRC531.

Question asked by eklee eklee on May 14, 2019
Latest reply on May 16, 2019 by Kan_Li

Dear

 

We use MRFC531.

I tag card. But it is not detect, and I am debugging.

I wonder source code.

  1. char CL_GetChallenge(unsigned char CID, unsigned char *Buf)   
  2. {   
  3.     unsigned char len;   
  4.    
  5.     Buf[0]=0x0A;    // I-block PCB with CID   
  6.     Buf[1]=CID;     // CID   
  7.     Buf[2]=0xb8;    // INF:CLA   
  8.     Buf[3]=0x84;    // INF:INS   
  9.     Buf[4]=0x00;    // INF:P1   
  10.     Buf[5]=0x00;    // INF:P2   
  11.     Buf[6]=0x04;    // INF:Le   
  12.     if(M500PiccExchangeBlock(Buf,9,Buf,&len,1,FWI)!=MI_OK) return(!MI_OK);   
  13.     if(Buf[len-4]==0x90) return(MI_OK);   ===> what means?
  14.     else return(!MI_OK);         
  15. }

in 13 line

char T_Money_DF_SELECT(unsigned char CID, unsigned char *Buf)
{
 unsigned char len;

 Buf[0]=0x0A|BLK;// I-block PCB with CID
 BLK ^= 1; // Toggle block number
 Buf[1]=CID;   // CID
 Buf[2]=0x00; // INF:CLA
 Buf[3]=0xA4; // INF:INS
 Buf[4]=0x04; // INF:P1
 Buf[5]=0x00; // INF:P2
 Buf[6]=0x07; // INF:Le
    Buf[7]=0xD4; // DATA
    Buf[8]=0x10; // DATA
    Buf[9]=0x00; // DATA
    Buf[10]=0x00; // DATA
    Buf[11]=0x03; // DATA
    Buf[12]=0x00; // DATA
    Buf[13]=0x01; // DATA

    if(M500PiccExchangeBlock(Buf,16,Buf,&len,1,FWI)!=MI_OK) return(!MI_OK);

 //memcpy(Send_Buf, Buf, len);
    //Send_Serial((int)len);
    printf("Buf[len-4] :%x %d\n", Buf[len-4],len);
 return(MI_OK);

 if(Buf[len-4]==0x90) return(MI_OK);   ===> what mean???
 else return(!MI_OK);
}

 

 

Buf[len-4]==0x90  ==> what is the "0x90" mean?

Result debuging , Buf[len-4] is 0x00. So it is failed.

What is 0x90 mean?And when Buf[len-4] is 0x00, what is my card type(iso etc)?

Let me know my question~~

 

Thanks.

Outcomes