Page 1 of 1

CR038 - R/W RFID Programming Problem!!!

PostPosted: Fri Apr 05, 2013 10:17 pm
by khairul
Assalamulaikum (peace to all)... i have problem to read data from Mifare card.. I have develop the programming, currently i can Activate the Antenna and blink the LED on CR038 RFID R/W Module.. But i cannot access the data from Mifare Card (Card type, NUID and other parameter) although i apply the same concept to access data from the Mifare card.

Can anyone help me..

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Sun Apr 07, 2013 1:58 pm
by robosang
So us what have you done

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Tue Apr 09, 2013 1:48 pm
by khairul
Sorry for late reply, currently i have made coding to read NUID from the card. the problem is i cannot use the function to select card using NUID.
CODE: SELECT_ALL_CODE
void CR038_SELECT_CARD(void)
{   
        // 1) On Antenna
       //==========================================
   UART_SEND(0xAA);
   UART_SEND(0xBB);
   UART_SEND(0x06);
   UART_SEND(0x00);   
   UART_SEND(0x00);
   UART_SEND(0x00);   
   UART_SEND(0X0C);
   UART_SEND(0X01);
   UART_SEND(0X01);
   UART_SEND(0X0C);
   
   for(a=0;a<=9;a++)      
   {   
      reply[a] = UART_REC();
   }
       
       // 2) Card Type
       //==========================================
   UART_SEND(0xAA);
   UART_SEND(0xBB);
   UART_SEND(0x06);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x01);
   UART_SEND(0x02);
   UART_SEND(0x52);
   UART_SEND(0x51);
   
   for(a=0;a<=11;a++)      
   {   
      reply[a] = UART_REC();
   }

   // 3) Anti Collision
       //==========================================
        UART_SEND(0xAA);
   UART_SEND(0xBB);
   UART_SEND(0x05);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x02);
   UART_SEND(0x02);
   UART_SEND(0x00);
   
   for(a=0;a<=13;a++)      
   {   
      reply[a] = UART_REC();
   }

   // 4) Select Card
       //==========================================
   UART_SEND(0xAA);
   UART_SEND(0xBB);
   UART_SEND(0x09);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x00);
   UART_SEND(0x03);
   UART_SEND(0x02);
   UART_SEND(0x0E); // NUID[0] : LSB : 0x0E
   UART_SEND(0x8B); // NUID[1]       : 0x8B      
   UART_SEND(0xE4); // NUID[1]       : 0xE4
   UART_SEND(0x27); // NUID[1] : MSB : 0x27
   UART_SEND(0x47); //XOR or Checksum
   
   for(a=0;a<=10;a++)      
   {   
      reply[a] = UART_REC();
   }
}

//UART Function
//=================================================================

void UART_SEND(unsigned char data)   
{   
   while(PIR1bits.TXIF==0);            
   TXREG=data;         
}

unsigned char UART_REC(void)      //function to wait for a byte receive from uart
{   
   if(RCSTAbits.OERR == 1) // If OverRun Error Occure
   {
      RCSTAbits.CREN=0;
      RCSTAbits.CREN=1;
   }
   
   while(PIR1bits.RCIF==0); //wait for data to received
            
   return RCREG;   //return the received data
}

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Tue Apr 09, 2013 2:10 pm
by khairul
oh BTW i can read NUID from the card, my problem is i cannot use the NUID to select the card for future development such as Read or Write...

What i have done for Troubleshooting
================================
1) i have check the XOR

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Wed Apr 10, 2013 2:03 am
by khairul
Hai, sorry again, i have solve the problem i have before this. anyways thanks to everyone who view and try to solve it..

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Wed Apr 10, 2013 11:36 am
by robosang
Good to hear that. Mind to share the result and what is the root cause?

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Wed Apr 10, 2013 12:22 pm
by khairul
Ok... i try to post all

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Wed Apr 10, 2013 1:13 pm
by khairul
Assalamulaikum (Peace to All)..

Here are source code and schematic for my CR038 project...

Hardware Details
================
1) I use PIC18F2520 with MPLAB IDE v7.43 + MCC18 C Compiler
2) 16x2 LCD Display
3) 4 Push Button (I only use 3 out of 4)
4) 1 UART Port
5) ... Details circuit in the schematic

Programming Details
==================
Inside the attachment, there are library to support MAIN.c

Programming Troubleshooting
=========================
1) PROBLEM : when i send command from PIC to CR038 and try to display data from CR038 nothing display.
SOLUTION : double check data that you send through UART and please triple check the XOR or Checksum.

2) PROBLEM : CR038 does not response to cmd that you transmit from PIC.
SOLUTION : Please Activate the ANTENNA and after u WRITE or READ Disable it..
DO NOT place your card inside the plastic that cytron give. i do not know why but it will make the CR038 cannot read the Mifare Card

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Mon Apr 15, 2013 1:46 pm
by khairul
Hai all, i want to improve this project,
before this for Read operation i use a Push button. So i want to improve to auto read card within the range just like RFID : http://www.cytron.com.my/viewProduct.ph ... 232%20(New)

the problem is i don't have any idea how to improve it.. can anyone share something with me.

Re: CR038 - R/W RFID Programming Problem!!!

PostPosted: Wed Sep 11, 2013 2:21 pm
by hairizam
i want to use CR038 in my final project..can u explain about CR038 because i dont understant how its function and how to write to the card