From 732c012be776df237ac97faaeaa3c2767478b023 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 10 Apr 2020 10:27:28 +0200 Subject: [PATCH] adjustments --- armsrc/iso14443a.c | 4 +++- armsrc/iso14443b.c | 10 +++++++--- armsrc/mifaredesfire.c | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 23b3a2239..f789d87c6 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -2672,8 +2672,10 @@ void ReaderIso14443a(PacketCommandNG *c) { uint8_t buf[PM3_CMD_DATA_SIZE] = {0x00}; uint8_t par[MAX_PARITY_SIZE] = {0x00}; - if ((param & ISO14A_CONNECT)) + if ((param & ISO14A_CONNECT)) { + iso14_pcb_blocknum = 0; clear_trace(); + } set_tracing(true); diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index 31f2cae58..10beb4489 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -29,7 +29,7 @@ # define FWT_TIMEOUT_14B 35312 #endif #ifndef ISO14443B_DMA_BUFFER_SIZE -# define ISO14443B_DMA_BUFFER_SIZE 256 +# define ISO14443B_DMA_BUFFER_SIZE 512 //changed this from 256 #endif #ifndef RECEIVE_MASK # define RECEIVE_MASK (ISO14443B_DMA_BUFFER_SIZE-1) @@ -37,7 +37,7 @@ // Guard Time (per 14443-2) #ifndef TR0 -# define TR0 0 +# define TR0 32 //this value equals 8 ETU = 32 ssp clk (w/ 424 khz) #endif // Synchronization time (per 14443-2) @@ -261,6 +261,10 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) { // 80/fs < TR1 < 200/fs // 10 ETU < TR1 < 24 ETU + // Send TR1. + // 10-11 ETU * 4times samples ONES + for (int i = 0; i < 10; i++) { SEND4STUFFBIT(1); } + // Send SOF. // 10-11 ETU * 4times samples ZEROS for (int i = 0; i < 10; i++) { SEND4STUFFBIT(0); } @@ -307,7 +311,7 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) { //for(i = 0; i < 10; i++) { ToSendStuffBit(0); } // why this? - for (int i = 0; i < 40; i++) { SEND4STUFFBIT(1); } + for (int i = 0; i < 2; i++) { SEND4STUFFBIT(1); } //for(i = 0; i < 40; i++) { ToSendStuffBit(1); } // Convert from last byte pos to length diff --git a/armsrc/mifaredesfire.c b/armsrc/mifaredesfire.c index ba2b20d2d..aa70e5ccb 100644 --- a/armsrc/mifaredesfire.c +++ b/armsrc/mifaredesfire.c @@ -117,6 +117,9 @@ void MifareDesfireGetInformation() { clear_trace(); set_tracing(true); iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); + + // reset the pcb_blocknum, + pcb_blocknum = 0; // card select - information if (!iso14443a_select_card(NULL, &card, NULL, true, 0, false)) {