cancel
Showing results for 
Search instead for 
Did you mean: 

STSW-ST25RFAL002 v3.0.1 Memory Needs

raj-muniraju
Associate II

Hello!

We are using ST25R3916B in our new NFC-based access control product. We use NFC-A and T4 communication for Mifare Classic, Desfire cards, and Android NFC apps.

 

The STSW-ST25RFAL002 with the following configuration seems to be using around 8KB of additional RAM.  Is there any chance of reducing memory needs?

 

 

#define RFAL_FEATURE_LISTEN_MODE               true       /*!< Enable/Disable RFAL support for Listen Mode                               */
#define RFAL_FEATURE_WAKEUP_MODE               false       /*!< Enable/Disable RFAL support for the Wake-Up mode                          */
#define RFAL_FEATURE_LOWPOWER_MODE             false      /*!< Enable/Disable RFAL support for the Low Power mode                        */
#define RFAL_FEATURE_NFCA                      true       /*!< Enable/Disable RFAL support for NFC-A (ISO14443A)                         */
#define RFAL_FEATURE_NFCB                      false       /*!< Enable/Disable RFAL support for NFC-B (ISO14443B)                         */
#define RFAL_FEATURE_NFCF                      false       /*!< Enable/Disable RFAL support for NFC-F (FeliCa)                            */
#define RFAL_FEATURE_NFCV                      false       /*!< Enable/Disable RFAL support for NFC-V (ISO15693)                          */
#define RFAL_FEATURE_T1T                       false       /*!< Enable/Disable RFAL support for T1T (Topaz)                               */
#define RFAL_FEATURE_T2T                       false       /*!< Enable/Disable RFAL support for T2T                                       */
#define RFAL_FEATURE_T4T                       true       /*!< Enable/Disable RFAL support for T4T                                       */
#define RFAL_FEATURE_ST25TB                    false       /*!< Enable/Disable RFAL support for ST25TB                                    */
#define RFAL_FEATURE_ST25xV                    false       /*!< Enable/Disable RFAL support for ST25TV/ST25DV                             */
#define RFAL_FEATURE_DYNAMIC_ANALOG_CONFIG     false      /*!< Enable/Disable Analog Configs to be dynamically updated (RAM)             */
#define RFAL_FEATURE_DPO                       false      /*!< Enable/Disable RFAL Dynamic Power Output support                          */
#define RFAL_FEATURE_ISO_DEP                   true       /*!< Enable/Disable RFAL support for ISO-DEP (ISO14443-4)                      */
#define RFAL_FEATURE_ISO_DEP_POLL              true       /*!< Enable/Disable RFAL support for Poller mode (PCD) ISO-DEP (ISO14443-4)    */
#define RFAL_FEATURE_ISO_DEP_LISTEN            true       /*!< Enable/Disable RFAL support for Listen mode (PICC) ISO-DEP (ISO14443-4)   */
#define RFAL_FEATURE_NFC_DEP                   false       /*!< Enable/Disable RFAL support for NFC-DEP (NFCIP1/P2P)                      */

#define RFAL_FEATURE_ISO_DEP_IBLOCK_MAX_LEN    256U       /*!< ISO-DEP I-Block max length. Please use values as defined by rfalIsoDepFSx */
#define RFAL_FEATURE_NFC_DEP_BLOCK_MAX_LEN     254U       /*!< NFC-DEP Block/Payload length. Allowed values: 64, 128, 192, 254           */
#define RFAL_FEATURE_NFC_RF_BUF_LEN            258U       /*!< RF buffer length used by RFAL NFC layer                                   */

#define RFAL_FEATURE_ISO_DEP_APDU_MAX_LEN      512U       /*!< ISO-DEP APDU max length. Please use multiples of I-Block max length       */
#define RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN       512U       /*!< NFC-DEP PDU max length.                                                   */

 

 

 

7 REPLIES 7
Brian TIDAL
ST Employee

Hi,

the Card Emulation mode seems to be enabled (RFAL_FEATURE_LISTEN_MODE and RFAL_FEATURE_ISO_DEP_LISTEN). Does your application use the Card Emulation mode?

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 

Thanks for the quick response. I don't need the card emulation, I have saved a few hundred bytes by disabling those.

Is there an alternative to platformTimer functions? I started with 6 timers and am currently at 32, Somehow eventually it uses up all the timers and stops working. 

Below is my application, Please suggest to me if there is a better way to implement this.

My application at a high level:

  • Wait for the trigger to start NFC discovery scans
  • On trigger, 
    • Poweron and Initialize ST25R3916B -  rfalNfcInitializ
    • Start NFC discovery scan for ~1sec - rfalNfcDiscover
    • if anything is discovered communicate using T4 commands - rfalNfcIsDevActivated, rfalNfcDataExchangeStart
    • wait for 100msec
    • Stop discovery and deinitialize - rfalNfcDeactivate, rfalDeinitialize
    • repeat these steps 5 times
  • Power off ST25R3916B
  • Go back to sleep to wait for next trigger

My current implementation is based on  /ST25NFC_Embedded_Lib_ST25R3916(B)_1.7.0/Projects/STM32L476RG-Nucleo/Applications/Common/Src/demo_edta.c.

Brian TIDAL
ST Employee

Hi,

your initial post is related to memory needs. I would suggest to create a new post for your new question about timers. Make sure to describe your environment (which MCU is being used, bare metal application or OS based, ...) and to describe how the platformTimer has been implemented into your application.

Thanks

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 

Cool, I will create a separate ticket for timer optimization.

Is there any other memory optimization I can do?

Hi

This depends on what your application uses. E.g. does your application use the rfal_nfc.c layer for polling or directly use the API from rfal_nfca.c?

I would suggest to analyze the linker map to find the various contributors.

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 

I am using the following APIs. Do you have an example of T4 communication using low-level APIs?

  • Poweron and Initialize ST25R3916B -  rfalNfcInitializ
  • Start NFC discovery scan for ~1sec - rfalNfcDiscover
  • if anything is discovered communicate using T4 commands - rfalNfcIsDevActivated, rfalNfcDataExchangeStart
  • wait for 100msec
  • Stop discovery and deinitialize - rfalNfcDeactivate, rfalDeinitialize
Brian TIDAL
ST Employee

Hi,

I would suggest to keep using rfal_nfc.c layer. 

As NFC-DEP is not use for T4T communication, RFAL_FEATURE_NFC_DEP_PDU_MAX_LEN can be reduced drastically. Regarding ISO-DEP which is being used for T4T communication, the RFAL_FEATURE_ISO_DEP_APDU_MAX_LEN is set to 512. If your application use smaller APDU, you can reduce the value of RFAL_FEATURE_ISO_DEP_APDU_MAX_LEN.

Make sure to analyze the linker map to find the various contributors.

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.