Skip to main content
_JJ_
Associate II
Question

WR with different field sessions for Tag-V (ISO15693) using ST25R3916 (RFAL v4.0.2)

In my application, for different operations I am turning off/on the RF field, it’s like need basis, my RF filed does not stay on all the time to conserve the energy/power.

With my current implementation sequence (which I have defined below), 99% of the time everything works fine, as in I can do tag discovery in one session, in another session for the discovered tag I can Read data, in one another session I can write data, and yet another session I can even lock a block using BSS as well. (In this context the session mean, turning on the field → do the thing → turn off the field).

As I mentioned everything works nicely 99% of the time, but for the 1% failures, which is very random, I have not found a way to reproduce this! Either discovery or read operation fails with Error Code 33 (aka RFAL_ERR_WRONG_STATE).

 

High Level Design

  • Initialization - one time only per power cycle of the device
    • rfalNfcInitialize
    • rfalNfcvPollerInitialize
  • Tag Discovery - per Tag-V operation
    • rfalFieldOnAndStartGT
    • rfalNfcvPollerCheckPresence
    • rfalNfcvPollerExtendedGetSystemInformation using RFAL_NFCV_REQ_FLAG_ADDRESS
    • rfalFieldOff
  • Read Memory - per Tag-V operation
    • rfalFieldOnAndStartGT
    • rfalNfcvPollerExtendedReadMultipleBlocks using RFAL_NFCV_REQ_FLAG_DEFAULT
    • rfalFieldOff
  • Write Memory - per Tag-V operation
    • rfalFieldOnAndStartGT
    • rfalNfcvPollerWriteMultipleBlocks using RFAL_NFCV_REQ_FLAG_DEFAULT
    • rfalFieldOff
  • Lock Block - per Tag-V operation
    • rfalFieldOnAndStartGT
    • rfalNfcvPollerWriteMultipleBlocks using RFAL_NFCV_REQ_FLAG_DEFAULT
    • rfalFieldOff

One thing to note, my application deals with a Tag-V at a time, so there is absolutely no chance of collision, also once a tag is discovered WR and Lock operation everything is done before another Tag-V is scanned, hence not using any collision related APIs from the RFAL lib.

 

So the first question is, with multiple RF turn ON/OFF sessions with the same Tag-V (UID), without RFAL_NFCV_REQ_FLAG_ADDRESS works for me most of the time, even without using  the rfalNfcvPollerSelect API for selecting the tag with help of it’s UID; is this approach alright?

I am trying to find a reference or a document which can guide me, which is the best way? I have already referred to UM2890 and demo codes from the library but most of them turn ON the field one time and after all the translation are done, turns off the field. Without any proper documentation I am unable to decide that this is the correct way, as in, in my case do I have keep the RF field on while I am interacting with an unique Tag-V (UID)?

What am I missing here which is causing out of the blue RFAL_ERR_WRONG_STATE error for me?

8 replies

_JJ_
_JJ_Author
Associate II

​@Ulysses HERNIOSUS, ​@Brian TIDAL I have read many of your answers on this topics, could anyone of you look into my problem and guide/help me with my problem?

BR, JJ
Ulysses HERNIOSUS
ST Technical Moderator

Hi,

your sequences as you describe them should not cause an RFAL_ERR_WRONG_STATE.

Typically this is error is triggered if software thinks the chip is in wrong state: Field not on for transmit, oscillator not running. Some RAM variables overwritten. I can think of multiple abnormal root causes for this:

  1. Rogue SPI writes to operation control register, clearing tx_en or en bit
  2. Power loss causing POR of the ST25R3916.
  3. Wrong readings on SPI, e.g. caused by noise on MISO line: RFAL thinks en/tx_en are cleared but really they are not.
  4. Your code not running strictly sequential as described.

NFC-V has three ways of addressing: Addressed - sending with every command frame the 8-bytes address of the tag. Selected: Send a select command with the tag’s address and subsequently send commands without the address but with the select flag. Only the previously selected tag will execute and answer the command. Or broadcast mode: Send without either flag: Every tag in range will execute the command and potentially answer.

 

BR, Ulysses

_JJ_
_JJ_Author
Associate II

 

Thanks ​@Ulysses HERNIOSUS for getting back to me.

 

One thing I forgot to mention in my question that the device communication happens over I2C.

 

I think I should first eliminate any sequence related issues (Point 4 in your response) before I jump start on the HW side debugging.

I have a couple of questions:

  1. The approach of turning on/off RF field on the need basis is fine for RFAL Lib and ST25R3916 for different operations as I have mentioned?
  2. Do I need to introduce any delay after either rfalFieldOnAndStartGT() or rfalFieldOff()?
  3. As my application deals with only one Tag-V at a time, would you say I should use  rfalNfcvPollerSelect() after every field on operation?

 

BR, JJ
Ulysses HERNIOSUS
ST Technical Moderator

Hello,

ad 1) Yes, turning on/off the field is normal operation also for RFAL. Typically I would expect the discovery and the tag operation (read, write, lock) being performed in one sequence with field on. If the tag operations are user triggered then it is also fine to turn off the field in between to save power. During power off the NFC-V tags will reset/lose its state, but with addressed mode everything should be fine.

ad 2) rfalFieldOnAndStartGT() takes care of waiting the guard time of 5ms to have the tag properly energized. For rfalFieldOff() I recommend to not immediately afterwards have rfalFieldOnAndStartGT() beause then the tag my only partly perform its RESET. Better to wait at least 5ms.

 

ad 3) It depends how many commands you perform after the rfalNfcSelect() If it is only one it does not bring advantages in terms of performance. If there are more commands then you will save 8bytes (equivalent to ~2.5ms @26kbps) on every command frame.

 

Regards, Ulysses

_JJ_
_JJ_Author
Associate II

Thank you ​@Ulysses HERNIOSUS for this insightful info…

 

I will make changes according to my app based on your suggestions.

This is what I will change in my logic:

  1. Majority operations will stay with independent RF field, but now I will use RFAL_NFCV_REQ_FLAG_ADDRESS rather than default, would you recommend combine this with RFAL_NFCV_REQ_FLAG_SELECT flag?
  2. I will introduce a delay after rfalFieldOff() call, just to avoid any timing issues with following rfalFieldOnAndStartGT() function call and let the Tag-V reset/lost its state.
  3. As you have explained, my operations are mostly singleton, so I can avoid rfalNfcSelect() for each operation just use the address mode.

 

As I mentioned, this is not an easily reproducible issue, it will take some time perform thorough testing, please bear with me until I come back.

 

PS: Last time, it took 1 week to reproduce the issue! Regardless of did this work or not I will post an update here as soon as I have one.

BR, JJ