cancel
Showing results for 
Search instead for 
Did you mean: 

Reporting 2 bugs on the X-CUBE-NFC5 rfalST25xVPollerWriteMessage API

Hi,

I would like to report 2 possible bugs on the rfalST25xVPollerWriteMessage implementation:

  1. The msgLen parameter must be "number of Data bytes minus 1", as a direct translation from the "Write message" command, but msgLen == 0 is not accepted as valid (rfal_st25xv.c line 205), failing to write 1 byte-long messages, which according to the ST25DV datasheet should be OK.
  2. The required TX buffer len (calculated on line 202, and checked on line 205), considers 2 bytes for the msgLen parameter, but this parameter is only 1 byte long, preventing from using buffers that are the exact (and correct) number of bytes long.

Best Regards

Gustavo

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

updated versions of the RFAL are available either in  the ST25 Embedded NFC library with several new demos or as a standalone version in RFAL for ST25R3911B. I would recommend the ST25 Embedded NFC library as it comes with demos.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Brian TIDAL
ST Employee

Hi,

which version of RFAL do you use (see #define RFAL_VERSION  in rfal_rf.h)?

Issue #1 has been corrected and the fix is provided in latest RFAL versions. The updated code in line 205 is the following:

/* Check for valid parameters */
    if( (txBuf == NULL) || (msgData == NULL) || (txBufLen < msgIt) )
    {
        return ERR_PARAM;
    }

Regarding the second issue you reported, here is the format of the Write Message:

 0693W00000DmPtJQAV.jpgThus, the size of the buffer is the sum of:

  • sizeof(flags): 1 byte
  • sizeof(cmd): 1 byte
  • sizeof(ICMfgCode): 1 byte
  • [sizeof(UID: 8 bytes] optional
  • sizeof(MSGLen): 1 byte
  • MSGLen + 1

Therefore , if I am not wrong, line 202 is correct:

/* Calculate required Tx buf length:                    Mfg Code               UID                      MSGLen  MSGLen+1 */
    msgIt = (uint16_t)( msgLen + sizeof(flags) + sizeof(cmd) + 1U  + ((uid != NULL) ? RFAL_NFCV_UID_LEN : 0U) + 1U + 1U  );

Note: the MSGLen parameter has been clarified in the comments:

/* Note:  MSGlength parameter of the command is the number of Data bytes minus - 1 (00 for 1 byte of data, FFh for 256 bytes of data) */

One additional information, the ST25 Embedded NFC library provides a ST25 fast transfer mode embedded library. See Application Note AN5512 and related ST25NFC_Embedded_Lib_ST25R3916\Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC06A1\FTM demo.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @Brian TIDAL_O​ , thanks for the fast reply!

#1 I am using v2.0.10, just checked and this is the latest one available on https://www.st.com/en/embedded-software/x-cube-nfc5.html

Where can I find this updated version of the NFC5 RFAL?

#2 You are right, the last +1 is the correct offset for msgLen when considering its value is "number of Data bytes minus 1", my bad!

#3 Didnt know about this lib, I will take a look, thanks!

Brian TIDAL
ST Employee

Hi,

updated versions of the RFAL are available either in  the ST25 Embedded NFC library with several new demos or as a standalone version in RFAL for ST25R3911B. I would recommend the ST25 Embedded NFC library as it comes with demos.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.