Skip to main content
Visitor II
February 26, 2021
Solved

Problem with detection NFC-V tags on ST25R3916 (X-NUXLEO-NFC06A1 board)

  • February 26, 2021
  • 12 replies
  • 3798 views

In project based on exampleRfalPoller.c from library ST25NFC_Embedded_Lib_ST25R3916 and X-NUXLEO-NFC06A1 board I have problem with detection NFC-V tags.

After

 rfalNfcvPollerInitialize();                                        /* Initialize RFAL for NFC-V */

 rfalFieldOnAndStartGT();                                       /* As field is already On only starts GT timer */

 err = rfalNfcvPollerCheckPresence( &invRes );                                    /* Poll for NFC-V devices */

I always get err=4 (ERR_TIMEOUT)

Error is detected in file rfal_rfst25r3916.c, line 2190:

case RFAL_TXRX_STATE_RX_WAIT_RXS:

           irqs = st25r3916GetInterrupt( (ST25R3916_IRQ_MASK_RXS | ST25R3916_IRQ_MASK_NRE | ST25R3916_IRQ_MASK_EOF) );

           if( irqs == ST25R3916_IRQ_MASK_NONE )

           {

               break; /* No interrupt to process */

           }

           /* Only raise Timeout if NRE is detected with no Rx Start (NRT EMV mode) */

           if( ((irqs & ST25R3916_IRQ_MASK_NRE) != 0U) && ((irqs & ST25R3916_IRQ_MASK_RXS) == 0U) )

           {

//here this error is set               

               gRFAL.TxRx.status = ERR_TIMEOUT;

               gRFAL.TxRx.state = RFAL_TXRX_STATE_RX_FAIL;

               break;

           }

Tags NFC-A are detected correctly, so communication with ST25R3916 should be OK.

What can I do, to detect this tags correctly?

