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

[Improve][Added][AW-Regular][main.c][Module_FactoryConfig]
2022-08-01 / EASON YANG
Action:
1. Added : InitGPIO() function. initial gpio GPIO3_18 for ACCSU3P5-01-RW reset 4g module.
2. Improve: Default factory setting for 4g and wifi.

File:
1. main.c
Action 1

2. Module_FactoryConfig.c
Action 2

FIRMWARE VERSION: V0.71.XX.XXXX.PX

8009 2 жил өмнө
parent
commit
a1c0ea18b1

+ 52 - 39
EVSE/Projects/AW-Regular/Apps/Module_FactoryConfig.c

@@ -15,12 +15,12 @@
 
 #include 	<unistd.h>
 #include 	<stdarg.h>
-#include    <stdio.h>      /*標準輸入輸出定義*/
-#include    <stdlib.h>     /*標準函數庫定義*/
-#include    <unistd.h>     /*Unix 標準函數定義*/
-#include    <fcntl.h>      /*檔控制定義*/
-#include    <termios.h>    /*PPSIX 終端控制定義*/
-#include    <errno.h>      /*錯誤號定義*/
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
 #include 	<errno.h>
 #include 	<string.h>
 #include	<time.h>
@@ -264,23 +264,25 @@ int main(int argc, char *argv[])
 	{
 		memcpy((char*)SysConfig.ModelName, ShmSysConfigAndInfo->SysConfig.ModelName, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
 		memcpy((char*)SysConfig.SerialNumber, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+		memcpy((char*)SysConfig.CsuBootLoadFwRev, ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev));
 
 		DEBUG_INFO("InitShareMemory OK.\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: enable, 1: disable
-	SysConfig.DefaultLanguage  = 0;		// 0:English	1:Big5				2: GB			3: JN		4: Français 	5: Italiano		6: Español		7: Deutsch		8: Nederland	9: Norsk	10: Suomalainen		11: Svenska		12: Pусский		13: ไทย
-	SysConfig.RfidCardNumEndian = 0;	// 0: Little endian		1: Big endian
+	SysConfig.AuthorisationMode = 0;		// 0: enable, 1: disable
+	SysConfig.DefaultLanguage  = 0;			// 0: English 1: Big5 2: GB 3: JN 4: Français 5: Italiano 6: Español 7: Deutsch 8: Nederland 9: Norsk 10: Suomalainen 11: Svenska 12: Pусский 13: ไทย
+	SysConfig.RfidCardNumEndian = 0;		// 0: Little endian 1: Big endian
+	SysConfig.BillingData.isBilling = 0;	// 0: not for business	1: for business
 
 	// Charging configuration
-	SysConfig.MaxChargingEnergy = 0;	// 0: No limit	Other: 1~65536 KWH
-	SysConfig.MaxChargingPower = 0;		// 0: No limit	Other: 1~65536 KW
-	SysConfig.MaxChargingCurrent = 0;	// 0: Rating value	Other: 1~Rating A
-	SysConfig.MaxChargingDuration = 0;	// 0: No limit	Other: 1~65536 Minute
-	SysConfig.PhaseLossPolicy = 0;		// 0: Charging	1: Stop charging
-	SysConfig.AcPhaseCount = 1;			// 1: One phase	3: Three phase
+	SysConfig.MaxChargingEnergy = 0;		// 0: No limit	Other: 1~65536 KWH
+	SysConfig.MaxChargingPower = 0;			// 0: No limit	Other: 1~65536 KW
+	SysConfig.MaxChargingCurrent = 0;		// 0: Rating value	Other: 1~Rating A
+	SysConfig.MaxChargingDuration = 0;		// 0: No limit	Other: 1~65536 Minute
+	SysConfig.PhaseLossPolicy = 0;			// 0: Charging	1: Stop charging
+	SysConfig.AcPhaseCount = 1;				// 1: One phase	3: Three phase
 
 	// Network configuration
 	strcpy((char*)SysConfig.FtpServer, "");
@@ -294,26 +296,37 @@ int main(int argc, char *argv[])
 	strcpy((char*)SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
 	strcpy((char*)SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
 
-	SysConfig.AthInterface.WifiMode = 2;		// 0: Disable	1: Infrastructure client	2: Infrastructure server	3: Ad-Hoc
-	SysConfig.AthInterface.WifiRssi = 0;		// Wifi rssi value
-	SysConfig.AthInterface.WifiDhcpServer = 0;	// 0: Enable	1: Disable
-	SysConfig.AthInterface.WifiDhcpClient = 0;	// 0: Enable	1: Disable
-
-	strcpy((char*)SysConfig.TelecomInterface.TelcomApn, "");
-	SysConfig.TelecomInterface.TelcomEnabled = 1; 	//0: disable, 1: enable
-	SysConfig.TelecomInterface.TelcomSimStatus = 0;	// SIM card status
-	SysConfig.TelecomInterface.TelcomModemMode = 0;	//0: No services	1: CDMA		2: GSM/GPRS	3: WCDMA	4: GSM/WCDMA	5: TD_SCDMA		6: Unknown
+	// Wifi configuration
+	SysConfig.AthInterface.WifiMode = 2;								// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
+	SysConfig.AthInterface.WifiRssi = 0;								// Wifi rssi value
+	strcpy((char *) SysConfig.AthInterface.WifiSsid, "");				// default: Null
+	strcpy((char *) SysConfig.AthInterface.WifiPassword, "");			// default: Null
+	SysConfig.AthInterface.WifiDhcpServer = 0;							// 0: Enable 1: Disable
+	SysConfig.AthInterface.WifiDhcpClient = 0;							// 0: Enable 1: Disable
+	SysConfig.AthInterface.WifiBroadcastSsid = 1;						// 0: hidden 1: broadcast
+
+	// Telecom configuration
+	strcpy((char*)SysConfig.TelecomInterface.TelcomApn, "");			// default: Null
+	SysConfig.TelecomInterface.TelcomEnabled = 1; 						// 0: disable, 1: enable
+	SysConfig.TelecomInterface.TelcomRssi = 0;							// default: 0
+	SysConfig.TelecomInterface.TelcomSimStatus = 0;						// SIM card status
+	SysConfig.TelecomInterface.TelcomModemMode = 0;						// 0: No services 1: CDMA 2: GSM/GPRS 3: WCDMA 4: GSM/WCDMA 5: TD_SCDMA 6: Unknown
+	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapId, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapPwd, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomModemImei, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomSimImsi, "");		// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomSimIccid, "");		// default: Null
 
 	// Backend configuration
 	strcpy((char*)SysConfig.OcppServerURL, "");
 	sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
-	strcpy((char *)SysConfig.chargePointVendor, "");	// default: Null
+	strcpy((char *)SysConfig.chargePointVendor, "");					// default: Null
 	strcpy((char*)SysConfig.MaintainServerURL, "");
-	SysConfig.BackendConnTimeout=300; 		// 300 seconds
-	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
-	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
-	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
-	//SysConfig.isReqFirstUpgrade = 1;		// 0: Skip first upgrade, 	1: Process first upgrade
+	SysConfig.BackendConnTimeout=300; 									// 300 seconds
+	SysConfig.OfflinePolicy = 2;										// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
+	SysConfig.OfflineMaxChargeEnergy = 0;								// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
+	SysConfig.OfflineMaxChargeDuration = 0; 							// 0: Same as MaxChargeDuration Other: 1~65535 minutes
+	//SysConfig.isReqFirstUpgrade = 1;									// 0: Skip first upgrade, 	1: Process first upgrade
 
 	// Customization configuration item
 	if(SysConfig.ModelName[12] == 'P')
@@ -321,16 +334,16 @@ int main(int argc, char *argv[])
 		// Phihong standard configuration
 		strcpy((char*)SysConfig.OcppServerURL, "");
 		sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
-		strcpy((char *)SysConfig.chargePointVendor, "");	// default: Null
+		strcpy((char *)SysConfig.chargePointVendor, "");				// default: Null
 		strcpy((char*)SysConfig.MaintainServerURL, "wss://ocpp.phihong.com.tw:2013/");
 	}
 	else if(SysConfig.ModelName[12] == 'A')
 	{
 		// ChargeLab customization configuration
-		SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
-		SysConfig.RfidCardNumEndian = 1;	// 0: Little endian	1: Big endian
+		SysConfig.AuthorisationMode = 0;								// 0: enable, 1: disable
+		SysConfig.RfidCardNumEndian = 1;								// 0: Little endian	1: Big endian
 		
-		SysConfig.AthInterface.WifiMode = 1;		// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
+		SysConfig.AthInterface.WifiMode = 1;							// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
 		strcpy((char*)SysConfig.AthInterface.WifiSsid, "ChargeLab-EVC");
 		strcpy((char*)SysConfig.AthInterface.WifiPassword, "evc-pwd-default-21");
 		
@@ -339,15 +352,15 @@ int main(int argc, char *argv[])
 		strcpy((char*)SysConfig.OcppServerURL, "wss://ocpp.io");
 		sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 		strcpy((char*)SysConfig.chargePointVendor, "ChargeLab");
-		SysConfig.OfflinePolicy = 0;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
+		SysConfig.OfflinePolicy = 0;									// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	}
 	else if(SysConfig.ModelName[12] == 'T')
 	{
 		// ChargeLab customization configuration
-		SysConfig.AuthorisationMode = 0;	// 0: enable, 1: disable
-		SysConfig.RfidCardNumEndian = 1;	// 0: Little endian	1: Big endian
+		SysConfig.AuthorisationMode = 0;								// 0: enable, 1: disable
+		SysConfig.RfidCardNumEndian = 1;								// 0: Little endian	1: Big endian
 		
-		SysConfig.AthInterface.WifiMode = 1;		// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
+		SysConfig.AthInterface.WifiMode = 1;							// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
 		strcpy((char*)SysConfig.AthInterface.WifiSsid, "ChargeLab-EVC");
 		strcpy((char*)SysConfig.AthInterface.WifiPassword, "evc-pwd-default-21");
 		
@@ -356,7 +369,7 @@ int main(int argc, char *argv[])
 		strcpy((char*)SysConfig.OcppServerURL, "wss://ocpp.io");
 		sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
 		strcpy((char*)SysConfig.chargePointVendor, "ChargeLab");
-		SysConfig.OfflinePolicy = 0;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
+		SysConfig.OfflinePolicy = 0;									// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
 	}
 	else
 	{

+ 18 - 1
EVSE/Projects/AW-Regular/Apps/main.c

@@ -1729,13 +1729,20 @@ void InitGPIO()
 	system("echo \"out\" > /sys/class/gpio/gpio65/direction");
 	system("echo 0 > /sys/class/gpio/gpio65/value");
 
-	/*POWER (4G/WIFI) RST:GPIO3_14 => H:ON; L:OFF*/
+	/*(FOR ACCSU-01-RW) 4G POWER 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");
 
+	/*(FOR ACCSU3P5-01-RW) 4G POWER RST:GPIO3_18 => H:ON; L:OFF*/
+	system("echo 114 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio114/direction");
+	system("echo 1 > /sys/class/gpio/gpio114/value");
+	sleep(3);
+	system("echo 0 > /sys/class/gpio/gpio114/value");
+
 	DEBUG_INFO("Initial GPIO OK\n");
 }
 
@@ -2274,9 +2281,19 @@ void InitEthernet()
 					if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode != 0) || (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled != 0))
 					{
 						DEBUG_WARN("WIFI/4G module reset.\n");
+
+						// FOR ACCSU-01-RW RESET 4G
 						system("echo 1 > /sys/class/gpio/gpio110/value");
+
+						// FOR ACCSU3P5-01-RW RESET 4G
+						system("echo 1 > /sys/class/gpio/gpio114/value");
 						sleep(3);
+
+						// FOR ACCSU-01-RW RESET 4G
 						system("echo 0 > /sys/class/gpio/gpio110/value");
+
+						// FOR ACCSU3P5-01-RW RESET 4G
+						system("echo 0 > /sys/class/gpio/gpio114/value");
 					}
 
 					ftime(&startTime[0][TMR_IDX_RESET_4G_WIFI_POWER]);

+ 1 - 0
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/.MLO.byteswap.cmd

@@ -0,0 +1 @@
+cmd_MLO.byteswap := ./tools/mkimage -T omapimage -n byteswap -a 0x402F0400 -d spl/u-boot-spl.bin MLO.byteswap  >/dev/null

+ 1 - 0
board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/.MLO.cmd

@@ -0,0 +1 @@
+cmd_MLO := ./tools/mkimage -T omapimage -a 0x402F0400 -d spl/u-boot-spl.bin MLO  >/dev/null