Skip to main content
Visitor II
May 28, 2020
Solved

Is the X-CUBE-NFC3 library what I should be using?

  • May 28, 2020
  • 23 replies
  • 4149 views

Hello,

I am currently working on a project with the CR95HF chip. The chip has to be controlled over UART (by a STM32L4S7ZITx) and I would like a library which provides basic functions, such as being able to read a presented tag's UID and be able to read from and write to the presented tag.

Does the X-CUBE-NFC3 library provide this functionality?

If so, how exactly do I integrate it into my existing STM32CubeIDE project? I am aware it cannot be added through STM32CubeMx so of the whole download provided at https://www.st.com/en/embedded-software/x-cube-nfc3.html#overview what part needs integrated into my project to get the functionality described above and how do I do this?

Thanks!

Amy

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    • in your project, replace st25r95_com_spi.c by st25r95_com_uart.c (this file is located in STM32CubeExpansion_NFC3_V2.1.0\Drivers\BSP\Components\ST25R95-
    • add #define ST25R95_INTERFACE_UART  true in GLOBAL DEFINES section of platform.h
    • initialize the UART in main.c and stm32f1xx_hal_msp.c, make sure to have the UART interrup being enabled
    • populate HAL_UART_TxCpltCallback, HAL_UART_RxCpltCallback and HAL_UART_ErrorCallback to call st25r95UartTxCpltCallback (resp. st25r95UartRxCpltCallback, st25r95UartErrorCallback). See code below or attached files.
    • add #include "st25r95_com.h" in main.c
    • make sure to have SSI_0 selecting UART communication mode in you initialization
    • Make sure to power cycle the X-NUCLEO-NFC03A1 the first time after you have donwloaded the FW with UART support (otherwise SPI interface will still be selected...)

    /* USER CODE BEGIN 4 */
     
    void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
    {
     if (huart->Instance == USART1)
     {
     st25r95UartTxCpltCallback();
     }
    }
     
    void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
    {
     if (huart->Instance == USART1)
     {
     st25r95UartRxCpltCallback();
     }
    }
     
    void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
    {
     if (huart->Instance == USART1)
     {
     st25r95UartErrorCallback();
     }
    }
     
    /* USER CODE END 4 */

    Rgds

    BT

    23 replies

    Technical Moderator
    June 17, 2020

    Hi Amy

    both ST25TA and ST25TV perfectly work with our ST25R95/CR95HF + X-CUBE-NFC3.

    For basic read/write, I would personally use the ST25TV.

    For you question regarding the tag ( Inlay+IC), I'll check internally.

    Rgds

    BT

    ADoug.1Author
    Visitor II
    June 18, 2020

    Hi Bruno,

    Perfect, thank you and thank you for checking internally about available tags, etc.

    Does the X-CUBE-NFC3 library come with any functions relating to putting the CR95HF into IDLE mode to be woken by tag detection? My hope is to have the chip in idle most the time and just have it wake when it senses an RFID tag. Therefore the ability to put it into this mode and have a function called when it does wake would be ideal but I can't see how this would be done.

    Thanks.

    Amy

    Technical Moderator
    June 18, 2020

    Hi Amy,

    Tag Detection feature is supported in the X-CUBE-NFC3. This feature is available in the polling demo (demo.c) : when toggling the user button of the Nucleo board (blue button) the ST25R95/CR95HF enters or exits the tag detection mode. Once in tag detection mode, the device goes to polling when a tag is detected in the operating volume, reads the UID and returns in tag detection mode when the tag is removed. Tag detection feature is automatically managed as part of our RFAL High Layer interface in rfal_nfc.c: when the wakeupEnabled field of rfalNfcDiscoverParam structure is set to true, rfalNfcDiscover() will automatically enters in tag detection mode

    Note: The tag detection feature requires calibration. This calibration is performed automatically at startup (make sure not to have a tag close to the antenna during the calibration).

    Rgds

    BT