2018-02-08 05:03 PM
Hi!
I working with ST25R3911DiscoComm.dll and writing in C/C++.
1. I sending 9370 and 9570 same as in your iso14443a_select_by_uid.py.
All is OK with them, both returns 0.
2. Next RATS:
char *rxRats = new char[1024];
for (int i = 0; i < 1024; i++) {
rxRats[i] = '\0';
}
size_t rxRatsSize = 0;
res = iso14443aRATS(h, 256, 0x1, rxRats, &rxRatsSize);
printf('%d\r\n', res);
printf('%d\r\n', rxRatsSize);
Also all OK, res = 0. But I cannot receive some response in rxRats therefore I have no idea about ds and dr parameters for PPS.
3. Next PPS (dr and ds just set to my mind's random 8):
printf('--- PPS: ---\r\n');
char *rxPPS = new char[1024];
for (int i = 0; i < 1024; i++) {
rxPPS[i] = '\0';
}
size_t rxPPSSize = 1024;
res = iso14443aPPS(h, 0x1, 8, 8, true, rxPPS, &rxPPSSize);
printf('%d\r\n', res);
printf('%d\r\n', rxPPSSize);
Also all OK, res = 0.
4. And now request:
printf('--- Req 3: ---\r\n');
pcb_t pcb;
pcb.b1 = 0; // Block number
pcb.b2 = 1;
pcb.b3 = 0; // is NAD set
pcb.b4 = 1; // is CID set
pcb.b5 = 0; // is Chaining
pcb.b6 = 0;
pcb.b7 = 0;
pcb.b8 = 0;
char *cl3 = new char[24];
cl3[0] = *(char*)&pcb;
cl3[1] = 0x1;
cl3[2] // 2-21 - some APDU command
unsigned char arr [] = { cl3[0], cl3[1], cl3[2], cl3[3], cl3[4], cl3[5], cl3[6], cl3[7], cl3[8], cl3[9], cl3[10]
, cl3[11], cl3[12], cl3[13], cl3[14], cl3[15], cl3[16], cl3[17], cl3[18], cl3[19], cl3[20], cl3[21]};
int crc16m = crc16(arr, 1, 0x6363, false);
cl3[22] = ((unsigned char *)(&crc16m))[1];
cl3[23] = ((unsigned char *)(&crc16m))[0];
sak = new char[256];
sak_size = 256;
for (int i = 0; i < 256; i++) {
sak[i] = '\0';
}
res = txrxBytes(h, cl3, 24, sak, &sak_size, &us);
printf('%d\r\n', res);
printf('|SS: %d|\r\n', sak_size);
for (int i = 0; i < sak_size; i++) {
printf('|s 0x%02hhx|\r\n', (unsigned char)sak[i]);
}
And in result I got sak_size = 14 bytes. I seing these bytes printf'ed in console, they are 100% correct? but 14 bytes is too few, this 'response' even haven't some status code (9000 or another).
I tried different combination of 2, 4 and 8 parameters in iso14443aPPS but no effect.
How should I fix it?
Solved! Go to Solution.
2018-02-09 06:04 AM
Hi Andrew,
I think we will need to improve here a bit the documentation of the DLL.
If this doesn't help you, then please provide a printout of all your sent and received bytes, length parameters and return codes.
Regards, Ulysses
2018-02-09 06:04 AM
Hi Andrew,
I think we will need to improve here a bit the documentation of the DLL.
If this doesn't help you, then please provide a printout of all your sent and received bytes, length parameters and return codes.
Regards, Ulysses