cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from NFC tag with MB1054B board

Kenadams
Associate II

Hello, 

I am using MB1054B board with STSW-95HF002 software package to develop my own application to read ISO14443A NFC tag. In the STSW-95HF002 software package there are several functions that read/write data from the tag. But the data read from the tag is all in numbers. 

The NFC tag I am reading is sending a character string as data. I can read the data using STSW-95HF001 development software but when I tried reading it from the my own program using CR95HF.dll, the data I get is all in numbers. How can I interpret that data to exactly re-form the character string? Can you direct me to some resources which you can refer to me? Any short example codes? 🙂 

My another concern is, do I have to always Initialize, config, increase demo gain, etc to read the NFC tag? Each time I want to read the tag, do I have to follow these steps? Or is there any other way? 

Any help would be appreciated 🙂

best,

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

As far as I know, there is only one API function that transceives data with a tag: CR95HFDll_SendReceive (and eventually the CR95HFDll_STCmd which is basically a transparent mode). The others functions are used to configure a given protocol (e.g. CR95HFDll_Select), read/write CR95HF registers, etc. The CR95HF is basically an RF FrontEnd: once you have selected a protocol (i.e. once a modulation type has been chosen), the CR95HF will send your data to tag and will wait for the response from the tag and will return it to you. This is achieved thanks to the sendRcvd command (see the ST25R95/CR95HF datasheet for a precise description of this command). This is this SendRcvd command that is "exported" inside the DLL through the CR95HFDll_SendReceive command.

The CR95HFDll_SendReceive command will send your data to the tag and will return the response from the tag. The data you are sending to the tag are supposed to follow one of the NFC standards such as ISO14443A. This means that you need to know the ISO14443A standard to format your data accordingly and to decode the response accordingly. This can be tricky if a type 4 tag is used but more simple in case of type 2.

The initialization should done only once when starting your application. The increase demo gain, etc are not needed for your purpose. Then start your polling loop: Set the field on (protocolSelect), make sure to wait for the proper guard time and then send the REQA (sendRvcd). Once a ATQA has been received, send the various anticollision frames- (sendRcvd). Then for a type 2 tag you can easily reads blocks of the tag memory. Once completed, set the field off and restart your polling loop

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Brian TIDAL
ST Employee

Hi,

As far as I know, there is only one API function that transceives data with a tag: CR95HFDll_SendReceive (and eventually the CR95HFDll_STCmd which is basically a transparent mode). The others functions are used to configure a given protocol (e.g. CR95HFDll_Select), read/write CR95HF registers, etc. The CR95HF is basically an RF FrontEnd: once you have selected a protocol (i.e. once a modulation type has been chosen), the CR95HF will send your data to tag and will wait for the response from the tag and will return it to you. This is achieved thanks to the sendRcvd command (see the ST25R95/CR95HF datasheet for a precise description of this command). This is this SendRcvd command that is "exported" inside the DLL through the CR95HFDll_SendReceive command.

The CR95HFDll_SendReceive command will send your data to the tag and will return the response from the tag. The data you are sending to the tag are supposed to follow one of the NFC standards such as ISO14443A. This means that you need to know the ISO14443A standard to format your data accordingly and to decode the response accordingly. This can be tricky if a type 4 tag is used but more simple in case of type 2.

The initialization should done only once when starting your application. The increase demo gain, etc are not needed for your purpose. Then start your polling loop: Set the field on (protocolSelect), make sure to wait for the proper guard time and then send the REQA (sendRvcd). Once a ATQA has been received, send the various anticollision frames- (sendRcvd). Then for a type 2 tag you can easily reads blocks of the tag memory. Once completed, set the field off and restart your polling loop

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hey Brian, thanks for your reply. Well I have a Type 2 Tag and would need some direction for decoding the data received from the CR95HFDll_SendReceive command. Could you please point me to a source/reference for decoding? 

 

And is it like, the data I receive is in this form, 80155F7C72D9F2499DC4E203FFFFE1107C0FC4CD080000,

I am sure there is some header and footer for this frame of data but the remaining numbers after removing the header and footer is something like this F7C72D9F2499DC4E203FFFFE1107C0FC4CD0,  so I just want to know that I have to decode this particular part of the frame right? Can you please correct me if I am wrong? 

best,

Brian TIDAL
ST Employee

Hi,

it is somehow challenging to decode a tag response without having the request. Anyway I assume you have sent a T2T Read Block #0 request. When receiving this command the tag returns the memory content of block #0 to #3 (a read block always return 4 blocks of memory) plus a 2 bytes CRC.

The received payload is 5F7C72D9F2499DC4E203FFFFE1107C0FC4CD (this is the part between the 8015 response code+len and the 080000 reception flags):

5F7C72D9 Block #0 Internal
F2499DC4 Block #1 Internal
E203FFFF Block #2 Internal/Lock
E1107C0F Block #3 Capability Container
C4CD     CRC

See the tag manufacturer datasheet for the description of the content of each of these blocks or have a look on Data format from their website.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.