cancel
Showing results for 
Search instead for 
Did you mean: 

Mifare Classic reading with st25r3916

SG3
Associate II

Hi,

I am implementing the st25r3916 firmware to be used in my reader. I have taken the code of "X-NUCLEO NFC06A1".

To make the authentication, I am able to send the command 0x60 + block number; I receive the answer and I send the next message with the key and I receive an answer from the card with length 4 bytes, but I have the status of the reader  "RFAL_ERR_PAR". But when I check the received 4 bytes, they are the right ones. I am using the flags:RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_NFCIP1_OFF |RFAL_TXRX_FLAGS_AGC_ON|RFAL_TXRX_FLAGS_PAR_RX_REMV|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL

In order to continue with the reading, I was ommiting this error, and I am sending the command 0x30 to read, with the encryption (I know this part is well done due I have it already running in the st25r3911), in this case I am using next flags:

RFAL_TXRX_FLAGS_CRC_TX_MANUAL | RFAL_TXRX_FLAGS_CRC_RX_KEEP | RFAL_TXRX_FLAGS_NFCIP1_OFF | RFAL_TXRX_FLAGS_AGC_ON | RFAL_TXRX_FLAGS_PAR_RX_KEEP | RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL

but I do not receive any answer from the card. In this case I need to send 36 bits, due the parity ones, and I do not know if I need to change something to be able to send them, or if maybe the error cames from the previous parity error.

thanks,

 

Sandra

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
SG3
Associate II

I have been making some more tests changing the flags after sending the 0x60 0x01 (authenticate block 1) and after receive the first answer from the card, I have tried next options:

- RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_NFCIP1_OFF |RFAL_TXRX_FLAGS_AGC_ON|RFAL_TXRX_FLAGS_PAR_RX_KEEP|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL Error I receive is 40, and the lenght is 5 bytes

- RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_CRC_RX_REMV|RFAL_TXRX_FLAGS_NFCIP1_OFF |RFAL_TXRX_FLAGS_AGC_ON|RFAL_TXRX_FLAGS_PAR_RX_KEEP|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL Error I receive is 40, and the lenght is 3 bytes (I can imagine that this is because it is removing the 2 bytes of CRC)

 

-RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_NFCIP1_OFF |RFAL_TXRX_FLAGS_AGC_ON|RFAL_TXRX_FLAGS_PAR_RX_REMV|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL Error I receive is 27 (parity) anf the length is 4 bytes which after doing the calculations are the right ones.

Thanks,

 

Sandra

Hi Sandra,

 

I think the first variant is about right one but you need to use non-blocking variant of the interface which offers a bit oriented interface (rfalStartTransceive). The returned error means incomplete byte as 9 bits per byte are being received. Please also see the discussion in e.g. https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/nfc0541-read-mifare-classic-1k/m-p/255197.

 

BR, Ulysses

Hi Ulysses,

I have read the discussion you have sent me several times, even before asking you. And I have not find any clue.

What I can not understand is the follow:

To make authentication:

1st transaction reader to card: 0x60+block with parity and CRC  ->ok

Answer card to reader must be: 4 Bytes with parity and NO CRC  ->ok

 

2nd transaction reader to card: 8 bytes with NO parity and NO CRC ->ok

**Answer card to reader must be: 4 Bytes with NO parity and NO CRC ->NOK

**How can be that this answer when I put those flags (RFAL_TXRX_FLAGS_CRC_TX_MANUAL|RFAL_TXRX_FLAGS_CRC_RX_KEEP|RFAL_TXRX_FLAGS_NFCIP1_OFF |RFAL_TXRX_FLAGS_AGC_ON|RFAL_TXRX_FLAGS_PAR_RX_KEEP|RFAL_TXRX_FLAGS_PAR_TX_NONE|RFAL_TXRX_FLAGS_CRC_RX_MANUAL) I receive 5 bytes from the card? Is the firmware somehow adding the parity byte?

What do you mean with non-blocking variant of the interface which offers a bit oriented interface (rfalStartTransceive)?Thanks,

Sandra

 

Hello Sandra,

maybe this discussion helps you a bit more:

https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/nfc0541-read-mifare-classic-1k/m-p/255197

BR, Ulysses

SG3
Associate II

After reading dozen of times the thread, finally I arrived to the point that the problem was that I was trying to send 36 bits, but the code was converting to 5 bytes, and of course the card was not able to answer due it was not understanding the command.

Thanks!!