×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: NDEF Tag Format

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    7

    NDEF Tag Format

    Hello!

    I'm developing a C-Application which reads in a MiFare-1k-Tag written by the 6131 and I want to use the data stored on it (e.g. VCard).
    I'm using an Arygon NFC Reader.
    My problem is to detect the beginning of the payload (ASCII-text). It seems to me, that the phone allways writes the data to another location (MiFare-block).
    Could someone please explain the NDEF Messages created by the 6131 to me? How could I read out such a tag with my application? I allready know how to do a MiFare-Block-Login and how to read a block. But as I said I don't know where to find the relevant data on the tag.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Re: NDEF Tag Format

    Hi

    My own experiences is that, NDEF formatted data is written to sector 2 (counting from 1), data block 4 (counting from 0). Sector 1 has two data blocks, 1 sector trailer and 1 manufacturer block. Sector 2 have 3 data blocks and 1 sector trailer.

    I have seen that, NDEF Messages are written starting from data block 4. As each data block is 16 bytes, Messages longer than 16 bytes will automatically be written to several blocks (sector trailer block are not used for storing data).

    I will give you an example: I want to write "Hello, World!" as a "NDEF Text Record Type (RTD)". The Text RTD is simply plain text. I create the message using the NFC SDK for Java and write the data to a tag.

    Then I read in the data to a dynamically expanding array and convert the data to hexadecimal representation. When I did this (I have tried it with several different NDEF Messages), I saw that a NDEF Message always start with 0x03 and end with 0xFE. So, I think that if you look for the 0x03 code you will also be able to know where the data starts.

    However, to get the payload data, some more processing has to be done. A NDEF Message is constructed by 4 parts as far as I can see: start-marker - header - contents - end-marker. When I wrote the "Hello, World!" I got this hexstring:

    03 - 11d1010d54 - "Hello, World!" - FE

    11d1: control markers
    0d: hex code for "13", the length of the data. Data is written as utf-8, meaning that each ASCII char uses 1 byte.
    54: hex code for the letter "T". Identifies the Message as a Text record.

    If you use the software integrated in the 6131 NFC phone to create a "Text Message" (will be read in as a SMS by the phone), the NDEF Message actually created will be a "Smart Poster" record type. Therefor, in the above example, "54" would be replaced by "5370" which is the hex code for "Sp" (Smart Poster).

    What I have written here, is from my own research I am doing for my master thesis about using RFID. I am using Java ME to test everything I do, so I suggest you to try and fail. Nokia has provided a SDK that easies the implementation of NFC software for the 6131 NFC phone. The framework allows me to read in NDEF Messages without having to think about data blocks and sectors, which I belive you have to since you are using C.

    I hope some of this information helps you.
    Good luck.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    7

    Re: NDEF Tag Format

    Thanks Dervis!

    I'm writing my Master thesis, too.

    I found out that Block 1 and 2 in Sector 0 (both counted from 0) is the Mifare Application directory area (MAD). If you read the NFC-MAD-Documentation you can see that every application using this mifare card marks the sectors it is using in the MAD.
    I found out that the 6131 uses the application ID "03 E1". so every block marked with this is used by the 6131.
    But if I wrote some more records on the tag (e.g. a few VCards), the MAD-Block shows all sectors the 6131 wrote data in. But how does the phone know which was the last entry and with this is the actual one?

    @Dervis: If you like you can write me a PN so we can share more information about these things...

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Re: NDEF Tag Format

    Thanks, that was usefull for me to know too.

    I have read through the MAD documentation. It seems to me that the MAD area actually has to be created/exist before it can be used. Writing NDEF data using the Nokia SDK does this automatically.

    In the documentation it says that, an application can have more than one AID's in the MAD. When it comes to differing the entries, the documentation says that the application itself has to organize the data structures.

    I guess that, the MAD actually return the range of sectors that contains some specific application data.

    I think that if I use a custom data structure and the tag only contains data using this structure, I will not need to create a MAD. The vcards for instance, if the tag only contains plain data without NDEF, you will be able to differ the vcards as each vcard starts with "BEGIN:VCARD" and ends with "END:VCARD".

    However, if I were to use NDEF formatted vcard data, another challenge occurs. How can you write multiple NDEF Messages to the tag? As I see it, this can only be achieved by nesting multiple "records" (a NDEF Message can have several recods) and maybe there is a way of nesting a Message object inside a record? Well.. that is my current problem and I try to find an answer to it.

    I think we should discuss this topic in this thread. I can however send you a pm about my project and how I'm going to use the 6131 NFC phone.
    Last edited by Dervis; 2007-12-19 at 13:51.

  5. #5
    Registered User
    Join Date
    Sep 2007
    Posts
    7

    Re: NDEF Tag Format

    Hi Dervis,

    just for your info: i'm on vacation untill jan, 07!
    I will write back than!

    nice christmas and a good start in 2008 to all!

  6. #6
    Registered User
    Join Date
    Jan 2008
    Posts
    1

    Re: NDEF Tag Format

    Hi Dervis!

    I'm currently having a similar project where I'm trying to use NDEF formatted vcard data. I was wondering if you'd have some advices or comments on that case you could share.

    Thank you in advance!

  7. #7
    Regular Contributor
    Join Date
    May 2007
    Posts
    63

    Re: NDEF Tag Format

    hi TS-tec,

    is it possible for you to share with you how you do a MiFare Block Login?
    i suppose that is is a Three Pass Authentication.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Re: NDEF Tag Format

    Quote Originally Posted by rjar View Post
    Hi Dervis!

    I'm currently having a similar project where I'm trying to use NDEF formatted vcard data. I was wondering if you'd have some advices or comments on that case you could share.

    Thank you in advance!
    Hello,

    Well, have you checked out the PIM API provided by Nokia? PIM is the Personal Information Manager interface that gives you access to device specific data. Ie. calendar event and contact list. You can easily add contacts given in VCARD form to the phone using the PIM API. However, this API is for Java.

    Info about PIM: http://developers.sun.com/mobility/a...pim/index.html In this page, you will also find an example of the structure of a VCARD.

    I think you can use the NFC Text record type and make a vcard parser. I am working on a such parser. I can post it in this thread, when I get it working.

    Hope that helps a bit.

  9. #9
    Registered User
    Join Date
    Apr 2004
    Posts
    6

    Re: NDEF Tag Format

    Quote Originally Posted by Dervis View Post
    A NDEF Message is constructed by 4 parts as far as I can see: start-marker - header - contents - end-marker. When I wrote the "Hello, World!" I got this hexstring:

    03 - 11d1010d54 - "Hello, World!" - FE

    11d1: control markers
    0d: hex code for "13", the length of the data. Data is written as utf-8, meaning that each ASCII char uses 1 byte.
    54: hex code for the letter "T". Identifies the Message as a Text record.
    03 - start marker
    11 - ???
    d1 - 1101 0001 - MB = 1, ME = 1, CF = 0, SR = 1, IL = 0, TNF = 0x1
    01 - TYPE LENGTH = 1
    0d - PAYLOAD LENGTH = 13
    54 - TYPE = T

    Anyone know what the first byte (0x11) after the start marker means?

  10. #10
    Registered User
    Join Date
    Apr 2004
    Posts
    6

    Re: NDEF Tag Format

    Quote Originally Posted by _jsw_ View Post
    03 - start marker
    11 - ???
    d1 - 1101 0001 - MB = 1, ME = 1, CF = 0, SR = 1, IL = 0, TNF = 0x1
    01 - TYPE LENGTH = 1
    0d - PAYLOAD LENGTH = 13
    54 - TYPE = T

    Anyone know what the first byte (0x11) after the start marker means?
    Anyone, please?

  11. #11
    Registered User
    Join Date
    Feb 2007
    Posts
    6

    Re: NDEF Tag Format

    0x11 = NDEF record header (SR=1, TNF=0x01)

    This means that it is a short record type and it is a NFC Forum well know type

  12. #12
    Registered User
    Join Date
    Nov 2004
    Posts
    17

    Re: NDEF Tag Format

    Quote Originally Posted by timharvey View Post
    0x11 = NDEF record header (SR=1, TNF=0x01)

    This means that it is a short record type and it is a NFC Forum well know type

    No - this is wrong. When an NDEF message is written to a Mifare tag it is prefixed with the TLV header (type-length-value) and the TLV terminator is appended.

    the header is
    03: type = ndef
    11: length = 17 bytes
    ...here is the NDEF message
    FE: TLV terminator

    please see the type1-tag specification from NFC Forum

  13. #13
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: NDEF Tag Format

    Hi there,

    I really want to get into this NFC game and create applications for the N9. Only problem is, I don't know where to start. Can you perhaps provide documentation of where I can write an application from scratch?

    I have the QT 1.1.4 sdk but it gave me problems during the installation as well, I tried it twice...but it eventually installed, after skipping some files that weren't downloaded...for some reason.

    Thanx

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: NDEF Tag Format

    Quote Originally Posted by cameronsmith63 View Post
    I really want to get into this NFC game and create applications for the N9.
    Does this help?

  15. #15
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: NDEF Tag Format

    Thanks Traud,

    Will be looking through these soon. Sorry for the late reply, this site does not notify me via email that someone has posted on a thread. maybe i need to set that up as well, if that functionality is there.

Similar Threads

  1. Preventing write-access to NFC tag
    By Jazz66 in forum Near Field Communication
    Replies: 4
    Last Post: 2009-06-25, 11:11
  2. Creating a 6131 readable external tag wth an external reader
    By gngulrajani in forum Near Field Communication
    Replies: 1
    Last Post: 2008-04-03, 17:47
  3. Write url NDEF message to tag
    By Alex_Polt in forum Near Field Communication
    Replies: 6
    Last Post: 2007-10-28, 15:02
  4. NDEF Tag Image File formating
    By ustagnu in forum Near Field Communication
    Replies: 3
    Last Post: 2007-09-03, 12:37
  5. NDEF tag text only
    By cde in forum Near Field Communication
    Replies: 2
    Last Post: 2007-07-02, 17:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×