From bda57d3818b70046e2eb20d107c2a532c5ee4ab8 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 6 Jul 2018 17:20:02 +0200 Subject: [PATCH] chg:i2c... --- common/i2c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/i2c.c b/common/i2c.c index e5ac9dc84..c0e92fd30 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -134,6 +134,7 @@ bool WaitSCL_L_300ms(void){ volatile uint16_t delay = 300; while ( delay-- ) { + // exit on SCL LOW if (!SCL_read) { if ( MF_DBGLEVEL > 3 ) Dbprintf(" 300ms SCL delay counter %d", delay); return true; @@ -531,13 +532,13 @@ bool GetATR(smart_card_atr_t *card_ptr) { I2C_WriteCmd(I2C_DEVICE_CMD_GENERATE_ATR, I2C_DEVICE_ADDRESS_MAIN); // variable delay here. - if (!WaitSCL_300ms()) { + if (!WaitSCL_L_300ms()) { if ( MF_DBGLEVEL > 3 ) DbpString(" 300ms SCL delay - timed out"); return false; } // 8051 speaks with smart card. - // 1000*50*3.07 = 1530.5ms + // 1000*50*3.07 = 153.5ms if (!WaitSCL_H_delay(1000*50) ) { if ( MF_DBGLEVEL > 3 ) DbpString("wait for SCL HIGH - timed out"); return false;