Sorry for may English - it's not my native language :)

    This topic has been closed for replies.
    Best answer by PHein.2

    Finally found the cause of the problem:

    In rfal_iso15693_2.c compiler didn't initialize stream_config structure. I added few lines, and now NFC-V tags are recognizes correctly.

    ReturnCode iso15693PhyConfigure(const iso15693PhyConfig_t* config, const struct iso15693StreamConfig ** needed_stream_config )
    {
     static struct iso15693StreamConfig stream_config = { /* MISRA 8.9 */
     .useBPSK = 0, /* 0: subcarrier, 1:BPSK */
     .din = 5, /* 2^5*fc = 423750 Hz: divider for the in subcarrier frequency */
     .dout = 7, /*!< 2^7*fc = 105937 : divider for the in subcarrier frequency */
     .report_period_length = 3, /*!< 8=2^3 the length of the reporting period */
     };
     
    /* added lines: */
     stream_config.useBPSK = 0;
     stream_config.din = 5;
     stream_config.dout = 7;
     stream_config.report_period_length = 3;
     
     /* make a copy of the configuration */
     ST_MEMCPY( (uint8_t*)&iso15693PhyConfig, (const uint8_t*)config, sizeof(iso15693PhyConfig_t));
     
     if ( config->speedMode <= 3U)
     { /* If valid speed mode adjust report period accordingly */
     stream_config.report_period_length = (3U - (uint8_t)config->speedMode);
     }
     else
     { /* If invalid default to normal (high) speed */
     stream_config.report_period_length = 3;
     }
     
     *needed_stream_config = &stream_config;
     
     return ERR_NONE;
    }

    Now I have to check in compiler manual why this behavior happen, and check if there are other places in code which can be affected by this problem.

    Thank you for your help and commitment!

    Regards,

    Piotr

    12 replies

    Technical Moderator
    February 26, 2021

    Hi,

    can you give details about the NFC-V tag being used (manufacturer and model)? Can you also try to read this tag on an NFC Android phone in order to check that this tag has not been damaged?

    The ST25 embedded NFC library comes with a polling demo in Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC06A1\polling. Can you try to read this tag with this application?

    Rgds

    BT

    PHein.2Author
    Visitor II
    March 1, 2021

    Tags: ST25TV delivered with ST2R3916 Discovery Kit.

    With this Kit (software ST25R3916 v1.1.0B) tags are read correctly (NFC-V E0:02:23:00).

    I can read this tags also with NFC Android phone: ID: E0:02:23:00:57:13:C8:8B.

    Where can I find this demo application? What should i download?

    Regards,

    Piotr

    Technical Moderator
    March 1, 2021

    Hi,

    The polling demo comes with the ST25 embedded NFC library (in folder  Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC06A1\polling) or with the X-CUBE-NFC6. The polling demo runs on X-NUCLEO-NFC06 plugged on either a NUCLEO-L053R8 or a NUCLEO-L476RG.

    Rgds

    BT

    PHein.2Author
    Visitor II
    March 4, 2021

    Unfortunately, still no success - NFC-A tags are detected correctly and NFC-V not detected at all.

    Technical Moderator
    March 4, 2021

    Hi,

    do you mean that you have compiled the polling demo from the ST25 embedded NFC library with no modification and downloaded the binary and that you cannot read ST25TV tags?

    Can you share details about your HW setup:

    • X-NUXLEO-NFC06A1
    • MCU : nucleo board? which one?

    What is the value of RFAL_FEATURE_NFCV in your platform.h and what is the value of discParam.techs2Find in demoIni()?

    Rgds

    BT

    PHein.2Author
    Visitor II
    March 5, 2021

    No, It's no so easy. I have my own board based on PIC32MX connected with X-NuCLEO-NFC06A1. For communication is used I2C bus.

    #define RFAL_FEATURE_NFCV true /*!< Enable/Disable RFAL support for NFC-V (ISO15693) */
     
    discParam.techs2Find = ( RFAL_NFC_POLL_TECH_A | RFAL_NFC_POLL_TECH_B | FAL_NFC_POLL_TECH_F | RFAL_NFC_POLL_TECH_V | RFAL_NFC_POLL_TECH_ST25TB );
    discParam.techs2Find |= RFAL_NFC_POLL_TECH_AP2P;
    discParam.techs2Find |= RFAL_NFC_LISTEN_TECH_A;
    discParam.techs2Find |= RFAL_NFC_LISTEN_TECH_F;

    Before using demo_ini() function there should be defined ST25R3916. Where is this defined? A added this definition to platform.h, but maybe there should be defined something esle?

    The changes I have made in project files:

    platform.h:

     - added #define ST25R3916

     - added #define RFAL_USE_I2C

     - removed all LED, BUTTON and GPIO definitions

     - adjusted I2C bus definitions

     - adjusted platformDelay and platformGetSysTick definitions

    st25r3916_com.c - adjusted to use I2C bus from PIC32

    st25r3916_irq.c - adjusted to use IRQ signal from PIC32

    main.c is renamed and

     - removed HAL_Init(), SystemClock_Config(), Led_Init();

     - all initializations: interrupts, I2C bus and tickTimer are made in my main() function

     - main() function is renamed and called from my main() function

    Reading NFC-A tags works properly, so communication works OK.

    Do You have any step by step description how ST25R3916 registers should be set to obtain communication with NFC-V tags?

    Technical Moderator
    March 5, 2021

    Hi Piotr,

    Also X-CUBE-NFC6 supports I2C, please see the user manual for details. The steps you describe above sound right. You could for your cross-reference try this I2C on NUCLEO-L476 + X-NUCLEO-NFC06.

    If NFC-A is working I don't see a reason why NFC-V is not working. It could be an issue which only appears when doing larger I2C transfers in your driver or something. I think you will need to look into the I2C stream. If you share logic analyzer traces (SDA,SCL + IRQ) we could have a look here.

    Ulysses

    Visitor II
    March 8, 2021

    I also have a similar problem, I use the spi version, with a custom board based on stm32wb55, I can find nfca, but nfcv are not found.

    the same code works on a NUCLEO-WB55 + X-NUCLEO-NFC06.

    are there any specific registry values i can try to change?

    Technical Moderator
    March 8, 2021

    Hi pagano.paganino,

    No educated guesses from our side. You could check blindly some things: Check rfalAnalogConfigInitialize() is called in your code, check the protection macros in platform.h which should prevent concurrent access to SPI driver from ISR and main level - maybe you changed the INT pin connection and the macro is not ensuring mutual access anymore.

    Otherwise please provide logic analyzer traces for inspecting what is happening.

    Regards, Ulysses

    PHein.2Author
    Visitor II
    March 10, 2021

    Hello, thanks for Your help, but there must be something else.

    I2C communication is OK, I can read FIFO, and its content is exactly as saved before.

    Wave on antenna coil looks like manchester coding, and is inconsistent with the ISO/IEC 15693-2 standard (data coding mode 1 out of 4).

    In rfal_rfst25r3916.c there are commands:

    /* Set Analog configurations for this bit rate */ 
     
    rfalSetAnalogConfig( (RFAL_ANALOG_CONFIG_TECH_CHIP | RFAL_ANALOG_CONFIG_CHIP_POLL_COMMON) );
     
    rfalSetAnalogConfig( (rfalAnalogConfigId)(RFAL_ANALOG_CONFIG_POLL | RFAL_ANALOG_CONFIG_TECH_NFCV | rfalConvBR2ACBR(gRFAL.txBR) | RFAL_ANALOG_CONFIG_TX ) );
     
    rfalSetAnalogConfig( (rfalAnalogConfigId)(RFAL_ANALOG_CONFIG_POLL | RFAL_ANALOG_CONFIG_TECH_NFCV | rfalConvBR2ACBR(gRFAL.rxBR) | RFAL_ANALOG_CONFIG_RX ) );

    where rfalConvBR2ACBR(gRFAL.txBR) and rfalConvBR2ACBR(gRFAL.rxBR) = RFAL_ANALOG_CONFIG_BITRATE_1OF4

    but in rfalAnalogConfigCustomSettings[] (analogConfigTbl_NFC06A1.h) there are no records with these identifiers (10C1 and 10C2). Maybe this is a problem?

    Technical Moderator
    March 10, 2021

    Hi Piotr,

    if it is something systematic in the software as you are suggesting then it should happen both for your PIC32 based sw and our STM32L4 based software.

    IMO we are looking into issues caused by porting. One of:

    • Issue caused by transferring bigger I2C frame sizes (NFC-V (with 3911/16) has much longer frames than NFC-A).
    • ISR implemenation
    • Interrupt locking, e.g. platform[Un]ProtectST25RIrqStatus() / platform[Un]ProtectST25RComm, etc.
    • ...

    Sometimes not all analog config identifiers are use / filled with register settings.

    Regards, Ulysses

    PHein.2AuthorAnswer
    Visitor II
    March 11, 2021

    Finally found the cause of the problem:

    In rfal_iso15693_2.c compiler didn't initialize stream_config structure. I added few lines, and now NFC-V tags are recognizes correctly.

    ReturnCode iso15693PhyConfigure(const iso15693PhyConfig_t* config, const struct iso15693StreamConfig ** needed_stream_config )
    {
     static struct iso15693StreamConfig stream_config = { /* MISRA 8.9 */
     .useBPSK = 0, /* 0: subcarrier, 1:BPSK */
     .din = 5, /* 2^5*fc = 423750 Hz: divider for the in subcarrier frequency */
     .dout = 7, /*!< 2^7*fc = 105937 : divider for the in subcarrier frequency */
     .report_period_length = 3, /*!< 8=2^3 the length of the reporting period */
     };
     
    /* added lines: */
     stream_config.useBPSK = 0;
     stream_config.din = 5;
     stream_config.dout = 7;
     stream_config.report_period_length = 3;
     
     /* make a copy of the configuration */
     ST_MEMCPY( (uint8_t*)&iso15693PhyConfig, (const uint8_t*)config, sizeof(iso15693PhyConfig_t));
     
     if ( config->speedMode <= 3U)
     { /* If valid speed mode adjust report period accordingly */
     stream_config.report_period_length = (3U - (uint8_t)config->speedMode);
     }
     else
     { /* If invalid default to normal (high) speed */
     stream_config.report_period_length = 3;
     }
     
     *needed_stream_config = &stream_config;
     
     return ERR_NONE;
    }

    Now I have to check in compiler manual why this behavior happen, and check if there are other places in code which can be affected by this problem.

    Thank you for your help and commitment!

    Regards,

    Piotr

    Technical Moderator
    March 11, 2021

    Hi Piotr,

    which compiler do you use? and which version?

    Rgds

    BT