Skip to main content
Visitor II
March 18, 2021
Solved

X-NUCLEO-NFC06A1 doesn't read and write any tag, "NDEF NOT DETECTED" error

  • March 18, 2021
  • 14 replies
  • 5677 views

Hello to all!

I have boards - NUCLEOL476RG and X-NUCLEO-NFC06A1 with project "STM32L476RG-Nucleo_PollingTagDetectNdef" running on it.

And got an error when trying to read any tag:

0693W000008xIJLQA2.pngWhen debugging program i found that error, its here in the code, doesn't match

apduParam->statusWord == RFAL_T4T_ISO7816_STATUS_COMPLETE

The walue of statusWord is 27266 instead of 36864 (0x9000)

0693W000008xILRQA2.jpgAppreciate for help and sorry for my english))

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi,

    X-CUBE-NFC6 supports card emulation. However if you use a phone which does act as Reader/Writer and as card against another device which acts also in both roles it is somewhat random which one ends up in which mode. In X-CUBE-NFC6 you could remove all PCD/reader/writer modes from techs2find param. Or use the bluetooth pairing demo in STSW-ST25R-LIB. The demo is built to not require any app on the phone but rather rely on the built-in NFC forum support of Android.

    For P2P: Its support is disappearing in recent phones. Iphone never adopted and recent Android phones are dropping it (e.g. Samsung Galaxy S20, S21, Pixel, etc. ).

    Reading through your requests it does not look like that you are interested in NDEF itself. But rather you want a bi-directional communication with phones. If this is true then I would implement an own protocol based on smartcard/ISODEP. Create an Android app similar to above mentioned "NDEF Tag Emulator". Register it with your own Application ID in the system. Then on top of ISODEP you can exchange arbitrary APDUs (You may want to follow ISO7816 (-4ff ) style).

    On X-NUCLEO-NFC06 I would use the polling for NFC-A and maybe NFC-B, use the example for reading T4T but instead reading NDEF, select your own application ID (defined above) and implement the counter part of your protocol.

    An example which could help you on Android side is the SwipeYours app. Its source code is available and it implements VISA payment as example. But you should be able to easily exchange the payment part with your own stuff.

    Best Regards, Ulysses

    14 replies

    Technical Moderator
    March 18, 2021

    Hi VIVAN.1,

    NDEF can only be read/written from NFC Forum formatted tags. Not all tags are capable of that. Above indicates you are using NFC-A tags supporting ISODEP/ISO7816 APDUs.

    The value 27266=0x6A82 indicates that this tag does not answer success (0x9000) to the command. I think 0x6A82 means "not supported. I assume this to be the response to the "Select NDEF application" command. NFC-A smartcards are available for a plethora of applications, e.g. NFC Forum T4T, EMVCo, Passport, .....

    If you use tags like ST25TA which implement T4T it will report success.

    Best Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 18, 2021

    Thank you for answer.

    NDEF is NFC supported data format for exchange ​and isn't all NFC devices have to support NDEF format ?

    NFC-A tag isn't NFC Forum tag?

    Those messages you see on the picture I got using 2 types of tags: NFС 1К s50 F08///716 Вytеs and ntаg213/137 Bytеs.

    But I also used smartphone and app NFC Tools Pro​ and there was again NDEF NOT DETECTED message.

    Technical Moderator
    March 18, 2021

    Hi,

    yes: not all NFC devices support NDEF format. Even if maybe some of the devices you are using actually support NDEF it may still be needed to format them for it. For formatting you need to consult with the manufacturer.

    Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 18, 2021

    NTAG213 have factory supporting NDEF .

    See NXP​ site

    I have successfully r​eading and writing these tags using smartphone (NFC Tools app).

    But problem is that X-NUCLEO-NFC06A1 board can't read or write these tags, and so my phone in card emulating mode (using NFC Tool app). ​

    Technical Moderator
    March 19, 2021

    Hi VIVAN.1,

    One difference may be that the X-CUBE-NFCx demos are not swiss army knives with built-in knowledge for various available tags. They can read and write pre-formatted NFC Forum tags T2T, T3T, T4T and T5T. They can also format ST25(T/D)V tags as T5T.

    The NFC Tools app seems to be more of debugging tool with main support of NXP tags, e.g. not reading an SRTAG64K and not able to format ST25TV.

    You mentioned the NFC Tools app to be able to do card emulation. Didn't find this feature. Can you give me some guidance. Is this only available in Pro version?

    If an NTAG is formatted - has a correct CC (Capability container) then also our demos should be a able to read/write NDEF onto those tags. If this is not the case then please share it memory content (E.g. NFC Tools: Other -> Read memory).

    If a tag is properly formatted as NFC Forum tag then no app is needed to read it - Android will do it. In this case I expect also our X-CUBE-NFCx to read it.

    Best Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 19, 2021

    Hello Ulysses!

    I've tried to format (whatever it means in that case) my tags (NFС 1К s50 F08///716 Вytеs and ntаg213/137 Bytеs) by NFC Tools app but its failed, it doesn't support this tags.

    Yes, card emulation is available in Pro version, its in the WRITE menu --> ADDITIONAL OPTIONS.

    I also tried project named "STM32L476RG-Nucleo_PollingTagDetect" (without "Ndef" in the end). And have output:

    0693W000008xOVcQAM.png 

    ISO-DEP its my phone.

    OK Data: 6A82 it means that "Select NDEF Application" command failed (result must be 0x9000). See the code:

    0693W000008xOXiQAM.png 

    Technical Moderator
    March 19, 2021

    Hi,

    I don't have this Pro version and cannot try. However this code of 6A82 means that the NDEF applet is not supported.

    Similar to the T2T below I would try to use a second phone to read this emulated tag (Please make sure to de-activated Android Beam and if available on your mobile settings switch to Card Emulation mode only option)

    Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 19, 2021

    I copied content of my clean tag.

    0693W000008xOg6QAE.jpgmemory content is:

    [ 53:99:92:D0 ] Сектор 00 : DATA

    [ 34:01:D7:C0 ] Сектор 01 : DATA

    [ 22:48:00:00 ] Сектор 02 : DATA

    [ E1:10:12:00 ] Сектор 03 : DATA

    [ 01:03:A0:0C ] Сектор 04 : DATA

    [ 34:03:00:FE ] Сектор 05 : DATA

    [ 00:00:00:00 ] Сектор 06 : DATA

    [ 00:00:00:00 ] Сектор 07 : DATA

    [ 00:00:00:00 ] Сектор 08 : DATA

    [ 00:00:00:00 ] Сектор 09 : DATA

    [ 00:00:00:00 ] Сектор 0A : DATA

    [ 00:00:00:00 ] Сектор 0B : DATA

    [ 00:00:00:00 ] Сектор 0C : DATA

    [ 00:00:00:00 ] Сектор 0D : DATA

    [ 00:00:00:00 ] Сектор 0E : DATA

    [ 00:00:00:00 ] Сектор 0F : DATA

    [ 00:00:00:00 ] Сектор 10 : DATA

    [ 00:00:00:00 ] Сектор 11 : DATA

    [ 00:00:00:00 ] Сектор 12 : DATA

    [ 00:00:00:00 ] Сектор 13 : DATA

    [ 00:00:00:00 ] Сектор 14 : DATA

    [ 00:00:00:00 ] Сектор 15 : DATA

    [ 00:00:00:00 ] Сектор 16 : DATA

    [ 00:00:00:00 ] Сектор 17 : DATA

    [ 00:00:00:00 ] Сектор 18 : DATA

    [ 00:00:00:00 ] Сектор 19 : DATA

    [ 00:00:00:00 ] Сектор 1A : DATA

    [ 00:00:00:00 ] Сектор 1B : DATA

    [ 00:00:00:00 ] Сектор 1C : DATA

    [ 00:00:00:00 ] Сектор 1D : DATA

    [ 00:00:00:00 ] Сектор 1E : DATA

    [ 00:00:00:00 ] Сектор 1F : DATA

    [ 00:00:00:00 ] Сектор 20 : DATA

    [ 00:00:00:00 ] Сектор 21 : DATA

    [ 00:00:00:00 ] Сектор 22 : DATA

    [ 00:00:00:00 ] Сектор 23 : DATA

    [ 00:00:00:00 ] Сектор 24 : DATA

    [ 00:00:00:00 ] Сектор 25 : DATA

    [ 00:00:00:00 ] Сектор 26 : DATA

    [ 00:00:00:00 ] Сектор 27 : DATA

    [ 00:00:00:BD ] Сектор 28 : DATA

    [ 04:00:00:FF ] Сектор 29 : DATA

    [ 00:05:00:00 ] Сектор 2A : DATA

    [ 00:00:00:00 ] Сектор 2B : DATA

    [ 00:00:00:00 ] Сектор 2C : DATA

    Technical Moderator
    March 19, 2021

    Hi,

    this one seems to be a tag from Shanghai Feiju Microelectronics (Manufacturer 0x53). Not a real NTAG but claims to be compatible to NFC Forum T2T. The memory contents looks correct from first glimpse, should be detected as T2T. However I would need to perform some experiments and it can also be that the tag content may be correct but on the RF layer it does not comply (timings, etc.).

    If you write e.g. an URI to it and present it to an Android phone without any app opened, does it then ask to open the web page?

    Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 19, 2021

    sorry, don't know how to hide in a spoiler here...

    WladimirAuthor
    Visitor II
    March 19, 2021

    and another tag

    0693W000008xOilQAE.jpg[ 36:80:2A:30:AC:08:04:00:02:97:10:99:8C:B4:C7:1D ] Сектор 00 : UID0-UID3 / MANUFACTURER

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 01 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 02 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 03 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 04 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 05 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 06 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 07 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 08 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 09 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 0A : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 0B : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 0C : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 0D : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 0E : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 0F : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 10 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 11 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 12 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 13 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 14 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 15 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 16 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 17 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 18 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 19 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 1A : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 1B : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 1C : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 1D : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 1E : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 1F : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 20 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 21 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 22 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 23 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 24 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 25 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 26 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 27 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 28 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 29 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 2A : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 2B : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 2C : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 2D : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 2E : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 2F : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 30 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 31 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 32 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 33 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 34 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 35 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 36 : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 37 : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 38 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 39 : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 3A : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 3B : KEYA / ACCESS / KEYB

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 3C : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 3D : DATA

    [ 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 ] Сектор 3E : DATA

    [ 00:00:00:00:00:00:FF:07:80:69:FF:FF:FF:FF:FF:FF ] Сектор 3F : KEYA / ACCESS / KEYB

    Technical Moderator
    March 19, 2021

    Hi,

    this tag looks like a Mifare Classic tag or a clone of it. This type of tag uses a proprietary and in the meantime broken crypto. It is not part of NFC Forum, however on some phones (typically with NXP NFC chipset) it is supported. I cannot recommend to use such tags.

    If you look around in this community you will find further hints on it.

    Regards, Ulysses

    WladimirAuthor
    Visitor II
    March 19, 2021

    Hi,

    can you tell what Android app is able to data exchanging with X-NUCLEO-NFC06A1?

    I actually need not tags (tags for practice, its useful:) ) but data exchange (read and write) between phone and ST NFC board. P2P mode - the best option for me)

    I've tried "NDEF Tag emulator" android app and magic happens - "READ-ONLY NDEF detected." See picture below.

    But read-only doesn't fit to me, i need read and write capabylities.

    Here is the output:

    Initialization succeeded..

    1. Tap a tag to read its content

    NFCA Passive ISO-DEP device found. UID: 080630C2

    NDEF NOT DETECTED (ndefPollerNdefDetect returns 4)

    Operation completed

    Tag can be removed from the field

    1. Tap a tag to read its content

    NFCA Passive ISO-DEP device found. UID: 083B0C62

    READ-ONLY NDEF detected.

    NDEF Capability Container

     * CCLEN: 15 T4T_VNo: 20h MLe: 59 MLc: 52 FileId: e104h FileSize: 4095

     * readAccess: 00h writeAccess: ffh

     CC File Raw Data (length 15)

     [0000] 00 0F 20 00 3B 00 34 04 | . .  . ; . 4 . |

     [0008] 06 E1 04 0F FF 00 FF  | . . . . . . .  |

    NDEF Len: 21, Offset=2

     NDEF Content (length 21)

     [0000] D1 01 11 54 02 65 6E 48 | . . . T . e n H |

     [0008] 65 6C 6C 6F 20 57 6F 72 | e l l o  W o r |

     [0010] 6C 64 21 21 20     | l d ! !     |

    Decoding NDEF message

    Record #1 - Short Record

     Text: "Hello World!! " (UTF8, language code "en")

     MB ME CF SR IL TNF

     1 1 0 1 0  1

     Type Name Format: NFC Forum well-known type [NFC RTD]

     Type: "T"

     Payload: (length 17)

     [0000] 02 65 6E 48 65 6C 6C 6F | . e n H e l l o |

     [0008] 20 57 6F 72 6C 64 21 21 |  W o r l d ! ! |

     [0010] 20           |         |

    Operation completed

    Tag can be removed from the field

    1. Tap a tag to read its content

    I will answer on your other questions later. appreciate for your help

    WladimirAuthor
    Visitor II
    March 19, 2021

    Another question - how can I use Emulate Card Mode​ on X-NUCLEO-NFC06A1 board?

    Technical Moderator
    March 19, 2021

    Hi,

    X-CUBE-NFC6 supports card emulation. However if you use a phone which does act as Reader/Writer and as card against another device which acts also in both roles it is somewhat random which one ends up in which mode. In X-CUBE-NFC6 you could remove all PCD/reader/writer modes from techs2find param. Or use the bluetooth pairing demo in STSW-ST25R-LIB. The demo is built to not require any app on the phone but rather rely on the built-in NFC forum support of Android.

    For P2P: Its support is disappearing in recent phones. Iphone never adopted and recent Android phones are dropping it (e.g. Samsung Galaxy S20, S21, Pixel, etc. ).

    Reading through your requests it does not look like that you are interested in NDEF itself. But rather you want a bi-directional communication with phones. If this is true then I would implement an own protocol based on smartcard/ISODEP. Create an Android app similar to above mentioned "NDEF Tag Emulator". Register it with your own Application ID in the system. Then on top of ISODEP you can exchange arbitrary APDUs (You may want to follow ISO7816 (-4ff ) style).

    On X-NUCLEO-NFC06 I would use the polling for NFC-A and maybe NFC-B, use the example for reading T4T but instead reading NDEF, select your own application ID (defined above) and implement the counter part of your protocol.

    An example which could help you on Android side is the SwipeYours app. Its source code is available and it implements VISA payment as example. But you should be able to easily exchange the payment part with your own stuff.

    Best Regards, Ulysses