cancel
Showing results for 
Search instead for 
Did you mean: 

How to write two or more records of same type to Dynamic NFC tag?

darla14
Senior
Posted on November 23, 2015 at 14:43

HI,

How can I write two or more records of same type to Dynamic NFC tag?E.g if I want to write WriteEmail,SMS,URI or any such Data can I call it twice?

like

TT4_WriteVcard()

TT4_WriteVcard()

or

TT4_WriteSMS()

TT4_WriteSMS()

and so on..

Kindly advice.!

what is the maximum number of such similiar records can be written.Can they be read in same fashion?

Rgds.

Rp

#m24sr #nfc #m24sr #multiple-ndef
1 ACCEPTED SOLUTION

Accepted Solutions
Rene Lenerve
ST Employee
Posted on December 18, 2015 at 17:09

Hi,

The first FIRST_RECORD_OFFSET constant is used to point to the ndef data in the buffer array. The bytes before FIRST_RECORD_OFFSET are used to store the length of the NDEF message.

The exemple given with NDEF_AddAAR function can help you how to write a function to add records in NDEF message.

For the NDEF header, here is the details

MB = Message Begin

ME = Message End

CF = Chunk Flag (indicating that this is either the first record chunk or a middle record chunk of a chunked payload)

SR = Short Record (if set, that the PAYLOAD_LENGTH field is a single octet)

IL = ID_LENGTH field is present

TNF = Type Name Format

 TNF Field Values:

Empty                                                                                   0x00

NFC Forum well-known type [NFC RTD]                          0x01

Media-type as defined in RFC 2046 [RFC 2046]                0x02

Absolute URI as defined in RFC 3986 [RFC 3986]            0x03

NFC Forum external type [NFC RTD]                                0x04

Unknown                                                                             0x05

Unchanged                                                                           0x06

Reserved                                                                              0x07

CF is used only if you need to split your record in multiple records, you used the SR flag so it indicates you don't need to split it in chunks.

So in your example it gives:

/* MB   ME   CF   SR   IL    TNF    for first Record in the NDEF message */

    1        0        0     1     0       0x02

  Payload type name length

  Payload length

 Payload type name

Payload

/* MB   ME   CF   SR   IL    TNF    for Second Record in the NDEF message */

    0        1       0     1     0       0x06

  Payload type name length - None

  Payload length (same as the payload length of first Record)

 Payload type name - None 

Payload starts here for Second Record.

Hope this helps you.

Have nice day.

View solution in original post

4 REPLIES 4
Rene Lenerve
ST Employee
Posted on November 27, 2015 at 14:12

Hi,

This feature is not directly managed by the NDEF library supplied with the X-CUBE-NFC software package.

The WriteData function allows you to write data at any offset in the memory.

So for example you need to update the code and add an offset parameter for TT4_WriteVcard or TT4_WriteSMS or ... (and in the functions of NDEF lib also called) in order to manage multiple NDEF messages.

Kind Regards,

Have a nice day.

darla14
Senior
Posted on December 08, 2015 at 13:38

Can you please elaborate more on this .

There is this Macro : Offset = FIRST_RECORD_OFFSET , do you mean by this.The value of the SECOND_RECORD_OFFSET will be after the data Payload for the first record?

An example for say SMS will be helpful.

Thanks in advance !

darla14
Senior
Posted on December 09, 2015 at 11:43

I google something and foudn this information : 

/* MB   ME   CF   SR   IL    TNF    for first Record in the NDEF message */

    1        0        1     1     0       0x02

  Payload type name length

  Payload length

 Payload type name

Payload

/* MB   ME   CF   SR   IL    TNF    for Second Record in the NDEF message */

    1        1       0     1     0       0x06

  Payload type name length - None

  Payload length (same as the payload length of first Record)

 Payload type name - None 

Payload starts here for Second Record.

Can you please correct/modify the above packet ?

I am following this : 

http://www.eet-china.com/ARTICLES/2006AUG/PDF/NFCForum-TS-NDEF.pdf

Thanks in advance.

Rp

Rene Lenerve
ST Employee
Posted on December 18, 2015 at 17:09

Hi,

The first FIRST_RECORD_OFFSET constant is used to point to the ndef data in the buffer array. The bytes before FIRST_RECORD_OFFSET are used to store the length of the NDEF message.

The exemple given with NDEF_AddAAR function can help you how to write a function to add records in NDEF message.

For the NDEF header, here is the details

MB = Message Begin

ME = Message End

CF = Chunk Flag (indicating that this is either the first record chunk or a middle record chunk of a chunked payload)

SR = Short Record (if set, that the PAYLOAD_LENGTH field is a single octet)

IL = ID_LENGTH field is present

TNF = Type Name Format

 TNF Field Values:

Empty                                                                                   0x00

NFC Forum well-known type [NFC RTD]                          0x01

Media-type as defined in RFC 2046 [RFC 2046]                0x02

Absolute URI as defined in RFC 3986 [RFC 3986]            0x03

NFC Forum external type [NFC RTD]                                0x04

Unknown                                                                             0x05

Unchanged                                                                           0x06

Reserved                                                                              0x07

CF is used only if you need to split your record in multiple records, you used the SR flag so it indicates you don't need to split it in chunks.

So in your example it gives:

/* MB   ME   CF   SR   IL    TNF    for first Record in the NDEF message */

    1        0        0     1     0       0x02

  Payload type name length

  Payload length

 Payload type name

Payload

/* MB   ME   CF   SR   IL    TNF    for Second Record in the NDEF message */

    0        1       0     1     0       0x06

  Payload type name length - None

  Payload length (same as the payload length of first Record)

 Payload type name - None 

Payload starts here for Second Record.

Hope this helps you.

Have nice day.