cancel
Showing results for 
Search instead for 
Did you mean: 

Getting ERR_NOMEM when implementing custom "Fast Read Unlimited Blocks Command " ISO/IEC15693 command with ST25R3911B and MB89R118C Fujitsu Tag, to read 256 memory blocks/ 2048 bytes in one transaction.

SDesa.1
Associate II

Hi I am trying to implement a custom ISO/IEC 15693 command called "Fast Read Unlimited Blocks" command for the Fujitsu Tag MB89R118C (attached the datasheet). This command allows reading all 256 memory block or 2048 bytes on the Tag's memory in one transaction.

I have created a function `rfalMb89r118cPollerFastReadMultipleBlocksUnlimited` to implement the Fast Read Unlimited Block Command using the rfal library and the `rfalNfcvPollerTransceiveReq` function call. The implementation and use of `rfalMb89r118cPollerFastReadMultipleBlocksUnlimited` is as follows:

Implementation of `rfalMb89r118cPollerFastReadMultipleBlocksUnlimited`:

// Fast read multiple blocks unlimited

ReturnCode rfalMb89r118cPollerFastReadMultipleBlocksUnlimited(

    uint8_t flags, const uint8_t* uid, uint8_t firstBlockNum,

    uint8_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t* rcvLen)

{

    uint8_t data[(RFAL_NFCV_BLOCKNUM_LEN + RFAL_NFCV_BLOCKNUM_LEN)];

    uint8_t dataLen;

    dataLen = 0U;

    /* Compute Request Data */

    data[dataLen++] = firstBlockNum; /* Set first Block Number       */

    data[dataLen++] = numOfBlocks;   /* Set number of blocks to read */

    return rfalNfcvPollerTransceiveReq(

        RFAL_NFCV_CMD_FAST_READ_MULTIPLE_BLOCKS_UNLIMITED, flags,

        MB89R118C_IC_MFG_CODE, uid, data, dataLen, rxBuf, rxBufLen, rcvLen);

}

Use of `rfalMb89r118cPollerFastReadMultipleBlocksUnlimited`:

ST25R3911B_RF_TRANSCEIVER_STATUS nfcvFastReadMultipleMemoryBlocksUnlimited(

    uint8_t firstBlockNum, uint8_t numBlocks, uint8_t *data, uint16_t dataLen)

{

    uint8_t readBuffer[2816] = {0};

    uint16_t readBufferLen = sizeof(readBuffer) / sizeof(readBuffer[0]);

    ReturnCode transactionStatus;

    uint8_t flags = RFAL_NFCV_REQ_FLAG_DEFAULT;

    uint16_t recvLen = 0;

    transactionStatus = rfalMb89r118cPollerFastReadMultipleBlocksUnlimited(

        flags, m_nfcv_cards.UID, firstBlockNum, numBlocks, readBuffer,

        readBufferLen, &recvLen);

    if (transactionStatus == (ReturnCode)ERR_NONE) {

        memcpy(data, &readBuffer[1], dataLen);

        g_mb89r118TagData.tagDataReady = true;

        return kSt25r3911b_rf_status_no_error;

    }

    return kSt25r3911b_rf_status_memory_read_error;

}

Call to `nfcvFastReadMultipleMemoryBlocksUnlimited`:

transactionStatus = nfcvFastReadMultipleMemoryBlocksUnlimited(0, 255, g_mb89r118TagData.tagDataBytes, unlimitedReadDataLen);

transactionStatus for `nfcvFastReadMultipleMemoryBlocksUnlimited` is ERR_NOMEM.

QUESTION:

What size read buffer should be supplied to `rfalNfcvPollerTransceiveReq` in order to successfully read 2048 bytes in a single Fast Read Multiple Blocks unlimited command?

I am currently passing it a read buffer/ receive buffer of size 2816 with the calculation:

// Read Buffer size calculation for Read Unlimited RFID commands:

// (1 byte Response flags + 8 bytes (per memory block) + 2 bytes CRC)*256

// mem blocks

Is this correct?

PS: I have been able to successfully implement Fast Read Single Block and fast Read Multiple Blocks (read 2 blocks at a time) command using `rfalNfcvPollerTransceiveReq`

0693W000007Z2HWQA0.png

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi SDesa.1,

our RFAL currently limits the frames to ~255 bytes of NFCV frames. Please see the codingBuffer inside rfal_rfst25r3911.c for details. Technically the ST25R3911B does not limit received bytes. But please beware that software is doing the Manchester decoding so the buffer needs to be doubled plus a bit. So you can either enlarge the codingBuffer or see if you decode the received bytes on the fly.

Regards, Ulysses

View solution in original post

1 REPLY 1
Ulysses HERNIOSUS
ST Employee

Hi SDesa.1,

our RFAL currently limits the frames to ~255 bytes of NFCV frames. Please see the codingBuffer inside rfal_rfst25r3911.c for details. Technically the ST25R3911B does not limit received bytes. But please beware that software is doing the Manchester decoding so the buffer needs to be doubled plus a bit. So you can either enlarge the codingBuffer or see if you decode the received bytes on the fly.

Regards, Ulysses