2021-04-01 01:42 AM
I Use STM32CubeExpansion_NFC6_V1.1.0 for emulate card with NUCLEO-L053R8 and X-NUCLEO-NFC06A1.
I Try NDEF URI card emulation with sucess.
I don't find a example code for NDEF Text emulation card.
Does anyone have a example code for NDEF Text Emulation card ?
Best Regards.
Mickaël
Solved! Go to Solution.
2021-04-01 05:56 AM
Hello Mickaël,
The card Emulation demo emulates a T4T tag with a CC file and an NDEF file. In STM32CubeExpansion_NFC6_V1.1.0, the NDEF file has an hardcoded NDEF URI in ndef_uri bytes array in demo_ce.c file. it can be easily modified to have a TEXT record instead of a URI record, for example:
static const uint8_t ndef_uri[] = {
0x00, 0x1E, /* NDEF length */
0xD1, /* NDEF Header */
0x01, /* NDEF type length */
0x1A, /* NDEF payload length */
0x54, /* NDEF Type */
0x02, /* TEXT Lang Len */
0x65, 0x6E, /* TEXT Lang value */
0x57, 0x65, 0x6C, 0x63, /* TEXT */
0x6F, 0x6D, 0x65, 0x20, /* TEXT */
0x74, 0x6F, 0x20, 0x53, /* TEXT */
0x54, 0x20, 0x4E, 0x44, /* TEXT */
0x45, 0x46, 0x20, 0x64, /* TEXT */
0x65, 0x6D, 0x6F /* TEXT */
};
You can also encode NDEF messages thanks to NDEF library and then copy this message into the NDEF file buffer. The STSW-ST25R-LIB has a Card Emulation demo called bluetooth_pairing that encodes a NDEF message and copy it into the NDEF buffer. You can also modify this demo to encode an NDEF with a TEXT record.
Rgds
BT
2021-04-01 05:56 AM
Hello Mickaël,
The card Emulation demo emulates a T4T tag with a CC file and an NDEF file. In STM32CubeExpansion_NFC6_V1.1.0, the NDEF file has an hardcoded NDEF URI in ndef_uri bytes array in demo_ce.c file. it can be easily modified to have a TEXT record instead of a URI record, for example:
static const uint8_t ndef_uri[] = {
0x00, 0x1E, /* NDEF length */
0xD1, /* NDEF Header */
0x01, /* NDEF type length */
0x1A, /* NDEF payload length */
0x54, /* NDEF Type */
0x02, /* TEXT Lang Len */
0x65, 0x6E, /* TEXT Lang value */
0x57, 0x65, 0x6C, 0x63, /* TEXT */
0x6F, 0x6D, 0x65, 0x20, /* TEXT */
0x74, 0x6F, 0x20, 0x53, /* TEXT */
0x54, 0x20, 0x4E, 0x44, /* TEXT */
0x45, 0x46, 0x20, 0x64, /* TEXT */
0x65, 0x6D, 0x6F /* TEXT */
};
You can also encode NDEF messages thanks to NDEF library and then copy this message into the NDEF file buffer. The STSW-ST25R-LIB has a Card Emulation demo called bluetooth_pairing that encodes a NDEF message and copy it into the NDEF buffer. You can also modify this demo to encode an NDEF with a TEXT record.
Rgds
BT
2021-04-02 12:46 AM
Hello Brian,
Sorry but I debug the application and I realize I am using demoP2P( nfcDevice ) instead of demoCe( nfcDevice );
I add DEMO_CARD_EMULATION_ONLY in Symbols of the project (see picture) but it don't work
Can you explain me how use demoCE( nfcDevice ); ?
can you confirm me that an emulated card is recognized by ios 13 and more ?
Rgds
MB
2021-04-05 12:52 PM
Hello Mickaël,
I believe iOS does not support P2P, so can you share more details on the reader device being used during tour test in front of the ST25R3916 while having P2P?
Can you elaborate on what is not working when using DEMO_CARD_EMULATION_ONLY? I would suggest to set RFAL_FEATURE_NFC_DEP to false to disable Active P2P.
Rgds
BT
2021-04-06 01:29 AM
Hi Mickaël,
I think you are running into an issue which I recently discovered: You need to set the define ST25R3916 to have card emulation operational. You will see the relevant code in demo.c is not activated unless that define is set.
Yes, iOS will recognize NDEF content. AFAIK it only has limited support of NDEF types (for sure URI). I don't think that text is among the supported content.
BR, Ulysses
2021-04-06 01:31 AM
Hello Brian,
I set RFAL_FEATURE_NFC_DEP to false to disable Active P2P in the file "platform.h" but in debug mode, RFAL_FEATURE_NFC_DEP stay to true, why ?
I apply a smartphone and I go to demoAdpu and with an other smartphone, I go to demoP2P.
How can I go to demoCE for Emulated Card ?
is this mode recognise by android and ios ?
Rgds
MB
2021-04-06 01:44 AM
Hi Mickaël,
if you visit the following thread you will find some more details on how to set X-CUBE-NFC6 to card emulation only and also some topics about interop:
P2P is not supported to date by iOS. Also its support in Android is disappearing. Modern Samsung phones and Google Nexus have dropped it.
Regards, Ulysses
2021-04-06 02:08 AM
Hi Ulysses,
I am a beginner with X-CUBE-NFC6.
I set RFAL_FEATURE_NFC_DEP to false in the file "platform.h" and ST25R3916 in properties of project, is it the good way to run DemoCE ?
The application always go to demoAdpu and demoP2P.
Regards,
Mickael
2021-04-06 02:44 AM
Hi Mickael,
just go through the mentioned thread, it contains all needed steps. My minimal changes were: Set ST25R3916 and force discParam.techs2Find = RFAL_NFC_LISTEN_TECH_A; or discParam.techs2Find = RFAL_NFC_LISTEN_TECH_F inside demoIni(). As often there may be multiple ways and playing more with the defines you can optimize out more code.....
Best Regards, Ulysses
2021-04-06 05:56 AM
Hi Ulysses,
I resolved my problem. I forced discParam.techs2Find = RFAL_NFC_LISTEN_TECH_A and I modified the uint8_t ndef_uri[] by the example given at the beginning of the conversation.
Can you confim the max lenght of NDEF text is 64 bytes related to using ST25R3916 ?
Do you known why P2P mode is disappearing in android ?
Best Regards,
Mickaël