Эх сурвалжийг харах

2020-03-11 /Edward Lien
1.Combine latest code from AW-Regular.
2.Disable buzzer function.

Files:
1. As follow commit history

Image version: D0.06.60.6007.BT
Image checksum: XXXXXXXX

Hardware PWB P/n : xxxxxxxx
Hardware Version : XXXXXXXX

Edward Lien 5 жил өмнө
parent
commit
11e428829a
23 өөрчлөгдсөн 1285 нэмэгдсэн , 682 устгасан
  1. 7 7
      EVSE/Projects/BYTON-GB/Apps/Makefile
  2. 26 11
      EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.c
  3. 28 14
      EVSE/Projects/BYTON-GB/Apps/Module_EventLogging.c
  4. 20 4
      EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c
  5. 289 109
      EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c
  6. 24 11
      EVSE/Projects/BYTON-GB/Apps/Module_Speaker.c
  7. 413 64
      EVSE/Projects/BYTON-GB/Apps/main.c
  8. 11 0
      EVSE/Projects/BYTON-GB/Apps/main.h
  9. BIN
      EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin
  10. BIN
      EVSE/Projects/BYTON-GB/Images/MLO
  11. BIN
      EVSE/Projects/BYTON-GB/Images/ramdisk.gz
  12. BIN
      EVSE/Projects/BYTON-GB/Images/ramdisk_merged.gz
  13. BIN
      EVSE/Projects/BYTON-GB/Images/u-boot.img
  14. BIN
      EVSE/Projects/BYTON-GB/Images/zImage
  15. 150 150
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map
  16. 150 150
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S
  17. 150 150
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S
  18. BIN
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux1
  19. BIN
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux2
  20. 1 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version
  21. 3 4
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp
  22. 0 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
  23. 13 6
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/lib/.gen_crc32table.cmd

+ 7 - 7
EVSE/Projects/BYTON-GB/Apps/Makefile

@@ -13,7 +13,7 @@ apps: Module_InternalComm_Task Module_FactoryConfig_Task Module_EventLogging_Tas
 Module_InternalComm_Task:
 	@echo "===== Module_InternalComm_Task ==================================="
 	rm -f Module_InternalComm 
-	$(CC) "-I../../" "-include../../../Modularization/Module_Upgrade.h" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_InternalComm.o "./Module_InternalComm.c"
+	$(CC) -D $(Project) "-I../../" "-include../../../Modularization/Module_Upgrade.h" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_InternalComm.o "./Module_InternalComm.c"
 	$(CC) -o Module_InternalComm Module_InternalComm.o ${Lib_Module_Upgrade}
 	rm -f *.o
 	mv -f Module_InternalComm ../Images/root
@@ -22,12 +22,12 @@ Module_InternalComm_Task:
 Module_FactoryConfig_Task:
 	@echo "===== Module_FactoryConfig_Task =================================="
 	rm -f Module_FactoryConfig
-	gcc "-I../../" -o Module_FactoryConfig "./Module_FactoryConfig.c"
+	gcc -D $(Project) "-I../../" -o Module_FactoryConfig "./Module_FactoryConfig.c"
 	mkdir -p /Storage/SystemLog	
 	./Module_FactoryConfig -f;true
 	cp /mnt/FactoryDefaultConfig.bin ../Images 
 	rm -f Module_FactoryConfig 
-	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_FactoryConfig.o "./Module_FactoryConfig.c"
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_FactoryConfig.o "./Module_FactoryConfig.c"
 	$(CC) -o Module_FactoryConfig Module_FactoryConfig.o 
 	rm -f *.o
 	mv -f Module_FactoryConfig ../Images/root
@@ -36,7 +36,7 @@ Module_FactoryConfig_Task:
 Module_EventLogging_Task:
 	@echo "===== Module_EventLogging_Task ==================================="
 	rm -f Module_EventLogging 
-	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EventLogging.o "./Module_EventLogging.c"
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EventLogging.o "./Module_EventLogging.c"
 	$(CC) -o Module_EventLogging Module_EventLogging.o 
 	rm -f *.o
 	mv -f Module_EventLogging ../Images/root
@@ -45,7 +45,7 @@ Module_EventLogging_Task:
 Module_AlarmDetect_Task:
 	@echo "===== Module_AlarmDetect_Task ===================================="
 	rm -f Module_AlarmDetect 
-	$(CC) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_AlarmDetect.o "./Module_AlarmDetect.c"
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_AlarmDetect.o "./Module_AlarmDetect.c"
 	$(CC) -o Module_AlarmDetect Module_AlarmDetect.o 
 	rm -f *.o
 	mv -f Module_AlarmDetect ../Images/root	
@@ -54,7 +54,7 @@ Module_AlarmDetect_Task:
 Module_CSU_Task:
 	@echo "===== Module_CSU_Task ============================================"
 	rm -f main 
-	$(CC) "-I../../" "-include../../../Modularization/ocppfiles/sqlite3.h" "-include../../../Modularization/Module_Upgrade.h" "-include../../../Modularization/Module_RFID.h" -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "./main.c"
+	$(CC) -D $(Project) "-I../../" "-include../../../Modularization/ocppfiles/sqlite3.h" "-include../../../Modularization/Module_Upgrade.h" "-include../../../Modularization/Module_RFID.h" -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "./main.c"
 	$(CC) -o main main.o ${Lib_Module_RFID} ${Lib_Module_Upgrade} ${Lib_SQLite3}
 	rm -f *.o
 	mv -f main ../Images/root		
@@ -63,7 +63,7 @@ Module_CSU_Task:
 Module_Speaker_Task:
 	@echo "===== Module_Speaker_Task ===================================="
 	rm -f Module_Speaker
-	$(CC) "-I../../"  -O0 -g3 -Wall -c -fmessage-length=0 -o Module_Speaker.o  "./Module_Speaker.c"
+	$(CC) -D $(Project) "-I../../"  -O0 -g3 -Wall -c -fmessage-length=0 -o Module_Speaker.o  "./Module_Speaker.c"
 	$(CC) -o Module_Speaker Module_Speaker.o 
 	rm -f *.o
 	mv -f Module_Speaker ../Images/root	

+ 26 - 11
EVSE/Projects/BYTON-GB/Apps/Module_AlarmDetect.c

@@ -27,7 +27,7 @@
 #include	"define.h"
 #include	"main.h"
 
-#define FILTER_SPEC			50
+#define FILTER_SPEC			2
 
 #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
 #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
@@ -73,6 +73,7 @@ struct StatusCodeData 			*ShmStatusCodeData;
 struct OCPP16Data				*ShmOCPP16Data;
 struct Charger					*ShmCharger;
 
+
 int StoreLogMsg(const char *fmt, ...)
 {
 	char Buf[4096+256];
@@ -88,17 +89,31 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1,
-			ShmSysConfigAndInfo->SysConfig.ModelName,
-			ShmSysConfigAndInfo->SysConfig.SerialNumber);
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
 #ifdef SystemLogMessage
 	system(Buf);
 #endif
 
+#ifdef ConsloePrintLog
 	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+#endif
 
 	return rc;
 }
@@ -122,7 +137,7 @@ int InitShareMemory()
 	int MeterSMId;
 
 	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
     {
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
@@ -140,7 +155,7 @@ int InitShareMemory()
     {}
 
    	//creat ShmStatusCodeData
-   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
     {
 		#ifdef SystemLogMessage
    		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
@@ -158,7 +173,7 @@ int InitShareMemory()
     {}
 
    	//creat ShmStatusCodeData
-   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
 	{
 
 		DEBUG_ERROR("shmget ShmCharger NG\r\n");
@@ -176,7 +191,7 @@ int InitShareMemory()
 	{}
 
    	//creat ShmOCPP16Data
-	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), IPC_CREAT | 0777)) < 0)
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
 	{
 
 		DEBUG_ERROR("shmget ShmOCPP16Data NG\r\n");

+ 28 - 14
EVSE/Projects/BYTON-GB/Apps/Module_EventLogging.c

@@ -64,12 +64,10 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
+	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/Eventlog/[%04d.%02d]EventLog",
 			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
 			buffer,
-			tm->tm_year+1900,tm->tm_mon+1,
-			ShmSysConfigAndInfo->SysConfig.ModelName,
-			ShmSysConfigAndInfo->SysConfig.SerialNumber);
+			tm->tm_year+1900,tm->tm_mon+1);
 #ifdef SystemLogMessage
 	system(Buf);
 #endif
@@ -80,7 +78,6 @@ int StoreLogMsg(const char *fmt, ...)
 }
 #endif
 
-
 int StoreEventLogMsg(const char *fmt, ...)
 {
 	char Buf[4096+256];
@@ -96,14 +93,31 @@ int StoreEventLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf, "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/EventLog/[%04d.%02d]EventLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
+#ifdef SystemLogMessage
 	system(Buf);
-	#ifdef Debug
+#endif
+
+#ifdef ConsloePrintLog
 	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
-	#endif
+#endif
 
 	return rc;
 }
@@ -182,7 +196,7 @@ int InitShareMemory()
 	int MeterSMId;
 
 	//creat ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
     {
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
@@ -200,7 +214,7 @@ int InitShareMemory()
     {}
 
    	//creat ShmStatusCodeData
-   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
     {
 		#ifdef SystemLogMessage
    		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
@@ -218,7 +232,7 @@ int InitShareMemory()
     {}
 
    	//creat ShmStatusCodeData
-	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmStatusCodeData NG");

+ 20 - 4
EVSE/Projects/BYTON-GB/Apps/Module_FactoryConfig.c

@@ -226,8 +226,24 @@ int main(int argc, char *argv[])
 	// System configuration
 	time_t t = time(NULL);
 	struct tm tm = *localtime(&t);
-	strcpy((char*)SysConfig.ModelName, "AWSG770005W1B0");
-	strcpy((char*)SysConfig.SerialNumber, "M2003A001S0");
+	
+	// Initial Share Memory
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		strcpy((char*)SysConfig.ModelName,"");
+		strcpy((char*)SysConfig.SerialNumber,"");
+		sleep(5);
+	}
+	else
+	{
+		memcpy((char*)SysConfig.ModelName,ShmSysConfigAndInfo->SysConfig.ModelName,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
+		memcpy((char*)SysConfig.SerialNumber,ShmSysConfigAndInfo->SysConfig.SerialNumber,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+
+		DEBUG_INFO("InitShareMemory OK.\r\n");
+	}
+	
 	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 	SysConfig.AuthorisationMode = 0;	// 0:PH card	1: OCPP backend		2: PH backend	3: Free Mode
@@ -243,7 +259,7 @@ int main(int argc, char *argv[])
 	SysConfig.AcPhaseCount = 1;			// 1: One phase	3: Three phase
 
 	// Network configuration
-	strcpy((char*)SysConfig.FtpServer, "ftp://ipc_ui:pht2016@ftp.phihong.com.tw/");
+	strcpy((char*)SysConfig.FtpServer, "");
 	SysConfig.Eth0Interface.EthDhcpClient = 0;
 	strcpy((char*)SysConfig.Eth0Interface.EthIpAddress, "192.168.1.10");
 	strcpy((char*)SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
@@ -268,7 +284,7 @@ int main(int argc, char *argv[])
 	SysConfig.OfflinePolicy = 0;			// 0: Local list	1: PH RFID		2: Free		3: Deny
 	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
 	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
-	strcpy((char*)SysConfig.OcppServerURL, "ws://test.evsocket.phihong.com.cn:2012/");
+	strcpy((char*)SysConfig.OcppServerURL, "");
 	sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 
 

+ 289 - 109
EVSE/Projects/BYTON-GB/Apps/Module_InternalComm.c

@@ -38,6 +38,11 @@
 #define ON					1
 #define OFF					0
 
+//Print out level
+unsigned char PRINT_OUT_LEVEL_STATE = 0;
+#define LEVEL_1				4 // 3 Seconds
+#define LEVEL_2				8 // 6 Seconds
+
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData 			*ShmStatusCodeData;
 struct PrimaryMcuData			*ShmPrimaryMcuData;
@@ -51,6 +56,7 @@ int mystrcmp(char *p1,char *p2);
 void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
 void split(char **arr, char *str, const char *del);
 
+
 int StoreLogMsg(const char *fmt, ...)
 {
 	char Buf[4096+256];
@@ -66,16 +72,31 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
 
 #ifdef SystemLogMessage
 	system(Buf);
 #endif
 
+#ifdef ConsloePrintLog
 	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+#endif
 
 	return rc;
 }
@@ -153,7 +174,7 @@ int InitShareMemory()
 	int MeterSMId;
 
 	//Initial ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
@@ -169,7 +190,7 @@ int InitShareMemory()
 	}
 
 	//Initial ShmStatusCodeData
-	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
@@ -185,7 +206,7 @@ int InitShareMemory()
 	}
 
 	//Initial ShmPrimaryMcuKey
-	if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0)
+	if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmPrimaryMcuData NG\r\n");
@@ -201,7 +222,7 @@ int InitShareMemory()
 	}
 
 	//creat ShmOCPP16Data
