Issue 257 in libnfc: Problem with init of ISO14443B2SR

54 views
Skip to first unread message

lib...@googlecode.com

unread,
Aug 25, 2013, 7:07:49 PM8/25/13
to libnfc...@googlegroups.com
Status: New
Owner: yob...@gmail.com
Labels: Type-Defect Priority-Medium

New issue 257 by yob...@gmail.com: Problem with init of ISO14443B2SR
http://code.google.com/p/libnfc/issues/detail?id=257

cf http://www.libnfc.org/community/post/4702

I tried this code:
nfc_target ant[1];
nfc_modulation nm = {
.nmt = NMT_ISO14443B2SR,
.nbr = NBR_106
};
nfc_initiator_list_passive_targets(pnd,nm,ant,1);
printf("%s\n",nfc_strerror(pnd)); // print RF Transmission Error
also with this I receive error: RF Transmission Error
but with this code got Success.
nfc_target ant[1];
nfc_modulation nm = {
.nmt = NMT_ISO14443B,
.nbr = NBR_106
};
nfc_initiator_list_passive_targets(pnd,nm,ant,1);
printf("%s\n",nfc_strerror(pnd)); // print Success

nfc_target ant2[1];
nfc_modulation nm2 = {
.nmt = NMT_ISO14443B2SR,
.nbr = NBR_106
};
nfc_initiator_list_passive_targets(pnd,nm2,ant2,1);
printf("%s\n",nfc_strerror(pnd)); // print Success
Why I need to execute a nfc_initiator_list_passive_targets with
NMT_ISO14443B?
Is it a bug? Is there another way to initiliatize the comunication with tag
ISO14443B?


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

lib...@googlecode.com

unread,
Aug 25, 2013, 7:11:09 PM8/25/13
to libnfc...@googlegroups.com
Updates:
Status: Accepted

Comment #1 on issue 257 by yob...@gmail.com: Problem with init of
ISO14443B2SR
http://code.google.com/p/libnfc/issues/detail?id=257

This is a known problem.
nfc_initiator_list_passive_targets() for ISO14443B is calling a polling
command from the PN53x firmware which sets internal registers properly.

nfc_initiator_list_passive_targets() for ISO14443B2SR does not rely on such
command in the firmware because there is no such command.
The problem is that it does not setup the internal registers properly, so
nfc_initiator_list_passive_targets() for ISO14443B2SR works when following
nfc_initiator_list_passive_targets() for ISO14443B but not alone.

To solve the issue some reverse-engineering is needed to understand how
internal registers of PN53x should be prepared.

lib...@googlecode.com

unread,
Jan 5, 2015, 7:38:31 AM1/5/15
to libnfc...@googlegroups.com

Comment #2 on issue 257 by tonn...@gmail.com: Problem with init of
ISO14443B2SR
https://code.google.com/p/libnfc/issues/detail?id=257

Hello! Since there's no documentation at all, once the target is opened
(thanks for the code) how to read/write ISO14443B2SR card data?

I see that with ISO14443A examples, there's a CRC, anticollision methods
and transceive bits. This apply also with ISO14443B2SR?

A simple example would be great!!


This is my code (opens target and prints UID):


// To compile this simple example:
// $ gcc -o quick_start_example1 quick_start_example1.c -lnfc
// ./quick_start_example1

#include <stdlib.h>
#include <nfc/nfc.h>

void print_nfc_target(const nfc_target *pnt, bool verbose)
{
char *s;
str_nfc_target(&s, pnt, verbose);
printf("%s", s);
nfc_free(s);
}

int main(int argc, const char *argv[])
{
nfc_device *pnd;
nfc_target nt;

// Allocate only a pointer to nfc_context
nfc_context *context;

// Initialize libnfc and set the nfc_context
nfc_init(&context);
if (context == NULL) {
printf("Unable to init libnfc (malloc)\n");
exit(EXIT_FAILURE);
}

// Display libnfc version
const char *acLibnfcVersion = nfc_version();
(void)argc;
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);

// Open, using the first available NFC device
pnd = nfc_open(context, NULL);

if (pnd == NULL) {
printf("ERROR: %s\n", "Unable to open NFC device.");
exit(EXIT_FAILURE);
}
// Set opened NFC device to initiator mode
if (nfc_initiator_init(pnd) < 0) {
nfc_perror(pnd, "nfc_initiator_init");
exit(EXIT_FAILURE);
}

printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));

nfc_target ant[1];
nfc_modulation nm;
nm.nmt = NMT_ISO14443B;
nm.nbr = NBR_106;

nfc_initiator_list_passive_targets(pnd,nm,ant,1);
printf("%s\n",nfc_strerror(pnd)); // print Success

nfc_target ant2[1];
nfc_modulation nm2;
nm2.nmt = NMT_ISO14443B2SR;
nm2.nbr = NBR_106;

int res = 0;
int n = 0;
res = nfc_initiator_list_passive_targets(pnd, nm2, ant2, 1);
printf("%s\n",nfc_strerror(pnd)); // print Success

// printf("Cart identifier: %s\n", nt.nti.nsi.abtUID);
for (n = 0; n < res; n++) {
print_nfc_target(&ant2[n], true);
printf("\n");
}

// Close NFC device
nfc_close(pnd);
// Release the context
nfc_exit(context);
exit(EXIT_SUCCESS);
Reply all
Reply to author
Forward
0 new messages