Skip to main content
Visitor II
October 24, 2018
Solved

When I read a single block which is 4 bytes long, why do i get 5 bytes back?

  • October 24, 2018
  • 1 reply
  • 923 views

I have got a program running that goes through the following steps

  • Nfcv Poller Initialisation
  • Nfcv Poller Check Presence
  • Nfcv Poller Collision Resolution
  • Nfv Poller Select
  • Nfv Poller Read Single Block

This is reading iCode tags using the ISO15693 protocol, but the response i get back from the Read Single Block is 5 bytes long, with what appears to be an additional 0x00 at the beginning. I know this because the Read Single Block routine takes several arguments, one being the rxbuffer, its size and the rcvLen - it is this last parameter that is getting set to 5.

To confirm my code was working correctly, I used the ST25R3911B Disco Demo board and the windows software to set values into block zero that were non zero values. For example

Value Set on PC: 0/0: FF 0/1:00 0/2:00 0/3:00

Value read on Raspberry Pi: 00FF000000

Value set on PC: : 0/0: 00 0/1:01 0/2:02 0/3:03

Value read on Raspberry Pi: 0000010203

So I am confident that I have an extra value at the beginning of the returned dataset. Is this a code bug?

    This topic has been closed for replies.
    Best answer by Grégoire Poulain

    Dear Matthew,

    The Read Single Block method will compute the Request and place the Response on the given rxBuf.

    The response is composed by:

    0690X000006CFuRQAW.png

    On the rxBuf you will receive the card's reply, expect: SOF, CRC and EOF.

    Therefore the first byte will always be the Response_Flag.

    Additionally, on the method's argument list it is mentioned that the Response_Flag will part of the response.

    * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)

    That is the reason you receive overall 5 bytes, where only 4 are Data.

    Kind regards

    GP

    1 reply

    ST Employee
    October 25, 2018

    Dear Matthew,

    The Read Single Block method will compute the Request and place the Response on the given rxBuf.

    The response is composed by:

    0690X000006CFuRQAW.png

    On the rxBuf you will receive the card's reply, expect: SOF, CRC and EOF.

    Therefore the first byte will always be the Response_Flag.

    Additionally, on the method's argument list it is mentioned that the Response_Flag will part of the response.

    * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)

    That is the reason you receive overall 5 bytes, where only 4 are Data.

    Kind regards

    GP