cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling RX parity processing with ST25R3916

n_t_f_d
Associate

Hello,

I am trying to implement the Mifare Classic protocol with ST25R3916 and RFAL.

For that CRC and parity bits processing need to be disabled, which ST25R3916 support, so I tried to experiment with disabling CRC and parity framing on a message sent by the tag to see how it is encoded.

I am having a hard time figuring out exactly what's the encoding, and the datasheet of ST25R3916 doesn't say exactly what's in the FIFO.

I set up X-CUBE-NFC6 with STM32CubeMX and simply modified the polling demo to send the command 6000 + CRC to the tag, which should respond with a 4-bytes nonce with standard ISO-14443-3A parity and no CRC.

This is the only part of the code I added, after selecting the ISO-14443-3A tag:

uint32_t flags =
        // CRC stuff
        RFAL_TXRX_FLAGS_CRC_TX_AUTO |
        RFAL_TXRX_FLAGS_CRC_RX_MANUAL |
        RFAL_TXRX_FLAGS_CRC_RX_KEEP |
        // parity bits
        RFAL_TXRX_FLAGS_PAR_RX_KEEP |
        RFAL_TXRX_FLAGS_PAR_TX_AUTO |
        // analog
        RFAL_TXRX_FLAGS_AGC_ON;
uint8_t tx_buf[8] = {0x60, 0x00}; // use key A on block 0
uint8_t rx_buf[32] = {0};
uint16_t rx_buf_rcvd_len = 0;
ReturnCode ret = rfalTransceiveBlockingTxRx(tx_buf, 2, rx_buf, 32, &rx_buf_rcvd_len, flags, rfalConvMsTo1fc(100U));
if (ret != RFAL_ERR_NONE && ret != RFAL_ERR_CRC) {
    platformLog("Error: %d\r\n", ret);
} else {
    platformLog("Received nonce: (%d) ", rx_buf_rcvd_len);
    for (int i = 0; i < 32; i++) {
        platformLog("%02X", rx_buf[i]);
    }
    platformLog("\r\n");
}

In parallel to this I am monitoring the communication between the ST25R3916 and the tag with a RFID debugging tool, so I know what the card is actually sending.

When the card sends 23 50 81 FD, what I read from the FIFO is 23 A0 06 EE 07. It is 36 bits as expected (only the last 4 bits of the last byte are actual data), and the first byte always matches, but the rest of it is a mystery.

I assumed what I read from the FIFO was byte1 + parity1 + byte2 + parity2 + byte3 + parity3 + byte4 + parity4 for a total of 36 bits, but it is not the case.

Still in this same example, if I add the parity bits to what the card actually sends I get:

00100011 0 01010000 1 10000001 1 11111101 0

But if I read what I got from the FIFO, I get:

00100011 1 01000000 0 00011011 1 01110011 1

Could someone shine some light on this?

Thank you

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi

the bit stream is the following (lowest bit of the lowest byte on the right

 0 11111101  1 10000001  1 01010000  0 00100011

 P      FD       P      81         P     50          P    23

Thus the byte stream is

0111 11101110 00000110 10100000 00100011                                                                             

  7         EE            06             A0            23

And the content of the FIFO is 23 A0 06 EE 07.

Rgds

BT   

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Brian TIDAL
ST Employee

Hi

the bit stream is the following (lowest bit of the lowest byte on the right

 0 11111101  1 10000001  1 01010000  0 00100011

 P      FD       P      81         P     50          P    23

Thus the byte stream is

0111 11101110 00000110 10100000 00100011                                                                             

  7         EE            06             A0            23

And the content of the FIFO is 23 A0 06 EE 07.

Rgds

BT   

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Amazing, thank you for the quick reply!