cancel
Showing results for 
Search instead for 
Did you mean: 

st25r3916B NFC card emulation

SG3
Associate II

Hi,

I have been working with the st25r3916 in my reader. My idea is to use a mobile to communicate with the reader in card emulation mode. I have been using the demo code for st (ST25NFCEmbeddedLibSrc_ST25R3916(B)_1.6.0).

With IOS it is working fine, and with a samsung with android 14, works the 70% of the times, but I am trying with a Redmi with Android version 13, and it works the 20% of the times.

I have the discovery demo board of st25r3916, and both mobiles were working fine, but as the library used in this board was too old, I have purchased the demo board "X-nucle-nfc08A1" with the Nucleao board, to check the behaviour with your code and your library, and in this case, the IOS works 100% of the times, the samsung works 100% of the times, but the Redmi NEVER works.

Is there any solution to make the Redmi working?

Many thanks,

 

Sandra

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

so, the Redmi is entering in Card Emulation mode. As both devices support Reader mode and CE mode, you will face this kind of issue. I would suggest that your application has 2 different working modes i.e. to disable the Reader mode  and keep only CE mode on ST25R3916 when you plan to communicate with a phone.

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.

View solution in original post

9 REPLIES 9
Brian TIDAL
ST Employee

Hi,

can you try to enable the DEMO_CARD_EMULATION_ONLY compilation flag? If it is still failing, can you connect a logic analyzer on the SPI (CLK/MOSI/MISO/CS) + ST25R3916_IRQ, and send the trace with Samsung and a second trace with Redmi?

Which model is being used and which Android version?

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,

 

Thanks for the answer. Enabling the DEMO_CARD_EMULATION_ONLY compilation flag, it is working with that android 13 phone.

Why is this happening? Because as far as i have reasearch in the code it is just removing the reading of cards, what I also need in my reader.

So how can I have both modes, card emulation and card reading enabled??

Thank you very much!

 

Sandra

Hi,

smartphones can support both Reader mode and Card Emulation mode (in particular for payment). If the ST25R3916 is also configured as Reader and Card Emulation, you will face random behavior (i.e. sometime smartphone acting as reader and 3916 as CE and vice versa). Phones can also support active Peer to Peer mode.

I would suggest to first disable the Peer to Peer (just set the RFAL_FEATURE_NFC_DEP to false in the rfal_platform.h). Is this solving the issue?

Then disable unneeded technologies (for example if NFCF is not used in your application, just set RFAL_FEATURE_NFCF to false in rfal_platform.h). Keep only the needed technologies.

Then try to enlarge the discParam.totalDuration. 

Which Redmi model is being used? I can give a try on my side if I have this model.

 

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,


I would suggest to first disable the Peer to Peer (just set the RFAL_FEATURE_NFC_DEP to false in the rfal_platform.h). Is this solving the issue? I have tried, and it continues not working with the redmi

Then disable unneeded technologies (for example if NFCF is not used in your application, just set RFAL_FEATURE_NFCF to false in rfal_platform.h). Keep only the needed technologies. I have set to false:

RFAL_FEATURE_NFCF: but then the demo board all blue LEDs are blinking all the time and nothing is working...

RFAL_FEATURE_NFCB: the project has an error that i can not compile it

RFAL_FEATURE_NFCV and RFAL_FEATURE_ST25xV: not working with redmi

RFAL_FEATURE_T1T: not working with redmi

 

 Then try to enlarge the discParam.totalDuration. I have increased to 6000, and still not working with redmi

Which Redmi model is being used? I can give a try on my side if I have this model. Xiaomi Redmi Note 11. Also I have tried with a Redmi9 with Android version 12, and it sis behaving as the other xiaomi...

Many thanks,

 

Sandra

 

Hi,

when RFAL_FEATURE_NFCB is disabled, RFAL_FEATURE_ST25TB also needs to be set to false.

when RFAL_FEATURE_NFCF is disabled, demoIni needs to be modified to avoid adding RFAL_NFC_LISTEN_TECH_F in tech2Find (enabling listen mode in NFCF while the NFCF is disabled causes an initialisation error. LEDs are then blinking to indicate such an error). Fix: Line 311 of demo_polling, #if RFAL_SUPPORT_MODE_LISTEN_NFCF should be replaced by #if RFAL_SUPPORT_MODE_LISTEN_NFCF && RFAL_FEATURE_NFCF. This issue has been reported internally and will be fixed in next release.

What is displayed on the STLink serial console when the Redmi is being used? I believe the Redmi enters in CE mode (see my previous answer about smartphones supporting Reader mode and CE 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,

when RFAL_FEATURE_NFCB is disabled, RFAL_FEATURE_ST25TB also needs to be set to false. Tested, and redmi not working

when RFAL_FEATURE_NFCF is disabled, demoIni needs to be modified to avoid adding RFAL_NFC_LISTEN_TECH_F in tech2Find (enabling listen mode in NFCF while the NFCF is disabled causes an initialisation error. LEDs are then blinking to indicate such an error). Fix: Line 311 of demo_polling, #if RFAL_SUPPORT_MODE_LISTEN_NFCF should be replaced by #if RFAL_SUPPORT_MODE_LISTEN_NFCF && RFAL_FEATURE_NFCF. This issue has been reported internally and will be fixed in next release. Done, and the redmi not working

What is displayed on the STLink serial console when the Redmi is being used? I believe the Redmi enters in CE mode (see my previous answer about smartphones supporting Reader mode and CE mode).

NFCA Passive ISO-DEP device found. UID: 5F53544d

 Select NDEF Application: Fail Data:

 


Those are the result with the latest test..

Thanks,

 

Sandra

Hi,

so, the Redmi is entering in Card Emulation mode. As both devices support Reader mode and CE mode, you will face this kind of issue. I would suggest that your application has 2 different working modes i.e. to disable the Reader mode  and keep only CE mode on ST25R3916 when you plan to communicate with a phone.

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,

My main problem is that I need that the reader is fast and works with card or mobile at any moment, so I will not know in which moment it needs to work in reader mode or on CE mode....

How can I make it? I have tried next test in main, without success...

while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
    /* Run Demo Application */
	if (counter<255)
		counter++;
	else
		counter=0;
	if (counter%2)
		demoIni();
	else
		demoIniSan();
    demoCycle();

  }

demoIniSan(), is the card emulation mode initialization...

br,

Sandra

Hi Sandra,

I don't see how you can achieve both fast tag reading and interop in CE mode with various mobiles.

I am even surprised that you were successful with iPhones. I presume you had opened an app which forced the phone to be in polling mode?! 

iPhones also have a background polling which can discover certain NDEF content on tags. In my experience when iPhone is in background polling mode and it sees an external field (even without modulation) then it will block its own polling for >700ms.

I think your best chance is two different operating modes as indicated by Brian.

BR, Ulysses