Index: yc_nfc/yc_emv_contactless_l1.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.h	(revision 726)
+++ /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.h	(working copy)
@@ -493,6 +493,8 @@
 uint8_t dc_cali_q(void);
 void force_dc_calc(void);
 void dc_cali_alg(uint8_t win_size);
+void atr_time_start(void);
+void timer0_enable(unsigned long num);
 
 typedef struct
 {
Index: yc_nfc/yc_emv_contactless_l1.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.c	(revision 726)
+++ /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.c	(working copy)
@@ -1,7 +1,7 @@
 #include "yc_emv_contactless_l1.h"
 
 /*
-//注意1：EMV_Transceive函数内各while超时退出时间是否满足要求。要实际测试，避免还没接收完成就退出。
+//注意1：EMV_Transceive函数中等待发送完成while超时退出时间为15ms，两处等待接收完成while超时退出时间为1s，RATS中while超时退出时间为1s.
 //注意2：typeB的调制深度寄存器REG_TX_PA_MOD_GAIN的值设置必须大于等于8
 //注意3：复位引脚由低到高后可以判断REG_PMU_STATE寄存器大于等于3时进行后续寄存器配置
 //注意4：增加上电DC矫正功能，用于量产时对每个芯片矫正。
@@ -51,7 +51,11 @@
 static unsigned char FWI;
 static unsigned char FSCI;
 static unsigned char Block_Num;
-
+uint32_t contact_over_time_cnt = 0;
+#define     CONTACT_OVER_TIME_VAL           1                          //量产中最大的接收、发送超时时间，设置为3S
+#define     CONTACT_OVER_TIME_CNT           contact_over_time_cnt       //量产中最大的接收、发送超时时间，设置为3S
+volatile unsigned int time0_cnt_last = 0;
+#define 	TIM0_CNT    TIM_CNT(0)
 const static unsigned short FSC_Table[] = {16, 24, 32, 40, 48, 64, 96,
                                            128, 256, 512, 1024, 2048, 4096
                                           };
@@ -283,6 +287,25 @@
     }
 }
 
+void timer0_enable(unsigned long num)
+{
+    TIM_InitTypeDef TIM_struct;
+
+    enable_clock(CLKCLS_TIM);
+
+    TIM_struct.period = num;
+    TIM_struct.TIMx = (TIM_NumTypeDef)0;
+    TIM_Init(&TIM_struct);
+    TIM_Cmd((TIM_NumTypeDef)0, ENABLE);
+}
+
+void atr_time_start(void)
+{
+    timer0_enable(0xffffffff);
+
+    contact_over_time_cnt = CONTACT_OVER_TIME_VAL*CPU_MHZ;
+}
+
 /**
   * @brief Interface of transceiving.
   * @param cmd: command
@@ -301,9 +324,12 @@
     unsigned short i = 0;
     unsigned char j = 0;
     unsigned char len = 0;
-    unsigned int t = 0, t2 = 0;
+    unsigned int t = 0;
     unsigned char err_flag = 0;
 
+	
+	time0_cnt_last = TIM0_CNT;
+
     if ((cmd != CMD_HLTA) && (!response || !responselen))
     {
         return EMV_ERR_PARA;
@@ -475,15 +501,17 @@
         }
     }
 
-    t2 = 0;
     while ((READREG(REG_IRQ0_STATE) & 0x08) == 0)
-    {
-        t2++;
-        if (t2 > W_TIME_OUT)
-        {
-            return EOT_SHOUT;
-        }
-    }
+	{
+		#ifndef EMV_L1_TEST
+		if((time0_cnt_last - TIM0_CNT) >=800000)
+		{
+			return EOT_SHOUT;
+		}
+		#endif
+	}
+	
+
 
     SETBITMASK(REG_IRQ0_CLEAR, 0x40);
     CLEARBITMASK(REG_IRQ0_CLEAR, 0x40);
@@ -492,11 +520,9 @@
     {
         return EMV_ERR_NONE;
     }
-
-    t2 = 0;
     while (1)
     {
-        t2++;
+       
         if ((READREG(REG_IRQ0_STATE) & 0x01) != 0)
         {
             return EMV_ERR_TIME_OUT;
@@ -514,18 +540,18 @@
             break;
         }
 
-        if (t2 > W_TIME_OUT)
+		#ifndef EMV_L1_TEST
+		if((time0_cnt_last - TIM0_CNT) >=contact_over_time_cnt)
         {
 
             return EOT_SHOUT;
         }
+		#endif
     }
-
-    t2 = 0;
     *responselen = 0;
     while ((READREG(REG_IRQ0_STATE) & 0x04) == 0)
     {
-        t2 ++;
+
         if ((READREG(REG_IRQ0_STATE) & 0x40) != 0)
         {
             for (i = 0; i < FIFO_LENGTH - WATER_LEVEL; i++)
@@ -552,10 +578,13 @@
             CLEARBITMASK(REG_IRQ0_CLEAR, 0x40);
         }
 
-        if (t2 > W_TIME_OUT)
+		#ifndef EMV_L1_TEST
+		if((time0_cnt_last - TIM0_CNT) >=contact_over_time_cnt)
         {
+
             return EOT_SHOUT;
         }
+		#endif
     }
 
     len = READREG(REG_FIFO_LENGTH);
@@ -1248,7 +1277,21 @@
                     WRITEREG(REG_T_CTRL, 0x01);
                     WRITEREG(REG_T_CTRL, 0x00);
 
-                    while ((READREG(REG_IRQ0_STATE) & 0x01) == 0);
+                    while ((READREG(REG_IRQ0_STATE) & 0x01) == 0)
+					{
+					
+						if((time0_cnt_last - TIM0_CNT) >=contact_over_time_cnt)
+							{
+								MyPrintf("SEND_TIMEOUT1000 = %x\n",contact_over_time_cnt);
+								// #ifdef DEBUG_7816
+								MyPrintf("SEND_TIMEOUT5\n");
+								//#endif
+								return EOT_SHOUT;
+							}
+					
+					
+					
+					}
                 }
             }
 
Index: yc_qspi.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_qspi.h	(revision 726)
+++ /YC3121_SDK/fw/sdk/yc_qspi.h	(working copy)
@@ -108,7 +108,7 @@
   * @param  none
   * @return none
   */
-void app_enable_download();
+void app_enable_download(void);
 
 
 /**
@@ -116,7 +116,7 @@
   * @param  none
   * @return none
   */
-void app_clear_disable_download_flag();
+void app_clear_disable_download_flag(void);
 
 
 /**
