X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/a9104f7e31d6c134f9772fef6df2156ed06c9e78..01aa068b6ff34d86dd5d9d9e962aba20cd490050:/armsrc/i2c.c diff --git a/armsrc/i2c.c b/armsrc/i2c.c index 7ef0c9c0..3d16b42c 100644 --- a/armsrc/i2c.c +++ b/armsrc/i2c.c @@ -18,6 +18,7 @@ #include "mifareutil.h" // for MF_DBGLEVEL #include "BigBuf.h" #include "apps.h" +#include "usb_cdc.h" #ifdef WITH_SMARTCARD #include "smartcard.h" @@ -257,10 +258,11 @@ static void I2C_Reset_EnterBootloader(void) { WaitMS(10); } -// Wait max 300ms or until SCL goes LOW. +// Wait max 1800ms or until SCL goes LOW. +// It timeout reading response from card // Which ever comes first -static bool WaitSCL_L_300ms(void) { - volatile uint16_t delay = 310; +bool WaitSCL_L_timeout(void){ + volatile uint16_t delay = 1800; while ( delay-- ) { // exit on SCL LOW if (!SCL_read) @@ -272,8 +274,8 @@ static bool WaitSCL_L_300ms(void) { } static bool I2C_WaitForSim() { - // variable delay here. - if (!WaitSCL_L_300ms()) + // wait for data from card + if (!WaitSCL_L_timeout()) return false; // 8051 speaks with smart card.