-	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmOCPP16Data NG");
@@ -219,7 +240,7 @@ int InitShareMemory()
 	{}
 
 	//Initial ShmCharger
-	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmChargerKey NG\r\n");
@@ -1000,6 +1021,9 @@ unsigned char Config_Serial_Number(unsigned char fd, unsigned char targetAddr, E
 
 	if(len > 6)
 	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
 		chksum = 0x00;
 		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
 		{
@@ -1036,6 +1060,9 @@ unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse
 
 	if(len > 6)
 	{
+		if (len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
 		chksum = 0x00;
 		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
 		{
@@ -1396,6 +1423,9 @@ unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char
 
 	if(len > 6)
 	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
 		chksum = 0x00;
 		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
 		{
@@ -1466,7 +1496,6 @@ unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
 		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
 		{
 			chksum ^= rx[6+idx];
-
 		}
 
 		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
@@ -1541,7 +1570,7 @@ unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
 	if(len > 6)
 	{
 		if (len < 6+(rx[4] | rx[5]<<8))
-				return result;
+			return result;
 
 		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
 		{
@@ -1569,6 +1598,7 @@ int main(void)
 	int Uart1Fd;
 
 	unsigned short int failCount[2] = {0,0};
+	unsigned short int printOutCount[2] = {0,0};
 
 	if(InitShareMemory() == FAIL)
 	{
@@ -1615,16 +1645,13 @@ int main(void)
 				/*
 				 * High priority communication
 				 */
-				DEBUG_INFO("========== High priority polling ==========\r\n");
+
 				//===============================
-				// Config primary MCU LED
+				// Case 1 : Config primary MCU LED
 				//===============================
 				ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
 				if(Config_AC_MCU_LED(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuLed))
 				{
-					DEBUG_INFO("MCU-%d set Led mode : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
-					DEBUG_INFO("MCU-%d set Alarm code : %x\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
-
 					failCount[gun_index] = 0;
 				}
 				else
@@ -1637,12 +1664,10 @@ int main(void)
 				}
 
 				//===============================
-				// Config primary Legacy request
+				// Case 2 : Config primary Legacy request
 				//===============================
 				if(Config_AC_MCU_LEGACY_REQUEST(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1),&ShmCharger->gun_info[gun_index].legacyRequest))
 				{
-					DEBUG_INFO("MCU-%d set relay request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
-
 					failCount[gun_index] = 0;
 				}
 				else
@@ -1655,22 +1680,10 @@ int main(void)
 				}
 
 				//===============================
-				// Query primary MCU status
+				// Case 3 : Query primary MCU status
 				//===============================
 				if(Query_AC_MCU_Status(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuState))
 				{
-					DEBUG_INFO("MCU-%d get Pilot State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
-					DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
-					DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
-					DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
-					DEBUG_INFO("MCU-%d get Relay State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
-					DEBUG_INFO("MCU-%d get Rating Current : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
-					DEBUG_INFO("MCU-%d get Rotary switch : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
-					DEBUG_INFO("MCU-%d get Locker State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
-					DEBUG_INFO("MCU-%d get Shutter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
-					DEBUG_INFO("MCU-%d get Meter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
-					DEBUG_INFO("MCU-%d get PP State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
-
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState = ShmCharger->gun_info[gun_index].primaryMcuState.cp_state;
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotDuty = (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit>51?(unsigned char)((ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/2.5)+64):(unsigned char)(ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/0.6));
 					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotVoltage = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
@@ -1689,17 +1702,18 @@ int main(void)
 				}
 
 				//===============================
-				// Query primary MCU Alarm code
+				// Case 4 : Query primary MCU Alarm code
 				//===============================
 				if(Query_AC_MCU_Alarm(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuAlarm))
 				{
-					DEBUG_INFO("MCU-%d get alarm OK...\r\n");
-					/*
+					//DEBUG_INFO("MCU-%d get alarm code success.\r\n",gun_index);
+
+					//================================================
 					// Byte[6]
 					// Byte[7]
 					// Byte[8] Alarm code 3~7 bits Reserved
 					// Byte[9] Alarm code 0~7 bits Reserved
-					 */
+					//================================================
 
 					//================================================
 					// Byte[6]
@@ -1806,32 +1820,8 @@ int main(void)
 						ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<18);
 
 					//================================================
-					// Byte[9]
+					// Byte[9] Reserved
 					//================================================
-					// Debug information print out
-					if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
-					{
-						DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
-						DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
-						DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
-						DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
-						DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
-						DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
-						DEBUG_INFO("MCU-%d get ac_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
-						DEBUG_INFO("MCU-%d get dc_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
-						DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
-						DEBUG_INFO("MCU-%d get handshaking_timeout : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
-						DEBUG_INFO("MCU-%d get emergency_stop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
-						DEBUG_INFO("MCU-%d get relay_welding : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
-						DEBUG_INFO("MCU-%d get leak_module_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
-						DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
-						DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
-						DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
-						DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
-						DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
-						DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
-						DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
-					}
 
 					failCount[gun_index] = 0;
 				}
@@ -1845,17 +1835,10 @@ int main(void)
 				}
 
 				//===============================
-				// Query primary MCU BLE config
+				// Case 5 : Query primary MCU BLE config
 				//===============================
 				if(Query_Ble_Config(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleConfigData))
 				{
-					if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
-					{
-						DEBUG_INFO("MCU-%d get isUserLogin : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
-						DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
-						DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
-					}
-
 					ShmSysConfigAndInfo->SysConfig.Bluetooth.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
 					ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart;
 					ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop;
@@ -1872,11 +1855,10 @@ int main(void)
 				}
 
 				//===============================
-				// Query primary MCU ble login id
+				// Case 6 : Query primary MCU ble login id
 				//===============================
 				if(Query_Ble_Central_ID(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleLoginCentralId))
 				{
-					DEBUG_INFO("MCU-%d get ble central id : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
 					memcpy(ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, sizeof ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID);
 
 					failCount[gun_index] = 0;
@@ -1891,12 +1873,15 @@ int main(void)
 				}
 
 				//===============================
-				// Config primary MCU reset request
+				// Case 7 : Config primary MCU reset request
 				//===============================
 				if(ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest == ON)
 				{
 					if(Config_AC_MCU_RESET_REQUEST(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].mcuResetRequest) == PASS)
 					{
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("********* High priority polling : Case 7 *********\r\n");
+						DEBUG_INFO("**************************************************\r\n");
 						DEBUG_INFO("MCU-%d set MCU reset Request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest);
 
 						ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest = OFF;
@@ -1912,13 +1897,128 @@ int main(void)
 						}
 					}
 				}
+
+				//==========================================================
+				// High priority polling log print out
+				//==========================================================
+				if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
+				{
+					PRINT_OUT_LEVEL_STATE = LEVEL_1;
+					if(printOutCount[gun_index]>LEVEL_1)
+						printOutCount[gun_index] = 0;
+				}
+				else
+				{
+					PRINT_OUT_LEVEL_STATE = LEVEL_2;
+					if(printOutCount[gun_index]>LEVEL_2)
+						printOutCount[gun_index] = 0;
+				}
+
+				if(printOutCount[gun_index] == PRINT_OUT_LEVEL_STATE)
+				{
+					//===============================
+					// Config primary MCU LED
+					//===============================
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("********* High priority polling : Case 1 *********\r\n");
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("MCU-%d set Led mode : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
+					DEBUG_INFO("MCU-%d set Alarm code : %x\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
+
+					//===============================
+					// Config primary Legacy request
+					//===============================
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("********* High priority polling : Case 2 *********\r\n");
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("MCU-%d set relay request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
+
+					//===============================
+					// Query primary MCU status
+					//===============================
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("********* High priority polling : Case 3 *********\r\n");
+					DEBUG_INFO("**************************************************\r\n");
+					DEBUG_INFO("MCU-%d get Pilot State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
+					DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
+					DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
+					DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
+					DEBUG_INFO("MCU-%d get Relay State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
+					DEBUG_INFO("MCU-%d get Rating Current : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
+					DEBUG_INFO("MCU-%d get Rotary switch : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
+
+					/*
+					DEBUG_INFO("MCU-%d get Locker State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
+					DEBUG_INFO("MCU-%d get Shutter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
+					DEBUG_INFO("MCU-%d get Meter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
+					DEBUG_INFO("MCU-%d get PP State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
+										*/
+
+					//===============================
+					// Query primary MCU Alarm code
+					//===============================
+					if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
+					{
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("********* High priority polling : Case 4 *********\r\n");
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
+						DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
+						DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
+						DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
+						DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
+						DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
+						DEBUG_INFO("MCU-%d get ac_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
+						DEBUG_INFO("MCU-%d get dc_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
+						DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
+						DEBUG_INFO("MCU-%d get handshaking_timeout : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
+						DEBUG_INFO("MCU-%d get emergency_stop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
+						DEBUG_INFO("MCU-%d get relay_welding : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
+						DEBUG_INFO("MCU-%d get leak_module_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
+						DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
+						DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
+						DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
+						DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
+						DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
+						DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
+						DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
+					}
+
+					//===============================
+					// Query primary MCU BLE config
+					//===============================
+					if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
+					{
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("********* High priority polling : Case 5 *********\r\n");
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("MCU-%d get isUserLogin : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
+						DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
+						DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
+					}
+
+					//===============================
+					// Query primary MCU ble login id
+					//===============================
+					if(strcmp((char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id,"") != 0)
+					{
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("********* High priority polling : Case 6 *********\r\n");
+						DEBUG_INFO("**************************************************\r\n");
+						DEBUG_INFO("MCU-%d get ble central id : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
+					}
+
+					usleep(100000);
+				}
+
+				printOutCount[gun_index]++;
 			}
 			else
 			{
 				/*
 				 * Normal priority communication
 				 */
-				DEBUG_INFO("========== Normal priority polling ==========\r\n");
+
 				switch(stepIndex)
 				{
 					case 1:
@@ -1927,11 +2027,12 @@ int main(void)
 						//===============================
 						if(Query_Present_InputVoltage(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].inputVoltage) == PASS)
 						{
-							DEBUG_INFO("MCU-%d get input voltage : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
 							ShmSysConfigAndInfo->SysInfo.InputVoltageR = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
 							ShmSysConfigAndInfo->SysInfo.InputVoltageS = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
 							ShmSysConfigAndInfo->SysInfo.InputVoltageT = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
 
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
+
 							failCount[gun_index] = 0;
 						}
 						else
@@ -1949,7 +2050,7 @@ int main(void)
 						//===============================
 						if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
 						{
-							DEBUG_INFO("MCU-%d get output current : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
 
 							failCount[gun_index] = 0;
 						}
@@ -1968,8 +2069,6 @@ int main(void)
 						//===============================
 						if(Query_AC_GUN_PLUGIN_TIMES(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].gunPluginTimes) == PASS)
 						{
-							DEBUG_INFO("MCU-%d get gun plugin times : %ld\r\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
-
 							ShmSysConfigAndInfo->SysConfig.AcPlugInTimes = ((long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes & 0xFFFF);
 
 							failCount[gun_index] = 0;
@@ -1989,7 +2088,6 @@ int main(void)
 						//===============================
 						if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
 						{
-							DEBUG_INFO("MCU-%d get temperature : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
 							ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
 
 							failCount[gun_index] = 0;
@@ -2007,18 +2105,22 @@ int main(void)
 						//===============================
 						// Config primary set CP PWN duty
 						//===============================
-						if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
+						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
 						{
-							DEBUG_INFO("MCU-%d cp pwn duty : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
-
-							failCount[gun_index] = 0;
-						}
-						else
-						{
-							DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\r\n", gun_index, failCount[gun_index]);
-							if(failCount[gun_index]<1000)
+							if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
 							{
-								failCount[gun_index]++;
+								failCount[gun_index] = 0;
+								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
+							}
+							else
+							{
+								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
+
+								DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\r\n", gun_index, failCount[gun_index]);
+								if(failCount[gun_index]<1000)
+								{
+									failCount[gun_index]++;
+								}
 							}
 						}
 						break;
@@ -2055,14 +2157,6 @@ int main(void)
 									system(cmdBuf);
 									system("hwclock -w -u");
 									system("hwclock -s");
-
-									DEBUG_INFO("Sync from MCU-%d rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
-																											  ShmCharger->gun_info[gun_index].rtc.year,
-																											  ShmCharger->gun_info[gun_index].rtc.month,
-																											  ShmCharger->gun_info[gun_index].rtc.day,
-																											  ShmCharger->gun_info[gun_index].rtc.hour,
-																											  ShmCharger->gun_info[gun_index].rtc.min,
-																											  ShmCharger->gun_info[gun_index].rtc.sec);
 								}
 							}
 							else
@@ -2076,14 +2170,6 @@ int main(void)
 									ShmCharger->gun_info[gun_index].rtc.min = tmCSU->tm_min;
 									ShmCharger->gun_info[gun_index].rtc.sec = tmCSU->tm_sec;
 									Config_RTC(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].rtc);
-
-									DEBUG_INFO("MCU-%d set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
-																										ShmCharger->gun_info[gun_index].rtc.year,
-																										ShmCharger->gun_info[gun_index].rtc.month,
-																										ShmCharger->gun_info[gun_index].rtc.day,
-																										ShmCharger->gun_info[gun_index].rtc.hour,
-																										ShmCharger->gun_info[gun_index].rtc.min,
-																										ShmCharger->gun_info[gun_index].rtc.sec);
 								}
 							}
 
@@ -2104,8 +2190,6 @@ int main(void)
 						//===============================
 						if(Query_Power_Consumption(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].powerConsumption))
 						{
-							DEBUG_INFO("MCU-%d get power consumption : %f\r\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0));
-
 							failCount[gun_index] = 0;
 						}
 						else
@@ -2123,6 +2207,10 @@ int main(void)
 						//===============================
 						if(ShmCharger->gun_info[gun_index].mcuFlag.isMcuUpgradeReq)
 						{
+							DEBUG_INFO("==================================================\r\n");
+							DEBUG_INFO("======== Normal priority polling : Case 15 =======\r\n");
+							DEBUG_INFO("==================================================\r\n");
+
 							unsigned char cmd[512];
 							if(Upgrade_UART(Uart1Fd, AC_WALLMOUNT_CONTROLLER, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), ShmCharger->fwUpgradeInfo.location, ShmCharger->fwUpgradeInfo.modelName))
 							{
@@ -2145,10 +2233,14 @@ int main(void)
 						}
 						break;
 					case 17:
-
+						//DEBUG_INFO("==================================================\r\n");
+						//DEBUG_INFO("======== Normal priority polling : Case 17 =======\r\n");
+						//DEBUG_INFO("==================================================\r\n");
 						break;
 					case 19:
-
+						//DEBUG_INFO("==================================================\r\n");
+						//DEBUG_INFO("======== Normal priority polling : Case 19 =======\r\n");
+						//DEBUG_INFO("==================================================\r\n");
 						break;
 					case 21:
 						//===============================
@@ -2156,6 +2248,9 @@ int main(void)
 						//===============================
 						if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass != PASS)
 						{
+							DEBUG_INFO("==================================================\r\n");
+							DEBUG_INFO("======== Normal priority polling : Case 21-1======\r\n");
+							DEBUG_INFO("==================================================\r\n");
 							if(Query_FW_Ver(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].ver) == PASS)
 							{
 								DEBUG_INFO("MCU-%d get firmware version : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
@@ -2179,6 +2274,9 @@ int main(void)
 						//===============================
 						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass != PASS)
 						{
+							DEBUG_INFO("==================================================\r\n");
+							DEBUG_INFO("======== Normal priority polling : Case 21-2======\r\n");
+							DEBUG_INFO("==================================================\r\n");
 							memcpy(ShmCharger->evseId.serial_number, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmCharger->evseId.serial_number));
 							if(Config_Serial_Number(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
 							{
@@ -2202,6 +2300,9 @@ int main(void)
 						//===============================
 						if(ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass != PASS)
 						{
+							DEBUG_INFO("==================================================\r\n");
+							DEBUG_INFO("======== Normal priority polling : Case 21-3======\r\n");
+							DEBUG_INFO("==================================================\r\n");
 							memcpy(ShmCharger->evseId.model_name, ShmSysConfigAndInfo->SysConfig.ModelName, ARRAY_SIZE(ShmCharger->evseId.model_name));
 							if(Config_Model_Name(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
 							{
@@ -2224,10 +2325,89 @@ int main(void)
 						stepIndex = 0;
 						break;
 				}
+
+				//==========================================================
+				// Low priority polling log print out
+				//==========================================================
+				if(printOutCount[gun_index] == PRINT_OUT_LEVEL_STATE)
+				{
+					if(stepIndex == 1)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 1 ========\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d get input voltage : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
+						DEBUG_INFO("MCU-%d get PresentChargingVoltage : %.2f\r\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage);
+					}
+					else if(stepIndex == 3)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 3 ========\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d get output current : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
+					}
+					else if (stepIndex == 5)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 5 ========\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d get gun plugin times : %ld\r\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
+					}
+					else if (stepIndex == 7)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 7 ========\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d get temperature : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
+					}
+					else if (stepIndex == 9)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 9 ========\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d cp pwn duty : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
+					}
+					else if (stepIndex == 11)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 11 =======\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin && !ShmOCPP16Data->OcppConnStatus)
+						{
+							DEBUG_INFO("Sync from MCU-%d rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
+																											  ShmCharger->gun_info[gun_index].rtc.year,
+																											  ShmCharger->gun_info[gun_index].rtc.month,
+																											  ShmCharger->gun_info[gun_index].rtc.day,
+																											  ShmCharger->gun_info[gun_index].rtc.hour,
+																											  ShmCharger->gun_info[gun_index].rtc.min,
+																											  ShmCharger->gun_info[gun_index].rtc.sec);
+
+
+						}
+						else
+						{
+							DEBUG_INFO("MCU-%d set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
+																										ShmCharger->gun_info[gun_index].rtc.year,
+																										ShmCharger->gun_info[gun_index].rtc.month,
+																										ShmCharger->gun_info[gun_index].rtc.day,
+																										ShmCharger->gun_info[gun_index].rtc.hour,
+																										ShmCharger->gun_info[gun_index].rtc.min,
+																										ShmCharger->gun_info[gun_index].rtc.sec);
+						}
+					}
+					else if (stepIndex == 13)
+					{
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("======== Normal priority polling : Case 13 =======\r\n");
+						DEBUG_INFO("==================================================\r\n");
+						DEBUG_INFO("MCU-%d get power consumption : %f kWh\r\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100));
+					}
+
+					usleep(100000);
+				}
 			}
 			stepIndex++;
 
-
 			//===============================
 			// Communication fail check
 			//===============================

+ 24 - 11
EVSE/Projects/BYTON-GB/Apps/Module_Speaker.c

@@ -64,7 +64,6 @@ void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
 void split(char **arr, char *str, const char *del);
 
 
-#ifdef SystemLogMessage
 int StoreLogMsg(const char *fmt, ...)
 {
 	char Buf[4096+256];
@@ -80,19 +79,34 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/%04d-%02d_%s_%s_SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
 #ifdef SystemLogMessage
 	system(Buf);
 #endif
 
+#ifdef ConsloePrintLog
 	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+#endif
 
 	return rc;
 }
-#endif
 
 int DiffTimeb(struct timeb ST, struct timeb ET)
 {
@@ -167,7 +181,7 @@ int InitShareMemory()
 	int MeterSMId;
 
 	//Initial ShmSysConfigAndInfo
-	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
@@ -183,7 +197,7 @@ int InitShareMemory()
 	}
 
 	//Initial ShmStatusCodeData
-	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
@@ -199,7 +213,7 @@ int InitShareMemory()
 	}
 
 	//Initial ShmCharger
-	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
 	{
 		#ifdef SystemLogMessage
 		DEBUG_ERROR("shmget ShmChargerKey NG\r\n");
@@ -278,8 +292,7 @@ int main(void)
 					break;
 			}
 		}
-		else
-			usleep(100000);
+		usleep(100000);
 	}
 }
 

+ 413 - 64
EVSE/Projects/BYTON-GB/Apps/main.c

@@ -1,6 +1,7 @@
 #include	"define.h"
 #include 	"main.h"
 
+
 //==========================
 // System basic sample constant
 //==========================
@@ -18,7 +19,7 @@
 //==========================
 #define TMR_IDX_HANDSHAKING				0
 #define TMR_IDX_AUTH					1
-#define TMR_IDX_2						2
+#define TMR_IDX_LOGPPRINTOUT			2
 #define TMR_IDX_3						3
 #define TMR_IDX_4						4
 #define TMR_IDX_5						5
@@ -30,6 +31,7 @@
 #define TIMEOUT_SPEC_HANDSHAKING		180000
 #define TIMEOUT_SPEC_AUTH				30000
 #define TIMEOUT_SPEC_HANDSHAKING_LED	185000
+#define TIMEOUT_SPEC_LOGPPRINTOUT		20000
 
 #define MtdBlockSize 					0x600000
 
@@ -150,15 +152,31 @@ int StoreLogMsg(const char *fmt, ...)
 	memset(Buf,0,sizeof(Buf));
 	CurrentTime = time(NULL);
 	tm=localtime(&CurrentTime);
-	sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-			tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
-			buffer,
-			tm->tm_year+1900,tm->tm_mon+1);
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
 #ifdef SystemLogMessage
 	system(Buf);
 #endif
 
+#ifdef ConsloePrintLog
 	printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
+#endif
 
 	return rc;
 }
@@ -539,6 +557,13 @@ void InitGPIO()
 	system("echo \"out\" > /sys/class/gpio/gpio65/direction");
 	system("echo 0 > /sys/class/gpio/gpio65/value");
 
+	/*4G/Wifi RST:GPIO3_14 => H:ON; L:OFF*/
+	system("echo 110 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio110/direction");
+	system("echo 1 > /sys/class/gpio/gpio110/value");
+	sleep(3);
+	system("echo 0 > /sys/class/gpio/gpio110/value");
+
 	DEBUG_INFO("Initial GPIO OK\r\n");
 }
 
@@ -790,7 +815,6 @@ void InitEthernet()
 					ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
 					ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
 				}
-
 			}
 
 			sleep(5);
@@ -1035,20 +1059,94 @@ void get_firmware_version(unsigned char gun_index)
 		}
 	}
 
+	// Get MCU firmware version
+	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
+
 	// Get CSU root file system version
 	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.05.60.6007.BT");
 
-	// Get MCU firmware version
-	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
+	// Get AC connector type from model name
+	for(uint8_t idx=0;idx<3;idx++)
+	{
+		switch(ShmSysConfigAndInfo->SysConfig.ModelName[7+idx])
+		{
+			case '1':
+				// J1772 Plug
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '4';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '4';
+				break;
+			case '2':
+				// J1772 Socket
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '1';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '1';
+				break;
+			case '3':
+				// CE Plug
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '5';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '5';
+				break;
+			case '4':
+				// CE Socket
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '2';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '2';
+				break;
+			case '5':
+				// GB Plug
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '6';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '6';
+				break;
+			case '6':
+				// GB Socket
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '3';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '3';
+				break;
+		}
+	}
+
+	// Get network option from model name
+	switch(ShmSysConfigAndInfo->SysConfig.ModelName[10])
+	{
+		case 'B':
+		case 'U':
+			//Blue tooth
+			ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '3';
+			ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '3';
+			break;
+		case 'W':
+			// WIFI
+			ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '1';
+			ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '1';
+			break;
+		case 'T':
+			// 3G/4G
+			ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '2';
+			ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '2';
+			break;
+		default:
+			// LAN
+			ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '0';
+			ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '0';
+			break;
+	}
+
+	// Get rating power from model name
+	memcpy(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[10], &ShmSysConfigAndInfo->SysConfig.ModelName[4], 0x03);
+	memcpy(&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[10], &ShmSysConfigAndInfo->SysConfig.ModelName[4], 0x03);
+
+	// Get vender code from model name
+	memcpy(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[14], &ShmSysConfigAndInfo->SysConfig.ModelName[12], 0x02);
+	memcpy(&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[14], &ShmSysConfigAndInfo->SysConfig.ModelName[12], 0x02);
 
+	DEBUG_INFO("====================================================================\r\n");
+	DEBUG_INFO("Model: %s\r\n", ShmSysConfigAndInfo->SysConfig.ModelName);
 	DEBUG_INFO("CSU hardware version: %s\r\n", ShmSysConfigAndInfo->SysInfo.CsuHwRev);
 	DEBUG_INFO("CSU boot loader version: %s\r\n", ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
 	DEBUG_INFO("CSU kernel version: %s\r\n", ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
 	DEBUG_INFO("CSU root file system version: %s\r\n", ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
 	DEBUG_INFO("CSU MCU-%2d firmware version: %s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
+	DEBUG_INFO("====================================================================\r\n");
 }
 
-
 //===============================================
 // Upgrade firmware
 //===============================================
@@ -1469,15 +1567,15 @@ int isReservationExpired(unsigned char gun_index)
 		expiredDate.tm_mon -= 1;
 		expiredTime.time = mktime(&expiredDate);
 
-		if(DiffTimebWithNow(expiredTime) >= 0)
+		if(DiffTimebWithNow(expiredTime)>=0)
 		{
 			result = YES;
 		}
 	}
 	else
 	{
-		DEBUG_WARN("Expired date parsing error...\r\n");
-		DEBUG_INFO("Date expired...\r\n");
+		DEBUG_WARN("Expired date parsing error.\r\n");
+		DEBUG_INFO("Date expired.\r\n");
 		result = YES;
 	}
 
@@ -1501,6 +1599,141 @@ int isValidLocalWhiteCard()
 	return result;
 }
 
+//==========================================
+// Get Ethernet MAC address
+//==========================================
+int getEth0MacAddress()
+{
+	int result = PASS;
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+	char tmp[512];
+
+	strcpy(cmd, "ifconfig");;
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if(strstr(buf, "eth0") > 0)
+			{
+				result = PASS;
+			}
+
+			if(strstr(buf, "eth0      Link encap:Ethernet  HWaddr") > 0)
+			{
+				sscanf(buf, "%*s%*s%*s%*s%s", tmp);
+				strcpy((char*)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress, tmp);
+			}
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+//==========================================
+// Check task processing
+//==========================================
+void checkTask()
+{
+	if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T')
+	{
+		if(system("pidof -s Module_4g > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_4g not running, restart it.\r\n");
+			system("/root/Module_4g &");
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W')
+	{
+		if(system("pidof -s Module_Wifi > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_Wifi not running, restart it.\r\n");
+			system("/root/Module_Wifi &");
+		}
+	}
+
+	if(system("pidof -s Module_EventLogging > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_EventLogging not running, restart it.\r\n");
+		system("/root/Module_EventLogging &");
+	}
+
+	if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
+	{
+		if(system("pidof -s OcppBackend > /dev/null") != 0)
+		{
+			DEBUG_INFO("OcppBackend not running, restart it.\r\n");
+			system("/root/OcppBackend &");
+		}
+	}
+
+	if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_AlarmDetect not running, restart it.\r\n");
+		system("/root/Module_AlarmDetect &");
+	}
+
+	if(system("pidof -s Module_InternalComm > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_InternalComm not running, restart it.\r\n");
+		system("/root/Module_InternalComm &");
+	}
+
+	if(system("pidof -s Module_Speaker > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_Speaker not running, restart it.\r\n");
+		system("/root/Module_Speaker &");
+	}
+
+	if(system("pidof -s Module_ProduceUtils > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_ProduceUtils not running, restart it.\r\n");
+		system ("/root/Module_ProduceUtils &");
+	}
+}
+
+//===============================================
+// Check Connection Timeout
+//===============================================
+void checkConnectionTimeout()
+{
+	if(system("pidof -s OcppBackend > /dev/null") != 0)
+	{
+		ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
+		//DEBUG_INFO("Handshaking timeout specification follow by initial setting : %d s \r\n", TIMEOUT_SPEC_HANDSHAKING/1000);
+	}
+	else
+	{
+		if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData,"") != 0)
+		{
+			ShmCharger->timeoutSpec.Setting_Timeout_Spec = atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
+
+			if(ShmCharger->timeoutSpec.Setting_Timeout_Spec <= 0)
+			{
+				ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
+				//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Fail. Value can't be zero or less than zero.\r\n.");
+			}
+			else
+			{
+				ShmCharger->timeoutSpec.Present_Timeout_Spec = (ShmCharger->timeoutSpec.Setting_Timeout_Spec*1000);
+				//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Pass...\r\n.");
+			}
+			//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : %s s \r\n.",ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
+
+		}
+		else
+		{
+			ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
+			//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Fail. Table is blank...\r\n.");
+		}
+
+		//DEBUG_INFO("Present timeout spec : %d \r\n", ShmCharger->timeoutSpec.Present_Timeout_Spec);
+	}
+}
+
 //===============================================
 // Main process
 //===============================================
@@ -1530,6 +1763,7 @@ int main(void)
 		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus = 0xff;
 		ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch = 0xff;
 		ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest = ON;
+		ShmCharger->gun_info[gun_index].isInitialPass = NO;
 	}
 
 	// Main loop
@@ -1540,11 +1774,26 @@ int main(void)
 		//==========================================
 		ShmSysConfigAndInfo->SysInfo.OcppConnStatus = ShmOCPP16Data->OcppConnStatus;
 
+		//==========================================
+		// Ethernet Mac address
+		//==========================================
+		getEth0MacAddress();
+
+		//==========================================
+		// Check task processing
+		//==========================================
+		checkTask();
+
+		//==========================================
+		// Check timeout spec
+		//==========================================
+		checkConnectionTimeout();
+
 		//==========================================
 		// Something need run in Idle mode
 		//==========================================
-		if((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_IDLE) &&
-		   (AC_QUANTITY>1?(ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_IDLE):true))
+		if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_ALARM)) &&
+		   (AC_QUANTITY>1?((ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_ALARM)):true))
 		{
 			//======================================
 			// Check restore factory setting request
@@ -1567,7 +1816,10 @@ int main(void)
 			{
 				ShmCharger->isUpdateSuccess = FAIL;
 				for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
+				{
+					setLedMotion(gun_index,LED_ACTION_MAINTAIN);
 					setChargerMode(gun_index, SYS_MODE_UPDATE);
+				}
 			}
 		}
 
@@ -1618,23 +1870,35 @@ int main(void)
 			// Assign connector location index for OCPP
 			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].Index = gun_index;
 
-			// Alarm event check
-			if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
+			// Synchronize present charging power
+			if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (ShmSysConfigAndInfo->SysInfo.InputVoltageR* ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000;
+			else
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = 0;
+
+			// The system switch to Booting mode
+			if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == 0XFF)
 			{
-				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_ALARM)
-				{
-					setChargerMode(gun_index, SYS_MODE_ALARM);
-				}
+				setChargerMode(gun_index, SYS_MODE_BOOTING);
 			}
-			else
+
+			// Check initialization "PASS" or "FAIL"
+			if(ShmCharger->gun_info[gun_index].isInitialPass == YES)
 			{
-				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_ALARM)
+				// Alarm event check
+				if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
 				{
-
+					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_ALARM)
+					{
+						setChargerMode(gun_index, SYS_MODE_ALARM);
+					}
 				}
-				else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == 0XFF)
+				else
 				{
-					setChargerMode(gun_index, SYS_MODE_BOOTING);
+					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_ALARM)
+					{
+
+					}
 				}
 			}
 
@@ -1700,15 +1964,36 @@ int main(void)
 						// OCPP BootNotification info set
 						memcpy((char*)ShmOCPP16Data->OcppServerURL, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
 						memcpy((char*)ShmOCPP16Data->ChargeBoxId, (char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
-						sprintf((char*)ShmSysConfigAndInfo->SysConfig.chargePointVendor, "Phihong Technology");
 						sprintf((char*)ShmOCPP16Data->BootNotification.CpFwVersion, (char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
 						sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterSerialNumber, "N/A");
 						sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "AC");
 
+						DEBUG_INFO("==========================================\r\n");
+						DEBUG_INFO("System ID: %s\r\n",ShmSysConfigAndInfo->SysConfig.SystemId);
+						DEBUG_INFO("==========================================\r\n");
+
+						DEBUG_INFO("========== OCPP BootNotification information ==========\r\n");
+						DEBUG_INFO("OCPP OcppServerURL: %s\r\n",ShmSysConfigAndInfo->SysConfig.OcppServerURL);
+						DEBUG_INFO("OCPP ChargeBoxId: %s\r\n",ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
+						DEBUG_INFO("OCPP ChargePointVendor: %s\r\n",ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+						DEBUG_INFO("OCPP CpFwVersion: %s\r\n",ShmOCPP16Data->BootNotification.CpFwVersion);
+						DEBUG_INFO("OCPP CpMeterSerialNumber: %s\r\n",ShmOCPP16Data->BootNotification.CpMeterSerialNumber);
+						DEBUG_INFO("OCPP CpMeterType: %s\r\n",ShmOCPP16Data->BootNotification.CpMeterType);
+						DEBUG_INFO("=======================================================\r\n");
+
+						DEBUG_INFO("========== Set Wifi information ==========\r\n");
 						DEBUG_INFO("Wifi mode: %d\r\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
 						DEBUG_INFO("Wifi SSID: %s\r\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
 						DEBUG_INFO("Wifi password: %s\r\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
+						DEBUG_INFO("==========================================\r\n");
+
+						// Flag for initialization system success
+						ShmCharger->gun_info[gun_index].isInitialPass = YES;
+
+						// Set max current to rating current
+						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
 
+						// If rotate switch equal zero, the system needs to change Debug mode
 						if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
 							setChargerMode(gun_index, SYS_MODE_DEBUG);
 						else
@@ -1721,6 +2006,7 @@ int main(void)
 					{
 						setLedMotion(gun_index,LED_ACTION_IDLE);
 						setRelay(gun_index,OFF);
+						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
 						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
@@ -1729,10 +2015,16 @@ int main(void)
 						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode = 0x00;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = 0;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
-						ShmCharger->gun_info[gun_index].targetCurrent = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+						ShmCharger->gun_info[gun_index].targetCurrent = 0xFF;
+						ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
+						// Response StopTransactionConf
+						if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf == ON)
+							ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf = OFF;
 					}
 
 					if(((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_FREE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)) ||
+					   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_FREE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) ||
 					   (ShmCharger->gun_info[gun_index].rfidReq == ON) ||
 					   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON) ||
 					   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq == ON))
@@ -1809,6 +2101,7 @@ int main(void)
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = OFF;
 						ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
+						ShmCharger->gun_info[gun_index].isGunPlugged = NO;
 
 						setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 					}
@@ -1819,7 +2112,6 @@ int main(void)
 				case SYS_MODE_AUTHORIZING:
 					if(isModeChange(gun_index))
 					{
-						setLedMotion(gun_index,LED_ACTION_AUTHED);
 						ftime(&startTime[gun_index][TMR_IDX_AUTH]);
 
 						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
@@ -1881,12 +2173,16 @@ int main(void)
 									{
 										DEBUG_INFO("Authorize pass.\r\n");
 										setSpeaker(ON,SPEAKER_SHORT);
+										setLedMotion(gun_index,LED_ACTION_RFID_PASS);
+										sleep(3);
 										setChargerMode(gun_index, SYS_MODE_PREPARING);
 									}
 									else
 									{
 										DEBUG_INFO("Authorize fail.\r\n");
 										setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+										setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+										sleep(3);
 										setChargerMode(gun_index, SYS_MODE_IDLE);
 									}
 
@@ -1910,21 +2206,29 @@ int main(void)
 					{
 						ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
 						setRelay(gun_index, ON);
+						setLedMotion(gun_index,LED_ACTION_CONNECTED);
 					}
 
 					// If control pilot detect Bx, skip watch dog time out.
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)
 					{
 						ftime(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+						ShmCharger->gun_info[gun_index].isGunPlugged = YES;
+					}
+
+					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && (ShmCharger->gun_info[gun_index].isGunPlugged == YES))
+					{
+						DEBUG_INFO("Charging gun is plugged before.\r\n");
+						setChargerMode(gun_index, SYS_MODE_IDLE);
 					}
 
-					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_HANDSHAKING)
+					if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > ShmCharger->timeoutSpec.Present_Timeout_Spec)
 					{
 						setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);
 
-						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_HANDSHAKING_LED)
+						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > (ShmCharger->timeoutSpec.Present_Timeout_Spec+5000))
 						{
-							DEBUG_INFO("HANDSHAKINNG TIMEOUT...");
+							DEBUG_INFO("Handshaking timeout...");
 							setChargerMode(gun_index, SYS_MODE_IDLE);
 						}
 					}
@@ -1933,7 +2237,8 @@ int main(void)
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].OutputEnergy = 0;
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
 						getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime);
-						ShmOCPP16Data->StartTransaction[gun_index].MeterStart = ShmCharger->gun_info[gun_index].powerConsumption.power_consumption;
+						ShmCharger->gun_info[gun_index].powerConsumption.power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption.power_consumption;
+						ShmOCPP16Data->StartTransaction[gun_index].MeterStart = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100);
 						memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
 
 						memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
@@ -1941,10 +2246,6 @@ int main(void)
 
 						setChargerMode(gun_index, SYS_MODE_CHARGING);
 					}
-					else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B))
-					{
-						setLedMotion(gun_index,LED_ACTION_CONNECTED);
-					}
 
 					break;
 				case SYS_MODE_CHARGING:
@@ -1952,6 +2253,7 @@ int main(void)
 					{
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
 						ftime(&startChargingTime[gun_index]);
+						ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
 					}
 
 					if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
@@ -1965,11 +2267,15 @@ int main(void)
 					else
 					{
 						setLedMotion(gun_index,LED_ACTION_CHARGING);
-						ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0) - ShmOCPP16Data->StartTransaction[gun_index].MeterStart;
+						ShmOCPP16Data->StopTransaction[gun_index].MeterStop = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption - ShmCharger->gun_info[gun_index].powerConsumption.power_consumption_at_start)/100;
 						ftime(&endChargingTime[gun_index]);
 						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = DiffTimeb(startChargingTime[gun_index], endChargingTime[gun_index])/1000;
-						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption - ShmOCPP16Data->StartTransaction[gun_index].MeterStart)/100.0;
-						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].OutputEnergy = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption - ShmOCPP16Data->StartTransaction[gun_index].MeterStart)/100.0;
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = ((float)(ShmCharger->gun_info[gun_index].powerConsumption.power_consumption - ShmCharger->gun_info[gun_index].powerConsumption.power_consumption_at_start))/100;
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].OutputEnergy =  ((float)(ShmCharger->gun_info[gun_index].powerConsumption.power_consumption - ShmCharger->gun_info[gun_index].powerConsumption.power_consumption_at_start))/100;
+
+						// Response StartTransactionConf
+						if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf == ON)
+							ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf = OFF;
 
 						/*
 						 * TODO:
@@ -1980,30 +2286,75 @@ int main(void)
 						// Determine max charging current to MCU
 						if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
 						{
-							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent>ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+							{
+								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
+							}
 						}
 						else
 						{
-							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent>ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+							{
+								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+								ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = YES;
+							}
 						}
 
-						DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \r\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
-						DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
-						DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
-
-						if((ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)) )
+						// Debug information
+						if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
 						{
-							setChargerMode(gun_index, SYS_MODE_TERMINATING);
-							DEBUG_INFO("Connector-%d charging duration(%d) already over max duration(%d) in second.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration, (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60));
+							DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \r\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+							DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
+							DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
+							ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
 						}
-						else if((ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy/10.0)))
+
+						if(ShmOCPP16Data->OcppConnStatus)
 						{
-							setChargerMode(gun_index, SYS_MODE_TERMINATING);
-							DEBUG_INFO("Connector-%d charging energy(%.2f) already over max energy(%.2f) in KWH.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy, (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy/10.0));
+							// On-line max condition check
+							if((ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)))
+							{
+								setChargerMode(gun_index, SYS_MODE_TERMINATING);
+								DEBUG_INFO("Connector-%d charging duration(%d) already over max duration(%d) in second.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration, (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60));
+							}
+							else if((ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)))
+							{
+								setChargerMode(gun_index, SYS_MODE_TERMINATING);
+								DEBUG_INFO("Connector-%d charging energy(%.2f) already over max energy(%.2f) in KWH.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy, ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy));
+							}
+							else
+							{
+								setRelay(gun_index, ON);
+							}
 						}
 						else
 						{
-							setRelay(gun_index, ON);
+							// Off-line max condition check
+							if(ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE)
+							{
+								if(((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration*60)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60))))
+								{
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
+									DEBUG_INFO("Connector-%d charging duration(%d) already over off-line max duration(%d) in second.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration, (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60));
+								}
+								else if(((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy))))
+								{
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
+									DEBUG_INFO("Connector-%d charging energy(%.2f) already over off-line max energy(%.2f) in KWH.\r\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy, ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy));
+								}
+								else
+								{
+									setRelay(gun_index, ON);
+								}
+							}
+							else
+							{
+								setRelay(gun_index, OFF);
+								DEBUG_INFO("Connector-%d can not charging in off line\r\n", gun_index);
+							}
 						}
 					}
 
@@ -2017,7 +2368,6 @@ int main(void)
 						}
 
 						setLedMotion(gun_index, LED_ACTION_STOP);
-						setRelay(gun_index, OFF);
 						getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
 					}
 
@@ -2135,8 +2485,10 @@ int main(void)
 					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) ||
 					   ShmOCPP16Data->MsMsg.bits.ResetReq)
 					{
-						setSpeaker(ON,SPEAKER_SHORT);
-						sleep(5);
+						if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
+							setSpeaker(ON,SPEAKER_SHORT);
+
+						setRelay(gun_index, OFF);
 
 						if(!ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)
 						{
@@ -2165,7 +2517,7 @@ int main(void)
 							}
 
 							memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
-							ShmOCPP16Data->StopTransaction[gun_index].MeterStop = ShmCharger->gun_info[gun_index].powerConsumption.power_consumption;
+							ShmOCPP16Data->StopTransaction[gun_index].MeterStop = (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100);
 							ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
 
 							ShmCharger->gun_info[gun_index].rfidReq = OFF;
@@ -2183,8 +2535,10 @@ int main(void)
 						   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop != ON)  &&
 						   (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq != ON) &&
 						   !ShmOCPP16Data->MsMsg.bits.ResetReq &&
-						   !((ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60))) &&
-						   !((ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy/10.0))))
+						   !(ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60))) &&
+						   !(ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy))) &&
+						   !(!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration*60)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)))) &&
+						   !(!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)))))
 						{
 							setChargerMode(gun_index, SYS_MODE_CHARGING);
 						}
@@ -2220,11 +2574,6 @@ int main(void)
 				case SYS_MODE_MAINTAIN:
 					if(isModeChange(gun_index))
 					{
-						/*
-						 * TODO:
-						 * 1. LED control depend on relay status
-						 * 2. Wait maintenance release command
-						 */
 						setLedMotion(gun_index,LED_ACTION_MAINTAIN);
 					}
 
@@ -2232,7 +2581,7 @@ int main(void)
 				case SYS_MODE_UPDATE:
 					if(isModeChange(gun_index))
 					{
-
+						setLedMotion(gun_index,LED_ACTION_MAINTAIN);
 					}
 
 					//======================================

+ 11 - 0
EVSE/Projects/BYTON-GB/Apps/main.h

@@ -303,6 +303,7 @@ typedef struct LEGACY_REQUEST
 typedef struct POWER_CONSUMPTION
 {
 	uint32_t power_consumption;
+	uint32_t power_consumption_at_start;
 
 }Power_Consumption;
 
@@ -313,6 +314,7 @@ typedef struct MCU_OP_FLAG
 	unsigned char isSetModelNamePass:1;
 	unsigned char isReadFwVerPass:1;
 	unsigned char isMcuUpgradeReq:1;
+	unsigned char isSetCpPwmDuty:1;
 }Mcu_Op_Flag;
 
 typedef struct SYSTEM_ALARM_CODE
@@ -362,6 +364,12 @@ typedef struct MCU_RESET_REQUEST
 	unsigned char isMcuResetRequest:1;
 }Mcu_Reset_Request;
 
+typedef struct TIMEOUT_SPEC
+{
+	int Setting_Timeout_Spec;
+	int Present_Timeout_Spec;
+}Timeout_Spec;
+
 typedef struct GUN_INFO
 {
 	Ver 											ver;
@@ -386,6 +394,8 @@ typedef struct GUN_INFO
 	uint16_t										targetCurrent;
 	uint8_t											isAuthPassEnd:1;
 	uint8_t											rfidReq:1;
+	uint8_t											isGunPlugged:1;
+	uint8_t											isInitialPass:1;
 }Gun_Info;
 
 struct Charger
@@ -394,6 +404,7 @@ struct Charger
 	Evse_Id					evseId;
 	Gun_Info 				gun_info[2];
 	Fw_Upgrade_Info			fwUpgradeInfo;
+	Timeout_Spec			timeoutSpec;
 	
 	uint8_t					gun_selectd;
 	uint8_t	 				speaker_type;

BIN
EVSE/Projects/BYTON-GB/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/BYTON-GB/Images/MLO


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk.gz


BIN
EVSE/Projects/BYTON-GB/Images/ramdisk_merged.gz


BIN
EVSE/Projects/BYTON-GB/Images/u-boot.img


BIN
EVSE/Projects/BYTON-GB/Images/zImage


+ 150 - 150
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map

@@ -34572,155 +34572,155 @@ c0a00000 R __start_rodata
 c0a00000 A __start_rodata_section_aligned
 c0a00000 R _etext
 c0a00010 R linux_proc_banner
-c0a0006c R linux_banner
-c0a00100 r __func__.5825
-c0a00110 r sqrt_oddadjust
-c0a00130 r sqrt_evenadjust
-c0a00150 r __func__.5807
-c0a00160 r cc_map
-c0a00180 r isa_modes
-c0a00190 r processor_modes
-c0a00210 r sigpage_mapping
-c0a00220 r regoffset_table
-c0a002b8 r user_arm_view
-c0a002cc r arm_regsets
-c0a00338 r hwcap_str
-c0a00394 r hwcap2_str
-c0a003ac r proc_arch
-c0a003f0 R cpuinfo_op
-c0a00400 R sigreturn_codes
-c0a0041c r handler
-c0a00430 r atags_fops
-c0a004a8 r pmresrn_table.31150
-c0a004b8 r pmresrn_table.31002
-c0a004c4 r scorpion_perf_cache_map
-c0a0056c r scorpion_perf_map
-c0a00594 r krait_perf_cache_map
-c0a0063c r krait_perf_map
-c0a00664 r krait_perf_map_no_branch
-c0a0068c r armv7_a5_perf_cache_map
-c0a00734 r armv7_a5_perf_map
-c0a0075c r armv7_a7_perf_cache_map
-c0a00804 r armv7_a7_perf_map
-c0a0082c r armv7_a8_perf_cache_map
-c0a008d4 r armv7_a8_perf_map
-c0a008fc r armv7_a9_perf_cache_map
-c0a009a4 r armv7_a9_perf_map
-c0a009cc r armv7_a12_perf_cache_map
-c0a00a74 r armv7_a12_perf_map
-c0a00a9c r armv7_a15_perf_cache_map
-c0a00b44 r armv7_a15_perf_map
-c0a00b6c r armv7_pmu_probe_table
-c0a00b90 r armv7_pmu_of_device_ids
-c0a013fc r usermode_action
-c0a01414 r alignment_proc_fops
-c0a0148c r subset.21772
-c0a014ac r subset.21782
-c0a014bc r __param_str_alignment
-c0a014c8 r cpu_arch_name
-c0a014ce r cpu_elf_name
-c0a014d4 r l2c220_data
-c0a0151c r omap_types
-c0a01530 r __func__.28508
-c0a01548 r __func__.29284
-c0a01568 r __func__.29289
-c0a01588 r am33xx_control_reg_offsets
-c0a01648 r am43xx_control_reg_offsets
-c0a01724 r omap_scrm_dt_match_table
-c0a01ecc r omap2_ctrl_data
-c0a01ed4 r omap_mux_dbg_signal_fops
-c0a01f4c r omap_mux_dbg_board_fops
-c0a01fc4 r __func__.28699
-c0a01fd8 r __func__.28741
-c0a01ff0 r __func__.28758
-c0a02008 r __func__.28788
-c0a0201c r __func__.29075
-c0a02030 r __func__.29089
-c0a02044 r __func__.29126
-c0a02054 r __func__.29002
-c0a0206c r __func__.29015
-c0a02088 r __func__.29102
-c0a0209c r __func__.30036
-c0a020bc r __func__.30084
-c0a020d0 r __func__.30078
-c0a020e0 r __func__.36712
-c0a020f4 r omap_pm_ops
-c0a0211c r reg_map
-c0a021f0 r __func__.31257
-c0a0220c r __func__.27253
-c0a02224 r __func__.27271
-c0a0223c r __func__.28011
-c0a0224c r name
-c0a02258 r __func__.27252
-c0a0226c r __func__.36709
-c0a0227c r modck.36708
-c0a02284 r __func__.37246
-c0a022a0 r __func__.28074
-c0a022b8 r __func__.28070
-c0a022d4 r __func__.28103
-c0a022e8 r __func__.28109
-c0a022fc r __func__.28161
-c0a02314 r __func__.28135
-c0a02334 r __func__.25577
-c0a02348 r __func__.23975
-c0a02368 r __func__.23985
-c0a02384 r __func__.30938
-c0a02394 r debug_fops
-c0a0240c r pm_dbg_option_fops
-c0a02484 r pwrdm_suspend_fops
-c0a024fc r pwrdm_state_names
-c0a0250c r __func__.30154
-c0a02524 r __func__.30166
-c0a02544 r __func__.30177
-c0a02568 r __func__.30189
-c0a02584 r __func__.30203
-c0a025a0 r __func__.30215
-c0a025c0 r __func__.30227
-c0a025d8 r __func__.30239
-c0a025f0 r __func__.30248
-c0a0260c r __func__.30257
-c0a02628 r __func__.19941
-c0a0263c r __func__.19953
-c0a02658 r __func__.19965
-c0a02674 r __func__.19977
-c0a0268c r __func__.19988
-c0a026a4 r __func__.28041
-c0a026b8 r __func__.28049
-c0a026c8 r __func__.28057
-c0a026d8 r __func__.28062
-c0a026f4 r __func__.28068
-c0a02710 r __func__.28076
-c0a0272c r __func__.28081
-c0a02744 r __func__.14518
-c0a02758 r __func__.14345
-c0a0276c r __func__.14379
-c0a02784 r __func__.14532
-c0a0279c r __func__.14512
-c0a027b0 r __func__.27364
-c0a027c0 r __func__.27389
-c0a027dc r __func__.27402
-c0a027ec r __func__.27409
-c0a027fc r __func__.34357
-c0a02814 r __func__.34364
-c0a02834 r __func__.27872
-c0a02848 r __func__.29301
-c0a02858 r __func__.36945
-c0a0286c r __func__.36957
-c0a0287c r __func__.36800
-c0a02890 r __func__.26969
-c0a028a8 r __func__.26938
-c0a028c0 r __func__.26928
-c0a028d4 r omap_timer_match
-c0a02ef4 r __func__.27014
-c0a02f08 r __func__.26797
-c0a02f20 r __func__.26943
-c0a02f3c r __func__.26966
-c0a02f58 r __func__.26977
-c0a02f74 r CSWTCH.92
-c0a02f80 r __func__.26836
-c0a02f9c r __func__.26648
-c0a02fb8 r __func__.26712
-c0a02fd8 r omap3plus_pdata
+c0a00068 R linux_banner
+c0a000fc r __func__.5825
+c0a0010c r sqrt_oddadjust
+c0a0012c r sqrt_evenadjust
+c0a0014c r __func__.5807
+c0a0015c r cc_map
+c0a0017c r isa_modes
+c0a0018c r processor_modes
+c0a0020c r sigpage_mapping
+c0a0021c r regoffset_table
+c0a002b4 r user_arm_view
+c0a002c8 r arm_regsets
+c0a00334 r hwcap_str
+c0a00390 r hwcap2_str
+c0a003a8 r proc_arch
+c0a003ec R cpuinfo_op
+c0a003fc R sigreturn_codes
+c0a00418 r handler
+c0a0042c r atags_fops
+c0a004a4 r pmresrn_table.31150
+c0a004b4 r pmresrn_table.31002
+c0a004c0 r scorpion_perf_cache_map
+c0a00568 r scorpion_perf_map
+c0a00590 r krait_perf_cache_map
+c0a00638 r krait_perf_map
+c0a00660 r krait_perf_map_no_branch
+c0a00688 r armv7_a5_perf_cache_map
+c0a00730 r armv7_a5_perf_map
+c0a00758 r armv7_a7_perf_cache_map
+c0a00800 r armv7_a7_perf_map
+c0a00828 r armv7_a8_perf_cache_map
+c0a008d0 r armv7_a8_perf_map
+c0a008f8 r armv7_a9_perf_cache_map
+c0a009a0 r armv7_a9_perf_map
+c0a009c8 r armv7_a12_perf_cache_map
+c0a00a70 r armv7_a12_perf_map
+c0a00a98 r armv7_a15_perf_cache_map
+c0a00b40 r armv7_a15_perf_map
+c0a00b68 r armv7_pmu_probe_table
+c0a00b8c r armv7_pmu_of_device_ids
+c0a013f8 r usermode_action
+c0a01410 r alignment_proc_fops
+c0a01488 r subset.21772
+c0a014a8 r subset.21782
+c0a014b8 r __param_str_alignment
+c0a014c4 r cpu_arch_name
+c0a014ca r cpu_elf_name
+c0a014d0 r l2c220_data
+c0a01518 r omap_types
+c0a0152c r __func__.28508
+c0a01544 r __func__.29284
+c0a01564 r __func__.29289
+c0a01584 r am33xx_control_reg_offsets
+c0a01644 r am43xx_control_reg_offsets
+c0a01720 r omap_scrm_dt_match_table
+c0a01ec8 r omap2_ctrl_data
+c0a01ed0 r omap_mux_dbg_signal_fops
+c0a01f48 r omap_mux_dbg_board_fops
+c0a01fc0 r __func__.28699
+c0a01fd4 r __func__.28741
+c0a01fec r __func__.28758
+c0a02004 r __func__.28788
+c0a02018 r __func__.29075
+c0a0202c r __func__.29089
+c0a02040 r __func__.29126
+c0a02050 r __func__.29002
+c0a02068 r __func__.29015
+c0a02084 r __func__.29102
+c0a02098 r __func__.30036
+c0a020b8 r __func__.30084
+c0a020cc r __func__.30078
+c0a020dc r __func__.36712
+c0a020f0 r omap_pm_ops
+c0a02118 r reg_map
+c0a021ec r __func__.31257
+c0a02208 r __func__.27253
+c0a02220 r __func__.27271
+c0a02238 r __func__.28011
+c0a02248 r name
+c0a02254 r __func__.27252
+c0a02268 r __func__.36709
+c0a02278 r modck.36708
+c0a02280 r __func__.37246
+c0a0229c r __func__.28074
+c0a022b4 r __func__.28070
+c0a022d0 r __func__.28103
+c0a022e4 r __func__.28109
+c0a022f8 r __func__.28161
+c0a02310 r __func__.28135
+c0a02330 r __func__.25577
+c0a02344 r __func__.23975
+c0a02364 r __func__.23985
+c0a02380 r __func__.30938
+c0a02390 r debug_fops
+c0a02408 r pm_dbg_option_fops
+c0a02480 r pwrdm_suspend_fops
+c0a024f8 r pwrdm_state_names
+c0a02508 r __func__.30154
+c0a02520 r __func__.30166
+c0a02540 r __func__.30177
+c0a02564 r __func__.30189
+c0a02580 r __func__.30203
+c0a0259c r __func__.30215
+c0a025bc r __func__.30227
+c0a025d4 r __func__.30239
+c0a025ec r __func__.30248
+c0a02608 r __func__.30257
+c0a02624 r __func__.19941
+c0a02638 r __func__.19953
+c0a02654 r __func__.19965
+c0a02670 r __func__.19977
+c0a02688 r __func__.19988
+c0a026a0 r __func__.28041
+c0a026b4 r __func__.28049
+c0a026c4 r __func__.28057
+c0a026d4 r __func__.28062
+c0a026f0 r __func__.28068
+c0a0270c r __func__.28076
+c0a02728 r __func__.28081
+c0a02740 r __func__.14518
+c0a02754 r __func__.14345
+c0a02768 r __func__.14379
+c0a02780 r __func__.14532
+c0a02798 r __func__.14512
+c0a027ac r __func__.27364
+c0a027bc r __func__.27389
+c0a027d8 r __func__.27402
+c0a027e8 r __func__.27409
+c0a027f8 r __func__.34357
+c0a02810 r __func__.34364
+c0a02830 r __func__.27872
+c0a02844 r __func__.29301
+c0a02854 r __func__.36945
+c0a02868 r __func__.36957
+c0a02878 r __func__.36800
+c0a0288c r __func__.26969
+c0a028a4 r __func__.26938
+c0a028bc r __func__.26928
+c0a028d0 r omap_timer_match
+c0a02ef0 r __func__.27014
+c0a02f04 r __func__.26797
+c0a02f1c r __func__.26943
+c0a02f38 r __func__.26966
+c0a02f54 r __func__.26977
+c0a02f70 r CSWTCH.92
+c0a02f7c r __func__.26836
+c0a02f98 r __func__.26648
+c0a02fb4 r __func__.26712
+c0a02fd4 r omap3plus_pdata
 c0a02fe8 r execdomains_proc_fops
 c0a03060 r tnts
 c0a03090 r __param_str_crash_kexec_post_notifiers
@@ -70318,7 +70318,7 @@ c0d4b848 T __initramfs_start
 c0d4b848 t __irf_start
 c0d4b848 T __security_initcall_end
 c0d4b848 T __security_initcall_start
-c0d4b8ce t __irf_end
+c0d4b8cf t __irf_end
 c0d4b8d0 T __initramfs_size
 c0e00000 D __data_loc
 c0e00000 D __init_end

+ 150 - 150
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S

@@ -34580,155 +34580,155 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f806c
-	.long	0x9f8100
-	.long	0x9f8110
-	.long	0x9f8130
-	.long	0x9f8150
-	.long	0x9f8160
-	.long	0x9f8180
-	.long	0x9f8190
-	.long	0x9f8210
-	.long	0x9f8220
-	.long	0x9f82b8
-	.long	0x9f82cc
-	.long	0x9f8338
-	.long	0x9f8394
-	.long	0x9f83ac
-	.long	0x9f83f0
-	.long	0x9f8400
-	.long	0x9f841c
-	.long	0x9f8430
-	.long	0x9f84a8
-	.long	0x9f84b8
-	.long	0x9f84c4
-	.long	0x9f856c
-	.long	0x9f8594
-	.long	0x9f863c
-	.long	0x9f8664
-	.long	0x9f868c
-	.long	0x9f8734
-	.long	0x9f875c
-	.long	0x9f8804
-	.long	0x9f882c
-	.long	0x9f88d4
-	.long	0x9f88fc
-	.long	0x9f89a4
-	.long	0x9f89cc
-	.long	0x9f8a74
-	.long	0x9f8a9c
-	.long	0x9f8b44
-	.long	0x9f8b6c
-	.long	0x9f8b90
-	.long	0x9f93fc
-	.long	0x9f9414
-	.long	0x9f948c
-	.long	0x9f94ac
-	.long	0x9f94bc
-	.long	0x9f94c8
-	.long	0x9f94ce
-	.long	0x9f94d4
-	.long	0x9f951c
-	.long	0x9f9530
-	.long	0x9f9548
-	.long	0x9f9568
-	.long	0x9f9588
-	.long	0x9f9648
-	.long	0x9f9724
-	.long	0x9f9ecc
-	.long	0x9f9ed4
-	.long	0x9f9f4c
-	.long	0x9f9fc4
-	.long	0x9f9fd8
-	.long	0x9f9ff0
-	.long	0x9fa008
-	.long	0x9fa01c
-	.long	0x9fa030
-	.long	0x9fa044
-	.long	0x9fa054
-	.long	0x9fa06c
-	.long	0x9fa088
-	.long	0x9fa09c
-	.long	0x9fa0bc
-	.long	0x9fa0d0
-	.long	0x9fa0e0
-	.long	0x9fa0f4
-	.long	0x9fa11c
-	.long	0x9fa1f0
-	.long	0x9fa20c
-	.long	0x9fa224
-	.long	0x9fa23c
-	.long	0x9fa24c
-	.long	0x9fa258
-	.long	0x9fa26c
-	.long	0x9fa27c
-	.long	0x9fa284
-	.long	0x9fa2a0
-	.long	0x9fa2b8
-	.long	0x9fa2d4
-	.long	0x9fa2e8
-	.long	0x9fa2fc
-	.long	0x9fa314
-	.long	0x9fa334
-	.long	0x9fa348
-	.long	0x9fa368
-	.long	0x9fa384
-	.long	0x9fa394
-	.long	0x9fa40c
-	.long	0x9fa484
-	.long	0x9fa4fc
-	.long	0x9fa50c
-	.long	0x9fa524
-	.long	0x9fa544
-	.long	0x9fa568
-	.long	0x9fa584
-	.long	0x9fa5a0
-	.long	0x9fa5c0
-	.long	0x9fa5d8
-	.long	0x9fa5f0
-	.long	0x9fa60c
-	.long	0x9fa628
-	.long	0x9fa63c
-	.long	0x9fa658
-	.long	0x9fa674
-	.long	0x9fa68c
-	.long	0x9fa6a4
-	.long	0x9fa6b8
-	.long	0x9fa6c8
-	.long	0x9fa6d8
-	.long	0x9fa6f4
-	.long	0x9fa710
-	.long	0x9fa72c
-	.long	0x9fa744
-	.long	0x9fa758
-	.long	0x9fa76c
-	.long	0x9fa784
-	.long	0x9fa79c
-	.long	0x9fa7b0
-	.long	0x9fa7c0
-	.long	0x9fa7dc
-	.long	0x9fa7ec
-	.long	0x9fa7fc
-	.long	0x9fa814
-	.long	0x9fa834
-	.long	0x9fa848
-	.long	0x9fa858
-	.long	0x9fa86c
-	.long	0x9fa87c
-	.long	0x9fa890
-	.long	0x9fa8a8
-	.long	0x9fa8c0
-	.long	0x9fa8d4
-	.long	0x9faef4
-	.long	0x9faf08
-	.long	0x9faf20
-	.long	0x9faf3c
-	.long	0x9faf58
-	.long	0x9faf74
-	.long	0x9faf80
-	.long	0x9faf9c
-	.long	0x9fafb8
-	.long	0x9fafd8
+	.long	0x9f8068
+	.long	0x9f80fc
+	.long	0x9f810c
+	.long	0x9f812c
+	.long	0x9f814c
+	.long	0x9f815c
+	.long	0x9f817c
+	.long	0x9f818c
+	.long	0x9f820c
+	.long	0x9f821c
+	.long	0x9f82b4
+	.long	0x9f82c8
+	.long	0x9f8334
+	.long	0x9f8390
+	.long	0x9f83a8
+	.long	0x9f83ec
+	.long	0x9f83fc
+	.long	0x9f8418
+	.long	0x9f842c
+	.long	0x9f84a4
+	.long	0x9f84b4
+	.long	0x9f84c0
+	.long	0x9f8568
+	.long	0x9f8590
+	.long	0x9f8638
+	.long	0x9f8660
+	.long	0x9f8688
+	.long	0x9f8730
+	.long	0x9f8758
+	.long	0x9f8800
+	.long	0x9f8828
+	.long	0x9f88d0
+	.long	0x9f88f8
+	.long	0x9f89a0
+	.long	0x9f89c8
+	.long	0x9f8a70
+	.long	0x9f8a98
+	.long	0x9f8b40
+	.long	0x9f8b68
+	.long	0x9f8b8c
+	.long	0x9f93f8
+	.long	0x9f9410
+	.long	0x9f9488
+	.long	0x9f94a8
+	.long	0x9f94b8
+	.long	0x9f94c4
+	.long	0x9f94ca
+	.long	0x9f94d0
+	.long	0x9f9518
+	.long	0x9f952c
+	.long	0x9f9544
+	.long	0x9f9564
+	.long	0x9f9584
+	.long	0x9f9644
+	.long	0x9f9720
+	.long	0x9f9ec8
+	.long	0x9f9ed0
+	.long	0x9f9f48
+	.long	0x9f9fc0
+	.long	0x9f9fd4
+	.long	0x9f9fec
+	.long	0x9fa004
+	.long	0x9fa018
+	.long	0x9fa02c
+	.long	0x9fa040
+	.long	0x9fa050
+	.long	0x9fa068
+	.long	0x9fa084
+	.long	0x9fa098
+	.long	0x9fa0b8
+	.long	0x9fa0cc
+	.long	0x9fa0dc
+	.long	0x9fa0f0
+	.long	0x9fa118
+	.long	0x9fa1ec
+	.long	0x9fa208
+	.long	0x9fa220
+	.long	0x9fa238
+	.long	0x9fa248
+	.long	0x9fa254
+	.long	0x9fa268
+	.long	0x9fa278
+	.long	0x9fa280
+	.long	0x9fa29c
+	.long	0x9fa2b4
+	.long	0x9fa2d0
+	.long	0x9fa2e4
+	.long	0x9fa2f8
+	.long	0x9fa310
+	.long	0x9fa330
+	.long	0x9fa344
+	.long	0x9fa364
+	.long	0x9fa380
+	.long	0x9fa390
+	.long	0x9fa408
+	.long	0x9fa480
+	.long	0x9fa4f8
+	.long	0x9fa508
+	.long	0x9fa520
+	.long	0x9fa540
+	.long	0x9fa564
+	.long	0x9fa580
+	.long	0x9fa59c
+	.long	0x9fa5bc
+	.long	0x9fa5d4
+	.long	0x9fa5ec
+	.long	0x9fa608
+	.long	0x9fa624
+	.long	0x9fa638
+	.long	0x9fa654
+	.long	0x9fa670
+	.long	0x9fa688
+	.long	0x9fa6a0
+	.long	0x9fa6b4
+	.long	0x9fa6c4
+	.long	0x9fa6d4
+	.long	0x9fa6f0
+	.long	0x9fa70c
+	.long	0x9fa728
+	.long	0x9fa740
+	.long	0x9fa754
+	.long	0x9fa768
+	.long	0x9fa780
+	.long	0x9fa798
+	.long	0x9fa7ac
+	.long	0x9fa7bc
+	.long	0x9fa7d8
+	.long	0x9fa7e8
+	.long	0x9fa7f8
+	.long	0x9fa810
+	.long	0x9fa830
+	.long	0x9fa844
+	.long	0x9fa854
+	.long	0x9fa868
+	.long	0x9fa878
+	.long	0x9fa88c
+	.long	0x9fa8a4
+	.long	0x9fa8bc
+	.long	0x9fa8d0
+	.long	0x9faef0
+	.long	0x9faf04
+	.long	0x9faf1c
+	.long	0x9faf38
+	.long	0x9faf54
+	.long	0x9faf70
+	.long	0x9faf7c
+	.long	0x9faf98
+	.long	0x9fafb4
+	.long	0x9fafd4
 	.long	0x9fafe8
 	.long	0x9fb060
 	.long	0x9fb090
@@ -70319,7 +70319,7 @@ kallsyms_offsets:
 	.long	0xc43848
 	.long	0xc43848
 	.long	0xc43848
-	.long	0xc438ce
+	.long	0xc438cf
 	.long	0xc438d0
 	.long	0xcf8000
 	.long	0xcf8000

+ 150 - 150
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S

@@ -34580,155 +34580,155 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f806c
-	.long	0x9f8100
-	.long	0x9f8110
-	.long	0x9f8130
-	.long	0x9f8150
-	.long	0x9f8160
-	.long	0x9f8180
-	.long	0x9f8190
-	.long	0x9f8210
-	.long	0x9f8220
-	.long	0x9f82b8
-	.long	0x9f82cc
-	.long	0x9f8338
-	.long	0x9f8394
-	.long	0x9f83ac
-	.long	0x9f83f0
-	.long	0x9f8400
-	.long	0x9f841c
-	.long	0x9f8430
-	.long	0x9f84a8
-	.long	0x9f84b8
-	.long	0x9f84c4
-	.long	0x9f856c
-	.long	0x9f8594
-	.long	0x9f863c
-	.long	0x9f8664
-	.long	0x9f868c
-	.long	0x9f8734
-	.long	0x9f875c
-	.long	0x9f8804
-	.long	0x9f882c
-	.long	0x9f88d4
-	.long	0x9f88fc
-	.long	0x9f89a4
-	.long	0x9f89cc
-	.long	0x9f8a74
-	.long	0x9f8a9c
-	.long	0x9f8b44
-	.long	0x9f8b6c
-	.long	0x9f8b90
-	.long	0x9f93fc
-	.long	0x9f9414
-	.long	0x9f948c
-	.long	0x9f94ac
-	.long	0x9f94bc
-	.long	0x9f94c8
-	.long	0x9f94ce
-	.long	0x9f94d4
-	.long	0x9f951c
-	.long	0x9f9530
-	.long	0x9f9548
-	.long	0x9f9568
-	.long	0x9f9588
-	.long	0x9f9648
-	.long	0x9f9724
-	.long	0x9f9ecc
-	.long	0x9f9ed4
-	.long	0x9f9f4c
-	.long	0x9f9fc4
-	.long	0x9f9fd8
-	.long	0x9f9ff0
-	.long	0x9fa008
-	.long	0x9fa01c
-	.long	0x9fa030
-	.long	0x9fa044
-	.long	0x9fa054
-	.long	0x9fa06c
-	.long	0x9fa088
-	.long	0x9fa09c
-	.long	0x9fa0bc
-	.long	0x9fa0d0
-	.long	0x9fa0e0
-	.long	0x9fa0f4
-	.long	0x9fa11c
-	.long	0x9fa1f0
-	.long	0x9fa20c
-	.long	0x9fa224
-	.long	0x9fa23c
-	.long	0x9fa24c
-	.long	0x9fa258
-	.long	0x9fa26c
-	.long	0x9fa27c
-	.long	0x9fa284
-	.long	0x9fa2a0
-	.long	0x9fa2b8
-	.long	0x9fa2d4
-	.long	0x9fa2e8
-	.long	0x9fa2fc
-	.long	0x9fa314
-	.long	0x9fa334
-	.long	0x9fa348
-	.long	0x9fa368
-	.long	0x9fa384
-	.long	0x9fa394
-	.long	0x9fa40c
-	.long	0x9fa484
-	.long	0x9fa4fc
-	.long	0x9fa50c
-	.long	0x9fa524
-	.long	0x9fa544
-	.long	0x9fa568
-	.long	0x9fa584
-	.long	0x9fa5a0
-	.long	0x9fa5c0
-	.long	0x9fa5d8
-	.long	0x9fa5f0
-	.long	0x9fa60c
-	.long	0x9fa628
-	.long	0x9fa63c
-	.long	0x9fa658
-	.long	0x9fa674
-	.long	0x9fa68c
-	.long	0x9fa6a4
-	.long	0x9fa6b8
-	.long	0x9fa6c8
-	.long	0x9fa6d8
-	.long	0x9fa6f4
-	.long	0x9fa710
-	.long	0x9fa72c
-	.long	0x9fa744
-	.long	0x9fa758
-	.long	0x9fa76c
-	.long	0x9fa784
-	.long	0x9fa79c
-	.long	0x9fa7b0
-	.long	0x9fa7c0
-	.long	0x9fa7dc
-	.long	0x9fa7ec
-	.long	0x9fa7fc
-	.long	0x9fa814
-	.long	0x9fa834
-	.long	0x9fa848
-	.long	0x9fa858
-	.long	0x9fa86c
-	.long	0x9fa87c
-	.long	0x9fa890
-	.long	0x9fa8a8
-	.long	0x9fa8c0
-	.long	0x9fa8d4
-	.long	0x9faef4
-	.long	0x9faf08
-	.long	0x9faf20
-	.long	0x9faf3c
-	.long	0x9faf58
-	.long	0x9faf74
-	.long	0x9faf80
-	.long	0x9faf9c
-	.long	0x9fafb8
-	.long	0x9fafd8
+	.long	0x9f8068
+	.long	0x9f80fc
+	.long	0x9f810c
+	.long	0x9f812c
+	.long	0x9f814c
+	.long	0x9f815c
+	.long	0x9f817c
+	.long	0x9f818c
+	.long	0x9f820c
+	.long	0x9f821c
+	.long	0x9f82b4
+	.long	0x9f82c8
+	.long	0x9f8334
+	.long	0x9f8390
+	.long	0x9f83a8
+	.long	0x9f83ec
+	.long	0x9f83fc
+	.long	0x9f8418
+	.long	0x9f842c
+	.long	0x9f84a4
+	.long	0x9f84b4
+	.long	0x9f84c0
+	.long	0x9f8568
+	.long	0x9f8590
+	.long	0x9f8638
+	.long	0x9f8660
+	.long	0x9f8688
+	.long	0x9f8730
+	.long	0x9f8758
+	.long	0x9f8800
+	.long	0x9f8828
+	.long	0x9f88d0
+	.long	0x9f88f8
+	.long	0x9f89a0
+	.long	0x9f89c8
+	.long	0x9f8a70
+	.long	0x9f8a98
+	.long	0x9f8b40
+	.long	0x9f8b68
+	.long	0x9f8b8c
+	.long	0x9f93f8
+	.long	0x9f9410
+	.long	0x9f9488
+	.long	0x9f94a8
+	.long	0x9f94b8
+	.long	0x9f94c4
+	.long	0x9f94ca
+	.long	0x9f94d0
+	.long	0x9f9518
+	.long	0x9f952c
+	.long	0x9f9544
+	.long	0x9f9564
+	.long	0x9f9584
+	.long	0x9f9644
+	.long	0x9f9720
+	.long	0x9f9ec8
+	.long	0x9f9ed0
+	.long	0x9f9f48
+	.long	0x9f9fc0
+	.long	0x9f9fd4
+	.long	0x9f9fec
+	.long	0x9fa004
+	.long	0x9fa018
+	.long	0x9fa02c
+	.long	0x9fa040
+	.long	0x9fa050
+	.long	0x9fa068
+	.long	0x9fa084
+	.long	0x9fa098
+	.long	0x9fa0b8
+	.long	0x9fa0cc
+	.long	0x9fa0dc
+	.long	0x9fa0f0
+	.long	0x9fa118
+	.long	0x9fa1ec
+	.long	0x9fa208
+	.long	0x9fa220
+	.long	0x9fa238
+	.long	0x9fa248
+	.long	0x9fa254
+	.long	0x9fa268
+	.long	0x9fa278
+	.long	0x9fa280
+	.long	0x9fa29c
+	.long	0x9fa2b4
+	.long	0x9fa2d0
+	.long	0x9fa2e4
+	.long	0x9fa2f8
+	.long	0x9fa310
+	.long	0x9fa330
+	.long	0x9fa344
+	.long	0x9fa364
+	.long	0x9fa380
+	.long	0x9fa390
+	.long	0x9fa408
+	.long	0x9fa480
+	.long	0x9fa4f8
+	.long	0x9fa508
+	.long	0x9fa520
+	.long	0x9fa540
+	.long	0x9fa564
+	.long	0x9fa580
+	.long	0x9fa59c
+	.long	0x9fa5bc
+	.long	0x9fa5d4
+	.long	0x9fa5ec
+	.long	0x9fa608
+	.long	0x9fa624
+	.long	0x9fa638
+	.long	0x9fa654
+	.long	0x9fa670
+	.long	0x9fa688
+	.long	0x9fa6a0
+	.long	0x9fa6b4
+	.long	0x9fa6c4
+	.long	0x9fa6d4
+	.long	0x9fa6f0
+	.long	0x9fa70c
+	.long	0x9fa728
+	.long	0x9fa740
+	.long	0x9fa754
+	.long	0x9fa768
+	.long	0x9fa780
+	.long	0x9fa798
+	.long	0x9fa7ac
+	.long	0x9fa7bc
+	.long	0x9fa7d8
+	.long	0x9fa7e8
+	.long	0x9fa7f8
+	.long	0x9fa810
+	.long	0x9fa830
+	.long	0x9fa844
+	.long	0x9fa854
+	.long	0x9fa868
+	.long	0x9fa878
+	.long	0x9fa88c
+	.long	0x9fa8a4
+	.long	0x9fa8bc
+	.long	0x9fa8d0
+	.long	0x9faef0
+	.long	0x9faf04
+	.long	0x9faf1c
+	.long	0x9faf38
+	.long	0x9faf54
+	.long	0x9faf70
+	.long	0x9faf7c
+	.long	0x9faf98
+	.long	0x9fafb4
+	.long	0x9fafd4
 	.long	0x9fafe8
 	.long	0x9fb060
 	.long	0x9fb090
@@ -70319,7 +70319,7 @@ kallsyms_offsets:
 	.long	0xd43848
 	.long	0xd43848
 	.long	0xd43848
-	.long	0xd438ce
+	.long	0xd438cf
 	.long	0xd438d0
 	.long	0xdf8000
 	.long	0xdf8000

BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux1


BIN
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_vmlinux2


+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-403
+407

+ 3 - 4
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp

@@ -1444,7 +1444,6 @@
                 compatible = "nxp,pcf85063";
                 reg = <0x51>;
         };
-
 };
 
 &usb {
@@ -1479,7 +1478,7 @@
 &elm {
  status = "okay";
 };
-# 403 "arch/arm/boot/dts/am335x-evm.dts"
+# 402 "arch/arm/boot/dts/am335x-evm.dts"
 &gpmc {
  status = "okay";
  pinctrl-names = "default", "sleep";
@@ -1665,7 +1664,7 @@
   };
  };
 };
