Skip to main content
Explorer II
September 29, 2022
Solved

about rfalNfcvPollerWriteMultipleBlocks

  • September 29, 2022
  • 7 replies
  • 2062 views

We use Rfal library for ST53L1X application.

In demoNfcv(), the write and read is ok, when using rfalNfcvPollerWriteSingleBlock().

For testing multiple blocks writing performanace, we modified the program as code attached.

with rfalNfcvPollerWriteMultipleBlocks, no data were written to tag. There is no change in tag blocks. Coould you givie any hits for this issure?

best regards

Dai Sai

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

    Hi Dai Sai,

    read/write multiple blocks are optional commands in ISO15693. The tag you are using is coming from NXP (manufacturer ID 04). From what I see these tags are not supporting the Write Multiple Blocks command.

    An option would be using ST25DV/TV which are supporting this command.

    Best Regards, Ulysses

    7 replies

    Technical Moderator
    September 29, 2022

    Hi Dai Sai,

    not sure what ST53L1X should relate to?

    Then about rfalNfcvPollerWriteMultipleBlocks(): It depends on the tag you are writing. Which tag are you talking to? And which error is returned? Please also but a breakpoint into rfalNfcvParseError() and look at the byte it potentially gets.

    BR, Ulysses

    DSai.1Author
    Explorer II
    September 29, 2022

    Dear Ulysses

    thank you for your reply.

    I’m so sorry for giving a wrong name. We use ST25R3916 for ISO15693 tag. We use ToF sensor VL53L1X also.

    I will check the error tomorrow, according to your advise.

    best regards

    Dai Sai

    DSai.1Author
    Explorer II
    September 30, 2022

    Dear Ulysses

    I check the result in debug mode.

    When run

    ReturnCode rfalNfcvPollerWriteMultipleBlocks( uint8_t flags, const uint8_t* uid, uint8_t firstBlockNum, uint8_t numOfBlocks, uint8_t *txBuf, uint16_t txBufLen, uint8_t blockLen, const uint8_t* wrData, uint16_t wrDataLen )

    {

      ReturnCode     ret;

      uint16_t      rcvLen;

      uint16_t      reqLen;

      rfalNfcvGenericRes res;

      uint16_t      msgIt;

      /* Calculate required buffer length */

      reqLen = (uint16_t)((uid != NULL) ? (RFAL_NFCV_WR_MUL_REQ_HEADER_LEN + RFAL_NFCV_UID_LEN + wrDataLen) : (RFAL_NFCV_WR_MUL_REQ_HEADER_LEN + wrDataLen));

      

      if( (reqLen > txBufLen) || (blockLen > (uint8_t)RFAL_NFCV_MAX_BLOCK_LEN) || ((((uint16_t)numOfBlocks) * (uint16_t)blockLen) != wrDataLen) || (numOfBlocks == 0U) || (wrData == NULL) )

      {

        return ERR_PARAM;

      }

       

      msgIt = 0;

       

      /* Compute Request Command */

      txBuf[msgIt++] = (uint8_t)(flags & (~((uint32_t)RFAL_NFCV_REQ_FLAG_ADDRESS)));

      txBuf[msgIt++] = RFAL_NFCV_CMD_WRITE_MULTIPLE_BLOCKS;

       

      /* Check if Request is to be sent in Addressed mode. Select mode flag shall be set by user */

      if( uid != NULL )

      {

        txBuf[RFAL_NFCV_FLAG_POS] |= (uint8_t)RFAL_NFCV_REQ_FLAG_ADDRESS;

        ST_MEMCPY( &txBuf[msgIt], uid, RFAL_NFCV_UID_LEN );

        msgIt += (uint8_t)RFAL_NFCV_UID_LEN;

      }

       

      txBuf[msgIt++] = firstBlockNum;

      txBuf[msgIt++] = (numOfBlocks - 1U);

       

      if( wrDataLen > 0U )     /* MISRA 21.18 */

      {

        ST_MEMCPY( &txBuf[msgIt], wrData, wrDataLen );

        msgIt += wrDataLen;

      }

       

      /* Transceive Command */

      ret = rfalTransceiveBlockingTxRx( txBuf, msgIt, (uint8_t*)&res, sizeof(rfalNfcvGenericRes), &rcvLen, RFAL_TXRX_FLAGS_DEFAULT, RFAL_NFCV_FDT_MAX );

      if( ret != ERR_NONE )

      {

        return ret;

      }

       

      /* Check if the response minimum length has been received */

      if( rcvLen < (uint8_t)RFAL_NFCV_FLAG_LEN )

      {

        return ERR_PROTO;

      }

       

      /* Check if an error has been signalled */

      if( (res.RES_FLAG & (uint8_t)RFAL_NFCV_RES_FLAG_ERROR) != 0U )

      {

        return rfalNfcvParseError( *res.data );

      }

       

      return ERR_NONE;

    }

    the error happended at

    /* Check if an error has been signalled */

      if( (res.RES_FLAG & (uint8_t)RFAL_NFCV_RES_FLAG_ERROR) != 0U )

      {

        return rfalNfcvParseError( *res.data );

      }

    res.RES_FLAG = 0x01

    *res.data = 0x0f

    data = {0x0f, 0x68, 0xee, 0x00, 0x00..........0x00} there are 36 0x00

    Could you check it for me?

    best regards

    Dai Sai

    Technical Moderator
    September 30, 2022

    Hi Dai Sai,

    rfal_nfcv.h:

    /*! NFC-V Error code ISO15693 2000 7.4.2 */
    enum{
     RFAL_NFCV_ERROR_CMD_NOT_SUPPORTED = 0x01U, /*!< The command is not supported, code is not recognised */
     RFAL_NFCV_ERROR_CMD_NOT_RECOGNIZED = 0x02U, /*!< The command is not recognised, format error occurred */
     RFAL_NFCV_ERROR_OPTION_NOT_SUPPORTED = 0x03U, /*!< The option is not supported */
     RFAL_NFCV_ERROR_UNKNOWN = 0x0FU, /*!< Unknown error */
     RFAL_NFCV_ERROR_BLOCK_NOT_AVALIABLE = 0x10U, /*!< The specified block is not available */
     RFAL_NFCV_ERROR_BLOCK_ALREDY_LOCKED = 0x11U, /*!< The specified block is already locked */
     RFAL_NFCV_ERROR_BLOCK_LOCKED = 0x12U, /*!< The specified block is locked */
     RFAL_NFCV_ERROR_WRITE_FAILED = 0x13U, /*!< The specified block was not successfully programmed */
     RFAL_NFCV_ERROR_BLOCK_FAILED = 0x14U /*!< The specified block was not successfully locked */
    };

    It looks like the tag sees the command but for some unknown reason doesn't like it. Which tag are you trying to write here? If unsure then please at least post the UID which let's one deduce the manufacturer.

    Best Regards, Ulysses

    DSai.1Author
    Explorer II
    September 30, 2022

    Dear Ulysses

    thank you for your checking.

    The ISO15693 tag's UID is e0 04 01 00 01 d9 f8 38

    best regards

    Dai Sai

    Technical Moderator
    September 30, 2022

    Hi Dai Sai,

    read/write multiple blocks are optional commands in ISO15693. The tag you are using is coming from NXP (manufacturer ID 04). From what I see these tags are not supporting the Write Multiple Blocks command.

    An option would be using ST25DV/TV which are supporting this command.

    Best Regards, Ulysses

    DSai.1Author
    Explorer II
    September 30, 2022

    Dear Ulysses,

    Thank you very much for your information. It's great for us.

    I will switch to single block operation for our application.

    have a nice weekend!

    best regards

    Dai Sai