|
@@ -45,6 +45,8 @@ extern "C" {
|
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
|
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
|
|
#define MEMORY_LENGTH_CONFIG 0x1000
|
|
#define MEMORY_LENGTH_CONFIG 0x1000
|
|
#define MEM_REAL_LENGTH 27 //27 two word = 52 word
|
|
#define MEM_REAL_LENGTH 27 //27 two word = 52 word
|
|
|
|
+#define MEM_MODELNAME_ADDRESS 100
|
|
|
|
+#define MEM_MODELNAME_LENGTH 4
|
|
#define bool char
|
|
#define bool char
|
|
//#define DEBUG
|
|
//#define DEBUG
|
|
|
|
|
|
@@ -71,11 +73,13 @@ enum
|
|
|
|
|
|
enum
|
|
enum
|
|
{
|
|
{
|
|
- MainRelay = 0x10,
|
|
|
|
|
|
+ MainRelay1 = 0x10,
|
|
|
|
+ MainRelay2 = 0x11,
|
|
GunRelay = 0x12,
|
|
GunRelay = 0x12,
|
|
MainBridge1 = 0x13,
|
|
MainBridge1 = 0x13,
|
|
MainBridge2 = 0x14,
|
|
MainBridge2 = 0x14,
|
|
MainBridge3 = 0x15,
|
|
MainBridge3 = 0x15,
|
|
|
|
+ MainBridge4 = 0x17,
|
|
};
|
|
};
|
|
|
|
|
|
enum
|
|
enum
|
|
@@ -354,8 +358,10 @@ typedef struct MEM
|
|
uint16_t DC_Correction_Volt[12][2]; // [SMR1 point1~SMR6 point2][ADC,Set Value]
|
|
uint16_t DC_Correction_Volt[12][2]; // [SMR1 point1~SMR6 point2][ADC,Set Value]
|
|
uint16_t GFD_Correction_Resistor[4][2]; // [L-GFD point1~R-GFD point2][ADC,Set Value]
|
|
uint16_t GFD_Correction_Resistor[4][2]; // [L-GFD point1~R-GFD point2][ADC,Set Value]
|
|
uint16_t DCIn_Correction_Volt[2][2]; // [DC In 2 point][ADC,Set Value]
|
|
uint16_t DCIn_Correction_Volt[2][2]; // [DC In 2 point][ADC,Set Value]
|
|
-
|
|
|
|
- } item;
|
|
|
|
|
|
+ uint32_t spare[73]; //
|
|
|
|
+
|
|
|
|
+ uint8_t Modelname[16]; // from 100
|
|
|
|
+ } item;
|
|
} data;
|
|
} data;
|
|
|
|
|
|
struct
|
|
struct
|
|
@@ -363,7 +369,8 @@ typedef struct MEM
|
|
uint8_t update:1; // Update ram content to external flash request
|
|
uint8_t update:1; // Update ram content to external flash request
|
|
uint8_t clear:1; // Clear ram & external flash content request
|
|
uint8_t clear:1; // Clear ram & external flash content request
|
|
uint8_t read:1; // Read external flash content to ram request
|
|
uint8_t read:1; // Read external flash content to ram request
|
|
- uint8_t reserved:5;
|
|
|
|
|
|
+ uint8_t modelname:1; // Update modelname to external flash request
|
|
|
|
+ uint8_t reserved:4;
|
|
} op_bits;
|
|
} op_bits;
|
|
|
|
|
|
} Module_Config;
|
|
} Module_Config;
|
|
@@ -392,6 +399,12 @@ struct Gun_Gfd_Check
|
|
uint8_t Rfd_State_Fail;
|
|
uint8_t Rfd_State_Fail;
|
|
uint32_t SMR_Voltage_Fail;
|
|
uint32_t SMR_Voltage_Fail;
|
|
uint8_t bFirstGfd;
|
|
uint8_t bFirstGfd;
|
|
|
|
+ float UP_BRIDGE_OP_V;
|
|
|
|
+ float DN_BRIDGE_OP_V;
|
|
|
|
+ float U1_V;
|
|
|
|
+ float U2_V;
|
|
|
|
+ uint32_t P2PE_GFD;
|
|
|
|
+ uint32_t N2PE_GFD;
|
|
};
|
|
};
|
|
|
|
|
|
extern const uint16_t nRPM_Tbl[11][2];
|
|
extern const uint16_t nRPM_Tbl[11][2];
|
|
@@ -410,9 +423,11 @@ extern uint8_t bRelayFeedback;
|
|
extern uint8_t nBoard_Addr;
|
|
extern uint8_t nBoard_Addr;
|
|
extern float c_vadc[2];
|
|
extern float c_vadc[2];
|
|
extern uint8_t nGun;
|
|
extern uint8_t nGun;
|
|
|
|
+extern uint8_t ModelName[15];
|
|
extern bool GainCaliFlag;
|
|
extern bool GainCaliFlag;
|
|
|
|
|
|
-#define vsense1 24.42 // for ADC1 (330 / 4095 / 0.0033) = 24.42
|
|
|
|
|
|
+// #define vsense1 24.42 // for ADC1 (330 / 4095 / 0.0033) = 24.42
|
|
|
|
+#define vsense1 36.63 // for ADC1 (330 / 4095 / 0.0022) = 36.63 2024/11/4
|
|
#define vsense2 0.002919
|
|
#define vsense2 0.002919
|
|
//#define vsense3 4.118 // for current (330 / 4095 / 0.01957 ) = 4.118
|
|
//#define vsense3 4.118 // for current (330 / 4095 / 0.01957 ) = 4.118
|
|
#define vsense3 24448.7 // 5000 / (5.1*4.01) * 100 = 24448.7 (5000:CT �I��v 5.1:�q���q�� 20.5K/5.11K=4.01 OP���v)
|
|
#define vsense3 24448.7 // 5000 / (5.1*4.01) * 100 = 24448.7 (5000:CT �I��v 5.1:�q���q�� 20.5K/5.11K=4.01 OP���v)
|
|
@@ -454,11 +469,17 @@ extern bool GainCaliFlag;
|
|
#define GFD_FAIL 2
|
|
#define GFD_FAIL 2
|
|
#define GFD_WARNING 3
|
|
#define GFD_WARNING 3
|
|
//<<<<<<< HEAD
|
|
//<<<<<<< HEAD
|
|
-#define GFD_TEST_TIMES 15
|
|
|
|
|
|
+#define GFD_BALANCE_TEST_COUNT 3
|
|
|
|
+#define GFD_UNBALANCE_TEST_COUNT 0
|
|
|
|
+#define GFD_UNBALANCE_CABLECHK_TEST_COUNT 1
|
|
#define GFD_SLEF_TEST_RESISTOR_TOLERANCE 45000 // 30K -> 45K ohm
|
|
#define GFD_SLEF_TEST_RESISTOR_TOLERANCE 45000 // 30K -> 45K ohm
|
|
//#define GFD_SELF_TEST_RESISTOR 55000
|
|
//#define GFD_SELF_TEST_RESISTOR 55000
|
|
#define GFD_SELF_TEST_RESISTOR (50000 + GFD_SLEF_TEST_RESISTOR_TOLERANCE) // 95K ohm
|
|
#define GFD_SELF_TEST_RESISTOR (50000 + GFD_SLEF_TEST_RESISTOR_TOLERANCE) // 95K ohm
|
|
#define GFD_FILTER_LIMIT 16
|
|
#define GFD_FILTER_LIMIT 16
|
|
|
|
+#define IDLE 0
|
|
|
|
+#define CABLE_CHECK 1
|
|
|
|
+#define PRECHARGE 2
|
|
|
|
+#define CHARGE 3
|
|
//=======
|
|
//=======
|
|
//#define GFD_OPT_COUP_RESISTER 35000
|
|
//#define GFD_OPT_COUP_RESISTER 35000
|
|
//#define GFD_TEST_TIMES 15
|
|
//#define GFD_TEST_TIMES 15
|
|
@@ -468,6 +489,8 @@ extern bool GainCaliFlag;
|
|
#define WAIT_FOR_RESISTER_CALC 30 // mini_second
|
|
#define WAIT_FOR_RESISTER_CALC 30 // mini_second
|
|
#define WAIT_FOR_RESISTER_CALC_LONG 50
|
|
#define WAIT_FOR_RESISTER_CALC_LONG 50
|
|
#define WAIT_FOR_RESISTER_CALC_FAST 30
|
|
#define WAIT_FOR_RESISTER_CALC_FAST 30
|
|
|
|
+#define WAIT_FOR_GFD_CALC 1000
|
|
|
|
+#define GFD_SWITCH_TIME 18
|
|
|
|
|
|
#define MCU_DATA 0
|
|
#define MCU_DATA 0
|
|
#define METER_DATA 1
|
|
#define METER_DATA 1
|
|
@@ -476,24 +499,29 @@ extern bool GainCaliFlag;
|
|
#define DEBUG_PRINTF 0
|
|
#define DEBUG_PRINTF 0
|
|
#define GFD_SELF_TEST 1
|
|
#define GFD_SELF_TEST 1
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
#define AC_INPUT_1ST_POINT 2800 // OVP +10
|
|
#define AC_INPUT_1ST_POINT 2800 // OVP +10
|
|
#define AC_INPUT_2ND_POINT 2200 // UVP -10
|
|
#define AC_INPUT_2ND_POINT 2200 // UVP -10
|
|
#define AC_INPUT_3RD_POINT 1600 // UVP -10
|
|
#define AC_INPUT_3RD_POINT 1600 // UVP -10
|
|
#define DC_OUTPUT_1ST_POINT 9500
|
|
#define DC_OUTPUT_1ST_POINT 9500
|
|
#define DC_OUTPUT_2ND_POINT 1500
|
|
#define DC_OUTPUT_2ND_POINT 1500
|
|
|
|
|
|
-#define GFD_RESISTOR_WARNING 100
|
|
|
|
-#define GFD_RESISTOR_PRE_WARNING 500
|
|
|
|
|
|
+#define GFD_RESISTOR_FAULT 100
|
|
|
|
+#define GFD_RESISTOR_WARNING 500
|
|
#define EVSE_MAX_OUTPUT_VOLTAGE 950
|
|
#define EVSE_MAX_OUTPUT_VOLTAGE 950
|
|
-#define GFD_EXTRA_FAIL_RESISTOR 5000
|
|
|
|
|
|
+#define GFD_TOLERANCE_RESISTOR 5000
|
|
|
|
|
|
#define GFD_RESISTOR_COEFFICIENT 73.8 // 73.8 , 51.3
|
|
#define GFD_RESISTOR_COEFFICIENT 73.8 // 73.8 , 51.3
|
|
#define GFD_SENSE_VOLTAGE_UP_LIMIT 1.75 // 1.75
|
|
#define GFD_SENSE_VOLTAGE_UP_LIMIT 1.75 // 1.75
|
|
#define GFD_SENSE_VOLTAGE_DOWN_LIMIT 1.55 // 1.55
|
|
#define GFD_SENSE_VOLTAGE_DOWN_LIMIT 1.55 // 1.55
|
|
#define GFD_SENSE_CENTER_VOLTAGE 1.65
|
|
#define GFD_SENSE_CENTER_VOLTAGE 1.65
|
|
-#define GFD_WORKING_VOLTAGE 2000 // 200v, for Safety Test : 1400
|
|
|
|
|
|
+#define GFD_WORKING_VOLTAGE 1400 // 200v, for Safety Test : 1400
|
|
|
|
+
|
|
|
|
+#define Rsense 18
|
|
|
|
+#define R1 100000
|
|
|
|
+
|
|
|
|
+#define GFD_OFF 0x00
|
|
|
|
+#define GFD_BALANCE 0x01
|
|
|
|
+#define GFD_UNBALANCE 0x02
|
|
|
|
|
|
//#define AC_CORRECT_GAIN_MAX_NUM 6
|
|
//#define AC_CORRECT_GAIN_MAX_NUM 6
|
|
#define DC_CORRECT_GAIN_MAX_NUM 6
|
|
#define DC_CORRECT_GAIN_MAX_NUM 6
|
|
@@ -747,6 +775,34 @@ extern struct OP_FLAG
|
|
|
|
|
|
}OpFlag;
|
|
}OpFlag;
|
|
|
|
|
|
|
|
+extern struct GFD
|
|
|
|
+{
|
|
|
|
+ uint32_t IsolationVoltage;
|
|
|
|
+ uint8_t GfdAvgCount[2];
|
|
|
|
+ uint8_t ToggleBridge[2];
|
|
|
|
+ uint8_t operation[2];
|
|
|
|
+ uint8_t GfdMode[2];
|
|
|
|
+ uint8_t GfdOldMode[2];
|
|
|
|
+ uint8_t Gfdcount[2];
|
|
|
|
+ uint8_t SCBwaitfg[2]; //self check banlance mdoe wait flag
|
|
|
|
+ uint8_t SCBwaitcount[2];
|
|
|
|
+ uint8_t Gfdtimer;
|
|
|
|
+ uint8_t GfdSwitch;
|
|
|
|
+ float TotalGFDvalue[2];
|
|
|
|
+ float UpBridgeMaxV[2];
|
|
|
|
+ float UpBridgeMinV[2];
|
|
|
|
+ float DnBridgeMaxV[2];
|
|
|
|
+ float DnBridgeMinV[2];
|
|
|
|
+ uint32_t MaxP2PE[2];
|
|
|
|
+ uint32_t MinP2PE[2];
|
|
|
|
+ uint32_t MaxN2PE[2];
|
|
|
|
+ uint32_t MinN2PE[2];
|
|
|
|
+ uint8_t maxcount[2];
|
|
|
|
+ uint8_t mincount[2];
|
|
|
|
+ float maxgfdcount[2];
|
|
|
|
+ float mingfdcount[2];
|
|
|
|
+}Gfd;
|
|
|
|
+
|
|
extern struct EXT_inupt
|
|
extern struct EXT_inupt
|
|
{
|
|
{
|
|
bool EXTI_SMR1_Flag:1;
|
|
bool EXTI_SMR1_Flag:1;
|
|
@@ -783,6 +839,7 @@ extern uint32_t canError;
|
|
|
|
|
|
extern uint8_t temp1,temp2,temp3,temp4;
|
|
extern uint8_t temp1,temp2,temp3,temp4;
|
|
extern float temp5,temp6,temp7,temp8;
|
|
extern float temp5,temp6,temp7,temp8;
|
|
|
|
+extern uint8_t Cmdcount;
|
|
/* USER CODE END Private defines */
|
|
/* USER CODE END Private defines */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
#ifdef __cplusplus
|