NFC Ultralite

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NFC Ultralite

6,921 Views
deepanrajanbara
Contributor IV

Hi,

We are testing NFC with Mifare UL card and the application we are using is provided by NXP .When testing Ultralite using NXP demo application we are not able to read any data or write data.But when we try to read Classic card we are able to read and write.I noticed that there is a parameter which is described in libnfc-nxp.conf i.e "MIFARE_READER_ENABLE" which is set as 0x01 for Mifare classic card.But what is the parameter to be set in order for us to read or write Ultralite card.Please Reply as soon as possible as am not getting support from anybody

Thank you,

Deepanraj.A

51 Replies

2,717 Views
deepanrajanbara
Contributor IV

we are using PN1720 and our Environment is Linux.The software package we are using is linux-nfc provided by nxp R2.1.

Example is the demo app which is present in the library and the command nxp provided library. In imx6 platform and we are referring AN11697.pdf  i.e PN71x0 Linux Software Stack Integration Guidelines

Thank you,

Deepanraj.A

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

Hi Deepanraj,

To send command to a MIFARE UL you can use nfcTag_transceive API of the library to send "raw" command to a card.

Please find attached an update of the demoapp delivered as part of the linux_libnfc-nci library demonstrating a "READ" command on MIFARE UL card when it is not NDEF compliant (see about line 1385).

Regards,

Jeremy Geslin.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

Hi,

The changes you have done in the demo app.if it is applied is it possible to read and write data to ultralight card.

Thank you,

Deepanraj.A

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

Hi,

The changes done to the demo app are only showing how to read a MIFARE UL sector. For writing you can use exact same API to send command such "WRITE", in this case the buffer to be send should looks like {0xA2, block address, 4 bytes of data to write} (e.g. {0xA2, 0x04, 0x11, 0x22, 0x22, 0x44} will write block 4 with data 11223344).

Regards,

Jeremy.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

Hi,

For writing you have mentioned the buffer did you mean  MifareAuthCmd in the demo app or is it any other buffer you are mentioning and is there any thing need to be set in libnfc-nxp.conf i.e the value of MIFARE_READER_ENABLE for reading Ultralight.

Thank you,

Deepanraj.A

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

Just create you own buffer and use it for instance:

unsigned char MifareWriteCmd[] = {0xA2, 0x04, 0x11, 0x22, 0x22, 0x44};

unsigned char RespBuf[255];

nfcTag_transceive(TagInfo.handle, MifareWriteCmd, sizeof(MifareWriteCmd), RespBuf, sizeof(RespBuf), 500);

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

Hi,

Is it possible to format my card to NDEF format using this demo app ?

or,

Is there any other application available to format NFC cards in Linux

Thank you,

Deepanraj.A

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

nfcDemoApp "write" option actually format the tag if is is not yet NDEF and if NDEF formatting is supported.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

But When we give "write" command still it is telling NDEF content as NO . Is there a way to write NDEF content to my classic or Ultralite card ?

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

nfcDemoApp "write" option should, unless your card doesn't support formatting.

To verify this, please enable more traces (in /etc/libnfc-nxp.conf file, update NXPLOG_NCIX_LOGLEVEL and NXPLOG_NCIR_LOGLEVEL to value 0x03) and provide related logs.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

Please refer the log which i have attached when i give the "write" command with the log status in ".conf" file set to 0X03

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

Indeed the existing nfcDemoApp doesn't perform write operation whenever the tag is not already NDEF formatted.

Please find update attached.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

Hi,

I just updated the code which you have provided but this too seemed to fail when it is writing.

please find the attached log file for further details

0 Kudos

2,717 Views
jeremygeslin
NXP Employee
NXP Employee

There is a bug in the Linux_libnfc-nci stack related to this specific case.

Please apply attached patch.

0 Kudos

2,717 Views
deepanrajanbara
Contributor IV

After applying the patch which you have provided we face the same issue.Here is the log attached

0 Kudos

2,711 Views
jeremygeslin
NXP Employee
NXP Employee

This is strange since I thought I was able to reproduce the exact same issue you reported for which the patch fixed the problem.

For deeper analysis, please activate more traces by setting parameter "ENABLE_API_TRACES" to "TRUE" (inside src\halimpl\pn54x\log\phNxpLog.h).

0 Kudos

2,712 Views
deepanrajanbara
Contributor IV

Here i have attached the log when "ENABLE_API_TRACES"  is set to "TRUE". Please check and provide a solution

0 Kudos

2,712 Views
jeremygeslin
NXP Employee
NXP Employee

I see from the trace that your tag is not blank (block4 = 11 22 22 44).

The format function of the library only works if tag is factory initialized (block 4=FF FF FF FF).

If you have an NFC android smartphone you can format the tag to factory state (using NXP TagWriter application for instance). Otherwise I can provide you updated demoApp to handle this case.

0 Kudos

2,712 Views
deepanrajanbara
Contributor IV

Can you please share the updated demo app source code so that it will be easy for us to test here

0 Kudos

2,712 Views
jeremygeslin
NXP Employee
NXP Employee

Please find attached updated demoApp clearing block 4 of MIFARE UL card to allow proper NDEF format operation during NDEF write scenario.

0 Kudos