cancel
Showing results for 
Search instead for 
Did you mean: 

reading/writing N213 tags using rfal

Gaston
Associate III

Hi,

How can I easily write/read N213 tags using rfal v2.2.0?

For the v1.3.2 version I used to call rfalISO14443ATransceiveFrame() to do it but I don't know how it's done in this latest stack version.

regards,

gaston

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi Gaston,

you can use the functions in rfal_t2t.c. Depending on your needs you can also use the NDEF layer used e.g. in STSW-ST25R-LIB or X-CUBE-NFC6 to read/write NDEF on formatted tags.

Regards, Ulysses

View solution in original post

3 REPLIES 3
Ulysses HERNIOSUS
ST Employee

Hi Gaston,

you can use the functions in rfal_t2t.c. Depending on your needs you can also use the NDEF layer used e.g. in STSW-ST25R-LIB or X-CUBE-NFC6 to read/write NDEF on formatted tags.

Regards, Ulysses

Thanks Ulysses, it was just what I wanted and the write / read functions work as expected.

Besides, I also have to implement a password authentication (read) access but I see in the library that it is only available for NFC-V (ISO15693) tag families. Would an implementation of a password protection be available for T2T?

regards,

gaston

Hi Ulysses,

Currently I see that there is no password authentication implementation in rfal_t2t. Therefore I have added my own function that works correctly and that I have no problem to share it.

/*******************************************************************************/
 ReturnCode rfalT2TPollerAuth( uint32_t pwd, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen )
 {
    ReturnCode      ret;
    rfalT2TAuthReq  req;
 
    if( (rxBuf == NULL) || (rcvLen == NULL) )
    {
        return ERR_PARAM;
    }
 
    req.code = (uint8_t)RFAL_T2T_CMD_PWD_AUTH;
    req.pwd[0] = pwd;
    req.pwd[1] = pwd>>8;
    req.pwd[2] = pwd>>16;
    req.pwd[3] = pwd>>24;
 
    /* Transceive Command */
    ret = rfalTransceiveBlockingTxRx( (uint8_t*)&req, sizeof(rfalT2TAuthReq), rxBuf, rxBufLen, rcvLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_FDT_POLL_READ_MAX );
 
    /* T2T 1.0 5.2.1.7 The Reader/Writer SHALL treat a NACK in response to a READ Command as a Protocol Error */
    if( (ret == ERR_INCOMPLETE_BYTE) && (*rcvLen == RFAL_T2T_ACK_NACK_LEN) && ((*rxBuf & RFAL_T2T_ACK_MASK) != RFAL_T2T_ACK) )
    {
        return ERR_PROTO;
    }
    return ret;
 }

You should call

rfalT2TPollerAuth(password, rfidRxBuf, 2, &rcvLen); 

and expect 2 bytes of PACK in rfidRxBuf

regards,

gaston