This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SDK13 nfc_t2t_payload_raw_set() not work properly.

Hello, I use SDK example nfc_text_record for pca10040 DK. With aim to check memory area of the emulated tag I've modified example with next:

 /* Set up NFC */
    err_code = nfc_t2t_setup(nfc_callback, NULL);
    APP_ERROR_CHECK(err_code);

	static const uint8_t key[16]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10};
	err_code = nfc_t2t_payload_raw_set( key, 16);
    APP_ERROR_CHECK(err_code);

    /* Start sensing NFC field */
    err_code = nfc_t2t_emulation_start();
    APP_ERROR_CHECK(err_code);

    while (1)
    {
        __WFE();
    }

After reading with cardreader:

Pages:

04     00 00 00 00     90 00
05     05 06 07 08     90 00
06     09 0a 0b 0c     90 00
07     0d 0e 0f 10     90 00

so the question is why nfc_t2t_payload_raw_set() skip writing page 4 while perform writing of pages 5-7?

  • FormerMember
    0 FormerMember

    Could you try to use nfc_t2t_payload_set(..) instead of nfc_t2t_payload_raw_set(..) and check if that it gives a different result?

  • Hi, Kristin The nfc_t2t_payload_set() adds NDEF TLV 03 10 in first 2 bytes so it is:

    04 - 03 10 01 02
    05 - 03 04 05 06
    06 - 07 08 09 0a
    07 - 0b 0c 0d 0e
    08 - 0f 10 00 00
    

    in description to a function stated : "..The required NDEF TLV will be created implicitly by NFC T2T Library.." so it's work. I need nfc_t2t_payload_raw_set() because it write raw data without TLV.

  • Hi, the problem with your code is, that you use const for the NFC raw payload storage. The nRF52 Product Specification states that the NFCT peripheral uses EasyDMA, which requires an address in RAM space. And maybe the SDK documentation is missing that... So it will not work if your data is stored in Flash. To be precise it will do the following: if your flash address is 0x00000234, NFCT will use data from 0x20000234 so it may read random data from some location in RAM!

    Hope this helps.

    Regards, Michal

  • Thanks! After removing static const modifier I works fine.

Related