NFC Ultralite

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

NFC Ultralite

14,396 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

4,822 Views
deepanrajanbara
Contributor IV

Thank you This code seemed to format my ultralight card and now am able to read and write to my card.

But we have another Classic card which need to be formatted But the code changes only seemed to format ultralight cards.

0 Kudos
Reply

4,822 Views
jeremygeslin
NXP Employee
NXP Employee

Great to hear tat the Utralight issue is fixed now in your side.

Regarding MIFARE Classic, indeed the changes provided only impact Ultralight.

For deeper analysis, please provide logs same as before with Ultraligh. But pay attention that if the keys on the card have been previously changed the application won't be able to format the card (not knowing the keys used).

0 Kudos
Reply

4,822 Views
deepanrajanbara
Contributor IV

Does this library support Desfire card ?

0 Kudos
Reply

4,822 Views
jeremygeslin
NXP Employee
NXP Employee

I confirm the current library does support MIFARE Classic and MIFARE DesFire cards ... but not the NDEF Formatting of such cards.

0 Kudos
Reply

4,822 Views
deepanrajanbara
Contributor IV

Can you please check the log regarding the formating of Classic card and provide me update for the code

0 Kudos
Reply

4,822 Views
jeremygeslin
NXP Employee
NXP Employee

Please find attached updated demoApp formating MIFARE Classic code prior to the write NDEF operation.

Pay attention that formating can only success if card is in factory state (factory default keys).

0 Kudos
Reply

4,823 Views
deepanrajanbara
Contributor IV

when we are formatting we are getting "Mifare Formating failed" error.

Even Our Desfire card is not able write/read we think it is same issue as that for formatting the card.Please check the log attached with respect to the desfire card.

Thank you,

Deepanraj.A

0 Kudos
Reply

4,823 Views
jeremygeslin
NXP Employee
NXP Employee

All those MIFARE cards management is quite huge to be implemented. I would suggest you to use existing open source libfreefare for such application: GitHub - nfc-tools/libfreefare: A convenience API for NFC cards manipulations on top of libnfc. 

This libfreefare library runs on top of open source libnfc library. You can refer to the project I forked which includes support for the PN7120 via the Linux_libnfc-nci library: GitHub - jgeslin/libnfc: Platform independent Near Field Communication (NFC) library .

First of all the libnfc-nci must have been installed in the environment (sudo make install) and LD_LIBRARY_PATH environment must reflect the library installation patch (/usr/local/lib).

After cloning the jgeslin/libnfc repository run the following commands:

autoreconf -vis

./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn71xx

make

sudo make install

export LIBNFC_INTRUSIVE_SCAN=true

Pn7120 should be visible when running command:

nfc-scan-device -v

Then, after installing libfreefare, you shall be able to use related commands like:

mifare-desfire-format

mifare-classic-format

...

0 Kudos
Reply

4,823 Views
deepanrajanbara
Contributor IV

But this libfreefare and libnfc opensource use USB to check with cards.we have cross-compiled  it for imx6 But when we execute the command we are getting

