Skip to main content
Visitor II
March 15, 2023
Solved

store a serial number permanently in NFC EEPROM

  • March 15, 2023
  • 7 replies
  • 3101 views

Hi ,

I integrated st25dv64kc nfc tag into stm32 board. I have to store a serial number permanently in NFC EEPROM user area. It should not be erased in RF write and I2c Write. I used NDEF format . 

Is it possible to store text permanently ?

    This topic has been closed for replies.
    Best answer by JL. Lebon

    Hello Neethu,

    Ok, so if the data is correct using i2C read, this means that the application is not able to read the data at this place in memory (probably using read Single Blocks command)

    Can you please try this application: https://play.google.com/store/apps/details?id=com.st.st25nfc&hl=en&gl=US

    Also, if your NDEF file is to be from block 0000h to block 01ffh, you need a special CC file on two blocks (CCFile on 1 block will allow NDEF file only up to block FFh).

    The application I recommend you will create the appropriate CCFile for you (I think NFC tool may not create the correct CCFile) If you want infor on CCFile format, please read this application note: https://www.st.com/resource/en/application_note/an4911-ndef-management-with-st25dvi2c-series-and-st25tv16k-and-st25tv64k-products-stmicroelectronics.pdf

    Best regards.

    7 replies

    ST Employee
    March 20, 2023

    Hello,

    The EEPROM is non volatile memory, which means that once your data is written, it is not erased at power down. Then, if you want it not to be overwritten, you need to write-protect the memory.

    In ST25DV64KC, you can protect the memory from write (and read if needed).

    The memory can be divided in 1 up to 4 areas. Each are can be independently protected.

    The size of each area is also programmable. The areas are contiguous and minimum size is 32 Bytes.

    So, to store your serial number, you can create an area of at least the size of your number. this is done using the ENDA1, ENDA2, ENDA3 configuration registers. Pleas see chapter 4.2.1 User memory areas in the datasheet.

    Then you need to protect this area against write (see chapter 5.6 Data protection in datasheet).

    You can protect the access from the RF interface by setting the value of the RFAxSS configuration registers corresponding to your area. You can allow to access the area in read only after presentation of a password, or you can definitely block the write access by protecting the area without a password.

    On the I2C side, the area can be protected in write using the I2CSS configuration register.

    Best regards.

    NK R.2Author
    Visitor II
    April 10, 2023
    Hello,
    Thank you for your reply.
    Here I am using the NDEF library. I have to store a 32 byte ID in memory 1 area. In the ndef library format we first write ccFile(ccfile length is 8 bytes). Then text data is written with that offset (0x0008). Suppose I created two areas ENDA1, ENDA2. The ENDA1 area is 32 bytes permanent and remaining area for ENDA2.
    Is it possible to write ccfile in the ENDA2 area? We can use read / write protection for 32 bytes in ENDA1. But if I protected the ENDA1 area for write protection, would RF write in the ENDA2 area possible.? Will writing to dIfferent areas using the RF write will work ?
    Regards,
    Neethu
    ST Employee
    April 18, 2023

    Hello Neethu,

    Let me answer your questions one by one:

    "Is it possible to write ccfile in the ENDA2 area?": yes, it is possible, but it is meaningless since the CCFile must always be at the first address of the memory to be regognized yb a reader (this is the NFC Forum specification). So, in practice, the CCFile must always be at the start of the memory, in the first area.

    "if I protected the ENDA1 area for write protection, would RF write in the ENDA2 area possible.? Will writing to different areas using the RF write will work ?": yes, protection of each area are completely independent from each others.

    Basically, if you want to use NDEF, you must have the CCFile at the beginning of memory (start of area 1), immediately followed by the NDEF data. This is mandatory to respect the NFC Forum specification and ensure interoperability with readers.

    Then if you want to have proprietary data, you can put it in the second area and protect it separately from area1.

    Best regards.

    NK R.2Author
    Visitor II
    April 27, 2023
    Hi JL.Lebon,
    Thank you for your Reply.
    I could write NDEF data in Area1 and permanent data in Area2.
    It was working. But I am not able to view the data using the NFC Mobile App tool.
    Is it possible to read both NDEF and raw data using NFC reader ?
    Regards,
    Neethu
    ST Employee
    April 28, 2023

    Hello,

    Off course, all the data in the tag are readable.

    The Area1 contains an NDEF file, which is a standardized file format. So any application which is NFC Forum compliant can read it as it is standard data format.

    The area2 contains proprietary data, stored in a proprietary way. So you need a proprietary application, either on your phone or on a reader to read it.

    I don't know which NFC application you are using, but very often those apps are allowing you to read the memory content in raw format. You can read the area 2 this way.

    Best regards.

    NK R.2Author
    Visitor II
    May 4, 2023
    Hi ,
    I have configured 2 User memory areas.
    User memory as seen by i2c byte Addressing is
    Area 1 = 0000h - 07FFh
    Area 2 = 800h - 1FFFh
    I wrote my permanent data in location 800 h (starting location of Area2). Then I read the entire memory using the NFC Tools app. While checking the corresponding RF block - 200 h (800 h in I2C byte Addressing), I could not find permanent data written ,instead I could find previously written NDEF data.
    However I have verified that I am able to read my permanent data using the I2c interface properly.
    Do you have any sample code which I can refer to ?
    Thanks
    Neethu
    Visitor II
    May 2, 2023

    You can set up the CC area to indicate that a specific memory block (or blocks) is read-only, which will prevent it from being erased or modified by RF writes or I2C writes. This can be done using the ST25 NFC Tag configuration software provided by STMicroelectronics.

    Once the CC area is set up, you can write your serial number to the user area of the tag using the NDEF format, as you have already done. The serial number will be stored permanently in the read-only memory block(s) that you have specified.

    pintdd

    ST Employee
    May 4, 2023

    @NN R.2:

    I still don't know what is this NFC tool app you are using, but be this can be the issue.

    In ISO15693 and NFC Forum type 5, there are two different read commands:

    • Read Single Block
    • Extended Read Single Block

    The first one codes the block address on one Byte, and thus is only able to address the first 256 Blocks of memory.

    The second one is to be used with large memory tags, and codes the block address on 2 Bytes. It is able to address all blocks of the tag.

    If your NFC tool app is only able to send Read Single Block, the address block 200h will problably be truncated to address 00h, which can explain that you read the same NDEF data as in area 1.

    When you read memory at I2C address 800h from I2C interface, is your data correct ?

    Best regards.

    NK R.2Author
    Visitor II
    May 4, 2023

    Hi Lebon,

    Thank you for your quick reply.

    Please find the below link of NFC app which I am using.

    https://play.google.com/store/apps/details?id=com.wakdev.wdnfc&hl=en&gl=US&pli=1

    When you read memory at I2C address 800h from I2C interface, is your data correct ?

    >>>>> Yes . I am able to read correct data at I2C address 800h from I2C interface.

    Regards,

    Neethu

    ST Employee
    May 4, 2023

    @MStev 8:

    The indication of read only state in the CCFile is only an INFORMATIVE indication. It doesn't mean that the block indicated are really locked.

    One that put the read only bit in the CCFile shall also lock those blocks pointed out by the CCFile.

    Furthermore, CCFile lock specifies a lock for the complete NDEF file, so it may not correspond to what is requested here.

    Best regards.

    JL. LebonAnswer
    ST Employee
    May 4, 2023

    Hello Neethu,

    Ok, so if the data is correct using i2C read, this means that the application is not able to read the data at this place in memory (probably using read Single Blocks command)

    Can you please try this application: https://play.google.com/store/apps/details?id=com.st.st25nfc&hl=en&gl=US

    Also, if your NDEF file is to be from block 0000h to block 01ffh, you need a special CC file on two blocks (CCFile on 1 block will allow NDEF file only up to block FFh).

    The application I recommend you will create the appropriate CCFile for you (I think NFC tool may not create the correct CCFile) If you want infor on CCFile format, please read this application note: https://www.st.com/resource/en/application_note/an4911-ndef-management-with-st25dvi2c-series-and-st25tv16k-and-st25tv64k-products-stmicroelectronics.pdf

    Best regards.

    NK R.2Author
    Visitor II
    May 4, 2023

    Hi Lebon,

    Thank you.

    I will do further testing using new NFC application you suggested .

    Regards,

    Neethu