Skip to main content
Visitor II
March 11, 2020
Solved

How to launch properly application to read NFC tag with an NFC03A1 nucleo attached to a NUCLEO F091RC ?

  • March 11, 2020
  • 20 replies
  • 4798 views

Hello,

I am trying to read some NFC tag with a X-NUCLEO-NFC03A1 attached to a NUCLEO F091RC board. I am a beginner into those technology, so basically I was trying to load the sample "NFC Detect " from the package "X-CUBE-NFC3" wich can be found on ST official website to understand how to use NFC stuff. The problem is, I tried to build the project on the STM32 IDE Cube, and it worked fine, but i can't read anything on the NFC NUcleo's antenna after running the programm.

I suppose there are problems of initialisation , but i have no idea how to debug this.

Thanks you for your time,

Best Regards,

Karim

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi Karim,

    the projects build out of the box - given you have the toolchain pre-installed. In the package are also pre-compiled binaries which you can directly load and observe.

    Regards, Ulysses

    20 replies

    KBens.1Author
    Visitor II
    March 18, 2020

    Hello Ulysses and Brian,

    Thanks you for your fast answers, I wasn't able to answer back until now because of COVID-19. I'm ready to continue then :

    I download the ST25 application. I am using 2 differents NFC device :

    • A standard NFC type 2 tag ISO 14443A. I can write and read on it from the application. As you can see below, it looks like a CC file has been created when i write a simple NDEF message on it :

    0693W000000UD4BQAW.jpg

    The Ndef message i wrote on it :

    0693W000000UD0eQAG.jpg

    The CC file create automatically I suppose, because I didn't do it manually

    0693W000000UD70QAG.jpg

    At the moment, I have the famous error 5 with this one too.

    In my final application, I will have to read data on the M24LR64E-R, made by ST too.

    Indeed here, there is no CC file created (i didn't wrote on it).

    0693W000000UD7tQAG.jpg

    0693W000000UD7yQAG.jpg

    Maybe you could explain me how to create CC file ?

    Thanks you both for your help and reactivity,

    Best Regards,

    Karim BENSEGHIR

    Technical Moderator
    March 18, 2020

    Hi Karim,

    for the M24LR, you can either format it with the X-CUBE-NFC3 ndef_demo (press the blue button until menu 4 is displayed) or you can format it through the Android app (write an NDEF on this tag).

    For the T2T tag, can you dump the contain of the tag memory and provide to us for analysis?

    Thanks

    Rgds

    BT

    KBens.1Author
    Visitor II
    March 23, 2020

    Hello BRIAN,

    We are advancing forward with the M24LR ! :D

    I can format it like you explained to me , by using the application :

    0693W000000UUqRQAW.jpg

    Then when I try to read it, the NDEF status looks ok :

    0693W000000UUqbQAG.jpg

    Then, I tried to write from the application an NDEF message, a simple text, but when i try to read it throug the application, it doesn't work again :

    0693W000000UUqvQAG.jpg

    But when I try to write from the app and to read it, it looks to works :

    0693W000000UUr0QAG.jpg

    Do you have any ideas why i can't read NDEF message i would insert from the app ?

    For the memory of the T2T tag, here it is :

    0693W000000UUrAQAW.jpg

    Thanks you for your time and you help again,

    Best regards,

    Karim

    Technical Moderator
    March 23, 2020

    Hi Karim,

    the content of the T2T tag memory is incorrect at address 16. Please try to write 03 00 FE 00 in this block with the Android app and retry to perform NDEF read and NDEF write from X-CUBE-NFC3 STM32 application.

    Rgds

    BT

    KBens.1Author
    Visitor II
    March 23, 2020

    Hi Brian,

    You were right ! I don't understand why, but i just change the adress memory like you told me, and then the NDEF status has changed when I am trying to read it from  X-CUBE-NFC3 STM32 application:0693W000000UWCsQAO.jpg

    And now it's an protocol error wich is coming according to the returned integer :

    0693W000000UWDCQA4.jpg

    I will have to change an another parameter i guess .

    Sorry for my last message, after reading back myself I wasn't very clear :

    I wanted to mean, I can write and read properly from X-CUBE-NFC3 STM32 application, but i can't read NDEF message on X-CUBE-NFC3 STM32 application that I wrote from Android application. After studies, I think when I write ndef message from android app, the M24 is formatted again, so it can't be read from X-CUBE-NFC3 STM32 application (with good format)

    Thanks you again a lot for your great help and reactivity.

    Best regards,

    Karim

    KBens.1Author
    Visitor II
    March 23, 2020

    Ok my bad for the second part, finally after formating from X PACKAGE application, i can write from Android app, and read the message on X PACKAGE ! :grinning_face:

    Technical Moderator
    March 23, 2020

    Hi Karim,

    I am a little bit lost as issues with T2T and issues with T5T are mixed.

    Regarding the T2T issue: a Control Lock TLV was present in the tag (01 03 A0 0C 34) . This feature is not supported as of today by the current NDEF stack and therefore the tag was rejected. That's why I've suggested to replace this with the NDEF TLV (03 00) followed by the terminator TLV. Can you share the tag model and tag manufacturer?

    Regarding the M24LR (T5T), can you dump the memory contain when you have an issue?

    Thanks

    Rgds

    BT

    KBens.1Author
    Visitor II
    March 23, 2020

    Hi Brian ,

    Yes it's my fault, I wasn't very clear about my explications. Thanks to you now I have more knowledge about RFID to explain my situation :

    Regarding the T2T issue ;

    According to the NFC tool android application, it's an NXP MIFARE Ultralight- NTAG 213

    0693W000000UWZeQAO.jpg

    But i don't understand how you manage to find the Control lock TLV on adress 16, because when I study the data sheet , it's only for user memory :

    0693W000000UWjcQAG.jpg

    https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf

    Regarding the M24LR (T5T)

    After formating from X PACKAGE application, and write through X PACKAGE application too, i can read on the android application :

    0693W000000UWkkQAG.jpg

    And the memory :

    0693W000000UWhSQAW.jpg

    Then i tried to modify the message and read back the memory again :

    0693W000000UWlnQAG.jpg

    And when I try to read it back on the X PACKAGE application, it's working fine :

    0693W000000UWmlQAG.jpg

    But, i am now trying to understand why the adress n°05; 06; 07 has changed when i modified the message.

    Thanks,

    Best regards,

    Karim

    Technical Moderator
    March 24, 2020

    Hi Karim,

    for T2T: as per the NFC Forum Technical Specification T2T v1.0, different TLV can be present after the Capability Container: Null TLV, Lock Control TLV, Memory Control TLV, etc.

    For the M24LR, the NDEF TLV starts at address 4:

    • 0x03 is the T-field for a NDEF Message TLV
    • 0x1E/0x17 is the L-field. As your message has a different size than the initial message, the L-field has changed

    For more information, see:

    • Type 2 Tag Technical Specification Version 1.0
    • Type 5 Tag Technical Specification Version 1.0
    • NFC Data Exchange Format Technical Specification Version 1.0

    Rgds

    BT

    KBens.1Author
    Visitor II
    March 30, 2020

    Hello Brian,

    Thanks you for all your informations . I have a lot more understanding of the hardware and software, i will come back for any further questions :)

    Best regards,

    Karim

    Technical Moderator
    April 28, 2020

    Hi,

    M24LR is a dual interface EEPROM:

    ST25R95 <--- RF ---> M24LR <--- I2C ---> MCU

    On RF side, the M24LR64E-R follows the ISO/IEC 15693 standard and the physical memory is organized in block of 4 bytes. Due to memory capacity, the read/write commands (such as Read Single Block/Read Multiple Blocks, Write Single Block or Write Multiple Blocks) have been extended to support 2-bytes block address. This is supported through the following RFAL API in rfal_st25xv.c:

    • rfalST25xVPollerM24LRReadSingleBlock
    • rfalST25xVPollerM24LRWriteSingleBlock
    • rfalST25xVPollerM24LRReadMultipleBlocks
    • etc.

    Rgds

    Bruno

    KBens.1Author
    Visitor II
    May 4, 2020

    Hello Brian (Bruno ? )

    Thanks you again for those very precise informations. It was exactly the functions I was looking for. But i am encoutering some problems with the arguments of the functions (especially with UID and FLAG arguments) . Would it be possible to get an example of the rfalST25xVPollerM24LRReadSingleBlock and rfalST25xVPollerM24LRWriteSingleBlock functions ?

    It's the final step on my project.

    Best regards,

    Karim

    Technical Moderator
    May 4, 2020

    Hi,

    see demoNfcv() in demo.c for example of how to set UID and flag parameters.

    Basically

    uid = nfcvDev->InvRes.UID and flag = RFAL_NFCV_REQ_FLAG_DEFAULT

    Rgds

    BT

    KBens.1Author
    Visitor II
    May 11, 2020

    Hello,

    Thanks you again for your advice. I studied the rfal_st25xv.c librarie to understand how I could manage to read and write into the memory blocks. As you noticed me, the demoNfcv() as been created to do so. I tried to use it,I copied/pasted it to the ndef_demo.c file, because i can't run it from the demo.c file (wich has been like excluded from the project) :

    0693W000000XDnRQAW.png

    I am still using the M24 tag, so I am calling the function at the right place, when an ISO15693 has been detected.

    0693W000000XDq6QAG.png

    As you can see i have put the demoNfcv function.

    And now i got a read block error, but no error code is returned, so i can't understand why it is failling :

    0693W000000XDtZQAW.png

    Best Regards,

    Karim

    Technical Moderator
    May 11, 2020

    Hi Karim,

    the demoNfcv uses rfalNfcvPollerReadSingleBlock() whereas a M24LR64 tags has a extended block number coding.

    rfalNfcvPollerReadSingleBlock() works for standard ISO15693 tags whereas rfalST25xVPollerM24LRReadSingleBlock has to be used for M24LR64 or M24LR16 tags.

    If you want to read a block from a M24LR16 or M24LR64 tag, you just need to replace rfalNfcvPollerReadSingleBlock by rfalST25xVPollerM24LRReadSingleBlock in the demoNfcv.

    Rgds

    BT

    KBens.1Author
    Visitor II
    May 12, 2020

    Hello Brian,

    I tried to replace rfalNfcvPollerReadSingleBlock()  by the rfalST25xVPollerM24LRReadSingleBlock function. Here in the code (ndef_demo.c) :

    0693W000000XIKoQAO.jpg

    I added a static variable with the asked structure :

    0693W000000XIL8QAO.jpg

    And I just replaced the demoNdef(nfcDevice) originally in the code by the demoNfcv() .

    0693W000000XIO2QAO.jpg

    No error or warining during compilation, but when I am trying to read through the application, still got read block fail :

    0693W000000XIOMQA4.jpg

    Best regards,

    Karim

    Technical Moderator
    May 12, 2020

    Hi,

    your nfcvDevice variable is not initialized... the proper way is to used nfcDevice that is initialized thanks to rfalNfcGetActiveDevice( &nfcDevice );

    The proper call to demoNfcv is:

    demoNfcv( &nfcDevice->dev.nfcv );

    See demo.c.

    Rgds

    BT

    KBens.1Author
    Visitor II
    May 12, 2020

    Thanks a lot, it worked fine ! :)

    Best regards,

    Karim