info    libnfc.config   Unable to open file: /usr/local/etc/nfc/libnfc.conf
debug   libnfc.config   Unable to open directory: /usr/local/etc/nfc/devices.d
debug   libnfc.general  log_level is set to 3
debug   libnfc.general  allow_autoscan is set to true
debug   libnfc.general  allow_intrusive_scan is set to true
debug   libnfc.general  0 device(s) defined by user
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM6 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM5 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM4 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM3 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM2 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM1 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.driver.arygon    Trying to find ARYGON device on serial port: /dev/ttyACM0 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.bus.uart TX: 30 61 72
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.arygon    No reply to 'reset TAMA' command.
debug   libnfc.general  0 device(s) found using arygon driver
debug   libnfc.driver.pn532_i2c Trying to find PN532 device on I2C bus /dev/i2c-1.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 14 01 17 00
error   libnfc.bus.i2c  Error: wrote only -1 bytes (10 expected).
error   libnfc.driver.pn532_i2c Unable to transmit data. (TX)
debug   libnfc.driver.pn532_i2c Trying to find PN532 device on I2C bus /dev/i2c-0.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 14 01 17 00
error   libnfc.bus.i2c  Error: wrote only -1 bytes (10 expected).
error   libnfc.driver.pn532_i2c Unable to transmit data. (TX)
debug   libnfc.general  0 device(s) found using pn532_i2c driver
debug   libnfc.general  0 device(s) found using pn532_spi driver
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM6 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM5 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM4 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM3 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM2 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM1 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.driver.pn532_uart        Trying to find PN532 device on serial port: /dev/ttyACM0 at 115200 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 115200 baud.
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.uart Timeout!
debug   libnfc.driver.pn532_uart        Unable to read ACK
debug   libnfc.general  0 device(s) found using pn532_uart driver
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM6 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM5 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM4 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM3 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM2 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM1 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.driver.acr122s   Trying to find ACR122S device on serial port: /dev/ttyACM0 at 9600 baud.
debug   libnfc.bus.uart Serial port speed requested to be set to 9600 baud.
debug   libnfc.general  0 device(s) found using ACR122S driver
debug   libnfc.general  0 device(s) found using acr122_usb driver
debug   libnfc.general  0 device(s) found using pn53x_usb driver
nfc-mfultralight: ERROR: Error opening NFC device

Do you know on  how to make it read through i2c

0 Kudos
Reply

4,823 Views
jeremygeslin
NXP Employee
NXP Employee

If properly configured, the libnfc will enumerate PN7120 through tthe libnfc-nci library.

Did you take the libnfc source from my forked project https://github.com/jgeslin/libnfc.git ? Because PN7120 support is not yet included in formal libnfc git repository.

Then what the result of the libnfc build with pn71xx driver option ?

autoreconf -vis

./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn71xx

make

sudo make install

export LIBNFC_INTRUSIVE_SCAN=true

0 Kudos
Reply

4,823 Views
deepanrajanbara
Contributor IV

Now this application we have cross compiled and when "mifare-desfire-format" is given it is able to format the card but when we try to write using the demo app its  not able to write to my card

 NFC Tag Found

                Type :          'Type A'
                NFCID1 :        '04 43 5C C9 92 26 80 '
                NDEF Content : NO

        Not a MIFARE card

It gives the below message when we try to write content

0 Kudos
Reply

4,823 Views
jeremygeslin
NXP Employee
NXP Employee

Indeed the "mifare-desfire-format" tool is factory fromatting the DesFire card. To NDEF format it you shall use "mifare-desfire-create-ndef". Then later you can use nfcDemoApp to write any NDEF data in it.

0 Kudos
Reply

4,823 Views
deepanrajanbara
Contributor IV

Thank you,Now it seemed to work with desfire card after formatting ndef

0 Kudos
Reply

4,822 Views
deepanrajanbara
Contributor IV

Actualy for our Classic card the key is 0xFF for all.For this any changes is required ?

0 Kudos
Reply

4,822 Views
jeremygeslin
NXP Employee
NXP Employee

Please provide log related to MIFARE Classic formating failing case for deeper analysis.

0 Kudos
Reply

4,821 Views
deepanrajanbara
Contributor IV

I have attached the log for classic card when the formatting fails

0 Kudos
Reply

4,821 Views
jeremygeslin
NXP Employee
NXP Employee

In the log are missing the NCI exchange (NxpNciX and NxpNciR) required for analysis.

You probably disabled it in libnfc-nxp.conf file (NXPLOG_NCIX_LOGLEVEL and NXPLOG_NCIR_LOGLEVEL parameters).

0 Kudos
Reply

4,821 Views
deepanrajanbara
Contributor IV

Please find the log attached

0 Kudos
Reply

4,820 Views
jeremygeslin
NXP Employee
NXP Employee

In the log I can see that writing to the block 1 (sector 0) is failing. Please run the same and provide logs with attached updated demoApp which read first the sector 0 in order to understand why the write is failing.

0 Kudos
Reply

4,820 Views
deepanrajanbara
Contributor IV

Please find the log attached

0 Kudos
Reply

4,820 Views
jeremygeslin
NXP Employee
NXP Employee

Please apply attached patch and run the same.

0 Kudos
Reply