-# 509 "arch/arm/boot/dts/am335x-evm.dts" 2
+# 508 "arch/arm/boot/dts/am335x-evm.dts" 2
 
 &tps {
  vcc1-supply = <&vbat>;
@@ -1764,7 +1763,7 @@
   phy-mode = "mii";
 
 };
-# 615 "arch/arm/boot/dts/am335x-evm.dts"
+# 614 "arch/arm/boot/dts/am335x-evm.dts"
 &tscadc {
  status = "okay";
 

+ 0 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts

@@ -344,7 +344,6 @@
                 compatible = "nxp,pcf85063";
                 reg = <0x51>;
         };
-
 };
 #endif
 &usb {

+ 13 - 6
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/lib/.gen_crc32table.cmd

@@ -5,18 +5,23 @@ source_lib/gen_crc32table := lib/gen_crc32table.c
 deps_lib/gen_crc32table := \
   /usr/include/stdc-predef.h \
   /usr/include/stdio.h \
+  /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
   /usr/include/features.h \
   /usr/include/x86_64-linux-gnu/sys/cdefs.h \
   /usr/include/x86_64-linux-gnu/bits/wordsize.h \
+  /usr/include/x86_64-linux-gnu/bits/long-double.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs.h \
   /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
   /usr/include/x86_64-linux-gnu/bits/types.h \
   /usr/include/x86_64-linux-gnu/bits/typesizes.h \
-  /usr/include/libio.h \
-  /usr/include/_G_config.h \
-  /usr/include/wchar.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \
+  /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
+  /usr/include/x86_64-linux-gnu/bits/libio.h \
+  /usr/include/x86_64-linux-gnu/bits/_G_config.h \
+    $(wildcard include/config/h.h) \
+  /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
   /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
   /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
   /usr/include/x86_64-linux-gnu/bits/stdio.h \
@@ -28,9 +33,11 @@ deps_lib/gen_crc32table := \
     $(wildcard include/config/crc32/bit.h) \
     $(wildcard include/config/64bit.h) \
   /usr/include/inttypes.h \
-  /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h \
+  /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h \
   /usr/include/stdint.h \
   /usr/include/x86_64-linux-gnu/bits/wchar.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
+  /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
 
 lib/gen_crc32table: $(deps_lib/gen_crc32table)