2025-02-22 10:12 PM - edited 2025-02-22 10:14 PM
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. */
2025-02-23 10:58 AM
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
2025-03-02 1:50 PM
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:
My current implementation is based on /ST25NFC_Embedded_Lib_ST25R3916(B)_1.7.0/Projects/STM32L476RG-Nucleo/Applications/Common/Src/demo_edta.c.
2025-03-02 11:48 PM
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
2025-03-03 7:47 AM
Hi @Brian TIDAL
Cool, I will create a separate ticket for timer optimization.
Is there any other memory optimization I can do?
2025-03-03 9:14 AM
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
2025-03-03 3:25 PM
Hi @Brian TIDAL
I am using the following APIs. Do you have an example of T4 communication using low-level APIs?
2025-03-04 1:37 AM
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