Hello All,
We have designed Low Power RFID based device where we are using MFRC630 Plus reader chip,with Mifare 1K classic card.
MFRC630WRITEREG(MFRC630REGCOMMAND, MFRC630CMDIDLE);
//mfrc630_AN1102_recommended_registers_no_transmitter(MFRC630PROTOISO14443A106MILLERMANCHESTER);
MFRC630FLUSHGIFO();
// Set register such that we sent 7 bits, set DataEn such that we can send data.
MFRC630WRITEREG(MFRC630REGTXDATANUM, 7 | MFRC630TXDATANUMDATAEN);
// disable the CRC registers.
MFRC630WRITEREG(MFRC630REGTXCRCPRESET, MFRC630RECOM14443ACRC | MFRC630CRCOFF);
MFRC630WRITEREG(MFRC630REGRXCRCCON, MFRC630RECOM14443ACRC | MFRC630CRCOFF);
MFRC630WRITEREG(MFRC630REGRXBITCTRL, 0); //Receiver control register
// ready the request.
uint8_t SENDREQ[] = {instruction};
// clear interrupts
MFRC630CLEARIRQ0();
MFRC630CLEARIRQ1();
// enable the global IRQ for Rx done and Errors.
MFRC630WRITEREG(MFRC630REGRQ0EN, MFRC630IRQ0ENRXIRQEN | MFRC630IRQ0ENERRIRQEN );
MFRC630WRITEREG(MFRC630REGIRQ1EN, MFRC630IRQ1ENTIMER0IRQEN ); // only trigger on timer for irq1
// configure a timeout timer.
uint8_t TIMERFORTIMEOUT = 0;
// Set timer to 221 kHz clock, start at the end of Tx.
mfrc630_timer_set_control(TIMERFORTIMEOUT, MFRC630_TCONTROLCLK211KHZ | MFRC630TCONTROLSTARTTXEND);
// Frame waiting time: FWT = (256 x 16/fc) x 2 FWI
// FWI defaults to four... so that would mean wait for a maximum of ~ 5ms
MFRC630TIMERSETRELOAD(TIMERFORTIMEOUT, 10000); // 1000 ticks of 5 usec is 5 ms.
MFRC630TIMERSETVALUE(TIMERFORTIMEOUT, 10000);
// Go into send, then straight after in receive.
MFRC630CMDTRANSCEIVE(send_req, 1);
// CommunicationUARTSend("Sending REQA\n",13);
// block until we are done
uint8_t IRQ1VALUE = 0;
while (!(IRQ1VALUE & (1 << TIMERFORTIMEOUT)))
{
IRQ1VALUE = mfrc630_irq1();
if (IRQ1VALUE & MFRC630IRQ1GLOBALIRQ)
{
// either ERR_IRQ or RX_IRQ
// stop polling irq1 and quit the timeout loop.
break;
}
}
// CommunicationUARTSend("\nAfter waiting for answer",25);
MFRC630CMDIDLE();
// if no Rx IRQ, or if there's an error somehow, return 0
uint8_t irq0 = MFRC630IRQ0();
if ((!(irq0 & MFRC630IRQ0RXIRQ)) || (irq0 & MFRC630_IRQ0_ERR_IRQ))
{
// sprintf((char *)PrintBuffer,"\nNo RX, irq1: %x irq0: %x ", irq1_value, irq0);
// CommunicationUARTSend(PrintBuffer, 26);
return 0;
}
uint8_t RXLEN = mfrc630_fifo_length();
uint16_t res;
// sprintf((char *)PrintBuffer,"\nrx_len: %d", RXLEN);
// CommunicationUARTSend(PrintBuffer, 11);
if (RXLEN == 2)
{
// ATQA should answer with 2 bytes.
MFRC630READFIFO((uint8_t*) &res, RXLEN);
// CommunicationUARTSend("ATQA answer: ",13);
MFRC630PRINTBLOCK((uint8_t*) &res, 2);
// CommunicationUARTSend("\n",1);
return res;
}
return 0;
}
After reading version register of the RFID Chip we are understand this is MFRC63002 chip as per data sheet, also we have read Mifare 1K classic card.
After trying authentication say after 2-3 min MFRC630 doesn't detect any card, we can say it gets stuck, hence need to restart.
we are not able to understand where we are going wrong please find below code.
Regards
Santosh P
Hi Santosh P
If the device gets stuck, I would suggest you dump the status register to check the reason.
Regards
Daniel