This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC Tag Type for rwpayload and staticpayload at same time.

Hello,

I want to define a writable payload section and a static payload section (not writable) in one tag is this possible?

I have now implemented it like this, but that only gives me the static payload.

void nfc_init(void)

{ uint32_t err_code;

  /* Set up NFC */
err_code = nfc_t4t_setup(nfc_callback, NULL);
APP_ERROR_CHECK(err_code);
		
/* Provide information about available buffer size to encoding function */
uint32_t len_static = sizeof(m_ndef_msg_buf_static);
	uint32_t len_rw = sizeof(m_ndef_msg_buf_rw);

	name_msg_encode(m_ndef_msg_buf_rw, &len_rw);
												
/* Run Read-Write mode for Type 4 Tag platform */
err_code = nfc_t4t_ndef_rwpayload_set(m_ndef_msg_buf_rw, sizeof(m_ndef_msg_buf_rw));
APP_ERROR_CHECK(err_code);

	uuid_msg_encode(m_ndef_msg_buf_static, &len_static);

   /* Run Static mode for Type 4 Tag platform */
err_code = nfc_t4t_ndef_staticpayload_set(m_ndef_msg_buf_static, sizeof(m_ndef_msg_buf_static));
APP_ERROR_CHECK(err_code);
																
/* Start sensing NFC field */
err_code = nfc_t4t_emulation_start();
APP_ERROR_CHECK(err_code);

}

Thanks!

  • Hi, according to the Type 4 Tag specification, I think it should be possible to have multiple NDEF files in a tag. However the Type 4 Tag library in the nRF5 SDK supports just a single NDEF file as part of the T4 Tag.

    The code above basically overwrites the read/write content by static content (non-writable).

    So to have both a read-only and R/W content at the same time, you will have 2 options:

    • keep an NDEF data backup for the non-writable data, and once the non-writable section is updated by the Reader/Writer, the application can revert this data using the mentioned backup. In this solution keep in mind, that the reader will think the update was successful (it will get back status word "success"). Also remember to keep the NLEN (NDEF length) field compatible when reverting updates.

    • use nfc_t4t_lib in raw mode, running pure ISO-DEP commands (as described in the SDK documentation: T4T doc) and implement multiple NDEF file emulation on application level. Then the separate NDEF files can have different access rights.

    Regards, Michał

  • Thanks! I will check out these things and report back.

  • Hi michaeld, what libaries are you using? I am trying to do the same task, but I am a little missing about the uuid_msg_encode and name_msg_encode you are using. where are it defined? Thanks

Related