Skip to main content
Graduate
December 23, 2020
Solved

reading/writing N213 tags using rfal

  • December 23, 2020
  • 1 reply
  • 772 views

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

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    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

    1 reply

    Technical Moderator
    December 23, 2020

    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

    GastonAuthor
    Graduate
    December 24, 2020

    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

    GastonAuthor
    Graduate
    December 29, 2020

    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