Browse Source

v235

0x78000011 Bug fixed
simon bischof 7 years ago
parent
commit
ea61ec65f1

+ 2 - 2
BMS Master/.cproject

@@ -113,8 +113,6 @@
 						</tool>
 					</fileInfo>
 					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.MPC5646C_readme.txt" name="MPC5646C_readme.txt" rcbsApplicability="disable" resourcePath="MPC5646C_readme.txt" toolsToInvoke=""/>
-					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Headers/Exceptions_p1.h" name="Exceptions_p1.h" rcbsApplicability="disable" resourcePath="Project_Headers/Exceptions_p1.h" toolsToInvoke=""/>
-					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Headers/IntcInterrupts_p1.h" name="IntcInterrupts_p1.h" rcbsApplicability="disable" resourcePath="Project_Headers/IntcInterrupts_p1.h" toolsToInvoke=""/>
 					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Settings/Startup_Code/MPC5646C_init_flash.c" name="MPC5646C_init_flash.c" rcbsApplicability="disable" resourcePath="Project_Settings/Startup_Code/MPC5646C_init_flash.c" toolsToInvoke="com.freescale.ppc.toolchain.compiler.1383547014.913134573">
 						<tool errorParsers="" id="com.freescale.ppc.toolchain.compiler.1383547014.913134573" name="PowerPC Compiler" superClass="com.freescale.ppc.toolchain.compiler.1383547014">
 							<inputType id="com.freescale.ppc.toolchain.compiler.base.input.320462651" name="com.freescale.ppc.toolchain.cf Compiler Input" superClass="com.freescale.ppc.toolchain.compiler.base.input"/>
@@ -122,6 +120,8 @@
 						</tool>
 					</fileInfo>
 					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Settings/Linker_Files/MPC5646C_FLASH.lcf" name="MPC5646C_FLASH.lcf" rcbsApplicability="disable" resourcePath="Project_Settings/Linker_Files/MPC5646C_FLASH.lcf" toolsToInvoke=""/>
+					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Headers/Exceptions_p1.h" name="Exceptions_p1.h" rcbsApplicability="disable" resourcePath="Project_Headers/Exceptions_p1.h" toolsToInvoke=""/>
+					<fileInfo id="com.freescale.ppc.debug.toolchain.configuration.503301665.Project_Headers/IntcInterrupts_p1.h" name="IntcInterrupts_p1.h" rcbsApplicability="disable" resourcePath="Project_Headers/IntcInterrupts_p1.h" toolsToInvoke=""/>
 					<sourceEntries>
 						<entry excluding="MPC5646C_readme.txt|Project_Settings/Startup_Code/MPC5646C_init_flash.c|Project_Settings/Linker_Files/MPC5646C_FLASH.lcf|Prefix/MPC5646C_FLASH_VLE_SC.prefix" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
 					</sourceEntries>

+ 1 - 1
BMS Master/Project_Headers/BMS_CANx_Tools.h

@@ -138,7 +138,7 @@ int16_t 	CAN1_tx_Data_to_Inverter		(uint64_t timestamp,BMS_CAN1_INVERTER_TX* dat
 uint16_t 	CAN1_init_tx_structure			(BMS_CAN1_INVERTER_TX* tx_struct);
 int16_t 	CAN1_send_request_telegram(uint32_t requestId) ;
 uint16_t 	CAN1_wait_for_response(float* value); 
-uint32_t delay_CAN1_ms(uint64_t timestamp,uint32_t delay_ms);
+uint64_t delay_CAN1_ms(uint64_t timestamp,uint32_t delay_ms);
 uint16_t CAN_Tx_MasterX_BMS(MASTER_CAN0_STRUCT_t* s, uint8_t SlaveNummer, uint8_t MasterAlive, uint8_t SetMode, uint32_t Balancer );
 
 uint16_t CAN_Tx_System300( uint16_t IDSEARCH );

+ 2 - 0
BMS Master/Project_Headers/BMS_Defines.h

@@ -177,6 +177,8 @@
 #define BMS_ERROR_STACK_UI_CURRENT_INCONSIST			0x04
 #define BMS_ERROR_STACK_UI_VOLTAGE_INCONSIST			0x08
 #define BMS_ERROR_STACK_UI_OVER_VOLTAGE					0x10
+#define BMS_ERROR_STACK_UI_SUPPLY_VOLTAGE				0x20
+#define BMS_ERROR_STACK_UI_OFFSET_ERROR					0x40
 
 #define BMS_ERROR_STACK_MASTER_OK						0
 #define BMS_ERROR_STACK_MASTER_VCC_12V					0x001

+ 2 - 1
BMS Master/Project_Headers/BMS_Master.h

@@ -87,7 +87,7 @@ extern CAN_MAILBOX CAN_Rx_RCT_INVERTER;
 
 	
 	uint16_t init_master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,BMS_SLAVE_CONFIGURATION_t* cellConfig,BMS_UI_CONFIGURATION_t* uiConfig);
-	uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint32_t time);
+	uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint64_t time);
 	uint16_t init_master_operation_fsm(BMS_MASTER_OPERATION_t* opFsm);
 	uint16_t Master_operation_fsm(MASTER_CAN0_STRUCT_t* canFsm,uint32_t time,BMS_MASTER_OPERATION_t* opFsm);
 	void set_slave_cell_connection_state(MASTER_CAN0_STRUCT_t* s,uint8_t slaveNr,CELL_STATE_t* cell_state);
@@ -218,6 +218,7 @@ extern CAN_MAILBOX CAN_Rx_RCT_INVERTER;
 	uint32_t pushInverterCurrentFIFO(MASTER_CAN0_STRUCT_t* s);
 	uint32_t BMS_Set_Error_Check_current_consitency(MASTER_CAN0_STRUCT_t* s);
 	uint32_t BMS_Set_Error_Check_voltage_inconsitency(MASTER_CAN0_STRUCT_t* s);
+	uint32_t BMS_set_Error_Check_UI_Flags(MASTER_CAN0_STRUCT_t* s) ;
 	
 	uint32_t initSoCFifo(MASTER_CAN0_STRUCT_t* s); 
 	uint32_t pushSoCFiFo(MASTER_SOC_ESTIMATOR_t* est);

+ 16 - 8
BMS Master/Project_Headers/BMS_Typedefs.h

@@ -681,10 +681,10 @@ typedef enum  {
 typedef struct {
 	MASTER_RUNNING_MODE RunningMode;
 	MASTER_CAN0_OPERATION_MODE OperationMode;
-	uint32_t OperationModeTimestamp;
+	uint64_t OperationModeTimestamp;
 	MASTER_CAN0_ES1_STATE ErrorState1fsm;
-	uint32_t ErrorState2Timestamp;
-	uint32_t ErrorState3Timestamp;
+	uint64_t ErrorState2Timestamp;
+	uint64_t ErrorState3Timestamp;
 	MASTER_CAN0_ES2_STATE ErrorState2fsm;
 	MASTER_CAN0_ES3_STATE ErrorState3fsm;
 	uint32_t onCounter; // counter for relay closed time
@@ -790,7 +790,7 @@ typedef struct {
 
 typedef struct {
 	uint8_t recoveryPending;
-	uint32_t recoveryTimestamp;// used to determine timespan for inverter to be able to fix errors
+	uint64_t recoveryTimestamp;// used to determine timespan for inverter to be able to fix errors
 }BMS_ERROR_RECOVERY_STRUCT_t;
 
 typedef struct {
@@ -884,10 +884,18 @@ typedef struct {
 	SLAVE_ERROR_STRUCT_t SlaveCanCommuniationError;
 }BMS_CAN0_SLAVE_t;
 
+typedef struct {
+	uint8_t OffsetError:1;
+	uint8_t SupplyError:1;
+	uint8_t RelayOpen:1;
+	uint8_t reserved:5;
+}BMS_CAN0_UI_ERRORS_t;
+
 typedef struct {
 	uint16_t Ubatt;
 	int16_t Ibatt;
 	uint8_t	 Checksum;
+	BMS_CAN0_UI_ERRORS_t Errors;
 	uint32_t UbattFiFo[UI_VOLTAGE_FIFO_SIZE];
 	uint32_t SystemVoltageFiFo[UI_VOLTAGE_FIFO_SIZE];
 	int16_t IbattFiFo[UI_CURRENT_FIFO_SIZE];
@@ -1033,7 +1041,7 @@ typedef struct {
 	BMS_CAN0_UI_t	UI_Board;
 	BMS_CAN0_SLAVE_t tempSlave;
 	BMS_CAN0_UI_t	temp_UI_Board;	
-	uint32_t reset_test_timestamp;
+	uint64_t reset_test_timestamp;
 	uint32_t	StateOfCharge;			// SOC in mAs
 	uint16_t minCellVoltage;
 	uint16_t maxCellVoltage;
@@ -1048,9 +1056,9 @@ typedef struct {
 	BMS_CAN1_INVERTER inverter;
 	BMS_RCT_INVERTER_t inverterState;
 	uint8_t slaveSelect;
-	uint32_t timestamp;
-	uint32_t time;
-	uint32_t cycleTimestamp;
+	uint64_t timestamp;
+	uint64_t time;
+	uint64_t cycleTimestamp;
 	uint8_t transmission_pending;
 	uint8_t cycleCounter;
 	uint32_t systemVoltage;

+ 8 - 124
BMS Master/ReferencedRSESystems.xml

@@ -5,12 +5,12 @@ This file is automatically generated and updated by the Eclipse IDE.-->
 <APSC_Memento>
 <host>
 <properties>
-<property key="hidden.applicator.com.freescale.debugger.applicator.launchconfiguration.lc.Test_FLASH_PnE U-MultiLink.proj.BMS Master" value="com.freescale.debugger.applicator.launchconfiguration.lc.Test_FLASH_PnE U-MultiLink.proj.BMS Master"/>
+<property key="hidden.applicator.com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master" value="com.freescale.debugger.applicator.launchconfiguration.lc.BMS Master FLASH.proj.BMS Master"/>
 <property key="host.address" value=""/>
 <property key="host.defaultEncoding" value=""/>
-<property key="host.defaultUser" value="mb0005"/>
+<property key="host.defaultUser" value="le8041"/>
 <property key="host.description" value=""/>
-<property key="host.name" value="Test_FLASH_PnE U-MultiLink"/>
+<property key="host.name" value="Flash_debug"/>
 <property key="host.promptable" value="false"/>
 <property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware"/>
 <property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
@@ -18,19 +18,15 @@ This file is automatically generated and updated by the Eclipse IDE.-->
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.CW_SHADOWED_PREF.Embedded Initialization.simulator" value=""/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.PhysicalConnectionAttributeBase" value="com.pemicro.mcu.debug.connections.pne.eppc."/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.SimulatorConnectionAttributeBase" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.logData" value="false"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.CommandLineArgs" value="eppc_icd "/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.ConfigFile" value=""/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.Library" value="eppc_pne_gdi"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_CHECKBOX" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ALTERNATIVE_ALGORITHM_PATH" value=""/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_AUTO_SYNC" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_CURRENTDEVICE" value="MPC5646C"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_CURRENT_ALGORITHM_INDEX" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_DO_DEBUG_OUTPUT" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ENABLE_FLASH_PROGRAMMING_DIALOG" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_ERASE_PROGRAM_WITHOUT_ASKING" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.RESET_DELAY" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerDownDelay" value="250"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_PowerUpDelay" value="250"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_CyclonePro_currentvoltage" value="255"/>
@@ -41,20 +37,17 @@ This file is automatically generated and updated by the Eclipse IDE.-->
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_FREQ_OSJTAG" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerDownDelay" value="250"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_Multilink_PowerUpDelay" value="1000"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PCI_DELAY" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT" value="21"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT_NAME_STRING" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_RESET_DELAY" value="200"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT_NAME_STRING" value="PE5655057"/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_RESET_DELAY" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP" value="127.0.0.1"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_IP_ENABLED" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD" value="127.0.0.1"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_SPECIFY_NETWORKCARD_ENABLED" value="0"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_USE_CYCLONEPRO_RELAYS" value="1"/>
 <property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_interface_selection" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.UUID" value="065e3741-55aa-46d6-83f9-73eee63315a1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.names_of_user_added_attributes" value=""/>
+<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.UUID" value="5ceeed42-818d-4b19-a220-3600a3bfcb96"/>
 <property key="propertySet.[cw.dbg.conn].rseSystemId" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.gdi].logData" value="false"/>
 <property key="propertySet.[cw.dbg.ct.targetConnLost].RetryConnectionOn" value="false"/>
 <property key="propertySet.[cw.dbg.ct.targetConnLost].RetryTimeout" value="20"/>
 <property key="propertySet.[cw.dbg.ct.targetConnLost].RetryWithTimeoutOn" value="false"/>
@@ -62,8 +55,8 @@ This file is automatically generated and updated by the Eclipse IDE.-->
 <property key="propertySet.[cw.dbg.ct.targetConnLost].retryPromptUserActionOn" value="true"/>
 <property key="propertySet.[cw.dbg.ct].Connection Type" value="com.pemicro.mcu.debug.connections.pne.eppc"/>
 <property key="propertySet.[cw.dbg.main].templateId" value="None"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.140207081647+0100.1"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1397046997587"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.170203142503+0100"/>
+<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1486128577361"/>
 </properties>
 </host>
 <host>
@@ -107,113 +100,4 @@ This file is automatically generated and updated by the Eclipse IDE.-->
 <property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1391757409961"/>
 </properties>
 </host>
-<host>
-<properties>
-<property key="hidden.applicator.com.freescale.debugger.applicator.launchconfiguration.lc.Test_RAM_PnE U-MultiLink.proj.BMS Master" value="com.freescale.debugger.applicator.launchconfiguration.lc.Test_RAM_PnE U-MultiLink.proj.BMS Master"/>
-<property key="host.address" value=""/>
-<property key="host.defaultEncoding" value=""/>
-<property key="host.defaultUser" value="mb0005"/>
-<property key="host.description" value=""/>
-<property key="host.name" value="Test_RAM_PnE U-MultiLink"/>
-<property key="host.promptable" value="false"/>
-<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware"/>
-<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
-<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.CW_SHADOWED_PREF.Embedded Initialization.simulator" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.PhysicalConnectionAttributeBase" value="com.pemicro.mcu.debug.connections.pne.eppc."/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.SimulatorConnectionAttributeBase" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.freescale.cdt.debug.cw.core.settings.GdiConnection.Common.logData" value="false"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.CommandLineArgs" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.ConfigFile" value=""/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.Library" value="eppc_pne_gdi"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_CURRENTDEVICE" value="MPC5646C"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.PEDEBUG_DO_DEBUG_OUTPUT" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.RESET_DELAY" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PCI_DELAY" value="0"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_PORT" value="21"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_RESET_DELAY" value="200"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.STARTUP_interface_selection" value="1"/>
-<property key="propertySet.[com.pemicro.mcu.debug.connections.pne.eppc].com.pemicro.mcu.debug.connections.pne.eppc.names_of_user_added_attributes" value=""/>
-<property key="propertySet.[cw.dbg.conn].rseSystemId" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.gdi].logData" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryConnectionOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryTimeout" value="20"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].RetryWithTimeoutOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].TerminateConnectionOn" value="false"/>
-<property key="propertySet.[cw.dbg.ct.targetConnLost].retryPromptUserActionOn" value="true"/>
-<property key="propertySet.[cw.dbg.ct].Connection Type" value="com.pemicro.mcu.debug.connections.pne.eppc"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.140207081647+0100"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1391757409961"/>
-</properties>
-</host>
-<host>
-<properties>
-<property key="host.address" value=""/>
-<property key="host.defaultEncoding" value=""/>
-<property key="host.defaultUser" value="mb0005"/>
-<property key="host.description" value=""/>
-<property key="host.name" value="Test_RAM_PnE U-MultiLink Target"/>
-<property key="host.promptable" value="false"/>
-<property key="host.type" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system"/>
-<property key="propertySet.[OptionalPropertySet].enableConnectorServicesPropertyPage" value="false"/>
-<property key="propertySet.[OptionalPropertySet].enableGenericHostPropertyPage" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.initPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C_VLE.tcl"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.memConfigPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C.mem"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.resetOrder" value="0"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.1.e200z0h.resetOrder" value="1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.1.e200z0h.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].enableHSSTIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].enableNetworkIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].enableSerialIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].enableStopTransferIOModelConfig" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].ethernetController" value="UEC1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].executePerCoreReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].executePerProcessorReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].executeReset" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkDebuggerAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkGateway" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkMACAddress" value="**-**-**-**-**-**"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkNetMask" value="255.255.255.255"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkTargetAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].networkUDPPort" value="1234"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].noIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].targetIsPalladium" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].useNetworkGateway" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].useNetworkMACAddress" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard.ondemand].useNetworkUDPPort" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.initPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C_VLE.tcl"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.memConfigPath" value="${ProjDirPath}/Project_Settings/Debugger/MPC5646C.mem"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.0.e200z4.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.1.e200z0h.runOutOfReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useInitFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].com.freescale.cw.system.eppc.MPC56xxB.MPC5646C.useMemoryConfigFile" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableHSSTIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableNetworkIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableSerialIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].enableStopTransferIOModelConfig" value="true"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].ethernetController" value="UEC1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].executeReset" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkDebuggerAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkGateway" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkMACAddress" value="**-**-**-**-**-**"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkNetMask" value="255.255.255.255"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkTargetAddress" value="127.0.0.1"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].networkUDPPort" value="1234"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].noIOModelConfig" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].targetIsPalladium" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkGateway" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkMACAddress" value="false"/>
-<property key="propertySet.[cw.dbg.ct.bareboard].useNetworkUDPPort" value="false"/>
-<property key="propertySet.[cw.dbg.main].systemType" value="com.freescale.cw.system.eppc.MPC56xxB.MPC5646C"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.HostID" value="com.freescale.cdt.debug.cw.core.ui.rse.systemtype.bareboard.hardware.system.140207081647+0100"/>
-<property key="propertySet.[cw.ide.settingscache].hidden.TimeStamp" value="1391757409961"/>
-</properties>
-</host>
 </APSC_Memento>

+ 3 - 0
BMS Master/Sources/BMS_CAN0_Mail_Box.c

@@ -1045,6 +1045,9 @@ uint16_t saveSlaveUI_Master_telegram(BMS_CAN0_SLAVE_t* Slave,BMS_CAN0_UI_t* UI_B
 	Slave->SlaveMode=Master_Rx7_buff[0] & 0x1F;
 	UI_Board->Ubatt=(Master_Rx7_buff[1] << 8 )+ Master_Rx7_buff[2];
 	UI_Board->Ibatt=(Master_Rx7_buff[3] << 8 )+ Master_Rx7_buff[4];
+	UI_Board->Errors.OffsetError=(Master_Rx7_buff[5] & 0x01 );
+	UI_Board->Errors.SupplyError=(Master_Rx7_buff[5] & 0x02 );
+	UI_Board->Errors.RelayOpen=(Master_Rx7_buff[5] & 0x04 );
 	UI_Board->Checksum=Master_Rx7_buff[7];	
 	return TRUE;
 }

+ 1 - 1
BMS Master/Sources/BMS_CAN1_Tools.c

@@ -86,7 +86,7 @@ int16_t CAN1_tx_Data_to_Inverter(uint64_t timestamp,BMS_CAN1_INVERTER_TX* data)
 	return ReturnResult;
 }
 
-uint32_t delay_CAN1_ms(uint64_t timestamp,uint32_t delay_ms) {
+uint64_t delay_CAN1_ms(uint64_t timestamp,uint32_t delay_ms) {
 	while(timestamp + delay_ms >Global_1msCounter) {
 		// do nothing
 	}

+ 1 - 1
BMS Master/Sources/BMS_Can_ID_init.c

@@ -31,7 +31,7 @@ uint32_t BMS_Can_ID_init_recofigure_CAN_IDs(MASTER_CAN0_STRUCT_t* s) {
 	uint8_t MasterAlive=0;
 	uint8_t SetMode = 16; // This is stand By mode
 	uint32_t Balancer = 0; // no balancing during startup
-	uint32_t StartTime =0;
+	uint64_t StartTime =0;
 	uint16_t IDSEARCH = 1;
 //	uint16_t LFT;
 	uint8_t k=0;

+ 5 - 3
BMS Master/Sources/BMS_Master.c

@@ -733,7 +733,7 @@ uint8_t check_if_all_values_are_initialized(MASTER_CAN0_STRUCT_t* s) {
  * It requests Data from the Slaves by sending an Request telegram, and saves the received data in the
  * provided MASTER_CAN0_STRUCT. It records CAN BUS Errors and hands these information to the Master_CAN0_ERROR_fsm. 
  */	
-uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint32_t time) {
+uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint64_t time) {
 	CAN_CONFIG *config;
 	int8_t can_state=CAN_OK;
 	uint8_t data_state=0;
@@ -980,6 +980,7 @@ uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint32_t time) {
 				popUIFiFo(s); 
 				
 				BMS_Set_Error_Check_voltage_inconsitency(s);
+				BMS_set_Error_Check_UI_Flags(s); 
 				
 				// check if System voltage is too high
 				if(s->allValuesInitialized ==TRUE) {
@@ -1077,8 +1078,9 @@ uint16_t Master_CAN0_fsm(MASTER_CAN0_STRUCT_t* s,uint32_t time) {
 				if(s->Slave[s->slaveSelect].SlaveCanCommuniationError.FailedComCnt >=CAN0_MAX_NR_OF_FAILED_COM) {
 					s->FsmState=SHUT_DOWN_BMS;
 					
-					//write Error
-					ErrorStackPushSlaveError(s,s->slaveSelect,BMS_ERROR_STACK_SLAVE_CAN_ERROR,0,BMS_ERROR_CLASS_2);
+					//write Error Slave
+						ErrorStackPushSlaveError(s,s->slaveSelect,BMS_ERROR_STACK_SLAVE_CAN_ERROR,0,BMS_ERROR_CLASS_2);
+
 					return TRUE;
 				}
 				s->FsmState=DO_CALCULATIONS;

+ 33 - 2
BMS Master/Sources/BMS_Set_Error_States.c

@@ -423,9 +423,11 @@ uint32_t BMS_Set_Error_Check_voltage_inconsitency(MASTER_CAN0_STRUCT_t* s) {
 	
 	s->UiSlaveInconsistency = bms_SoC_get_norm((float)addedCellVoltage_mean - (float)UI_Board_voltage_mean) ;
 	
+
+	
 	// if voltage error is bigger than threshold and All relais are closed kill relays
-	if((s->UiSlaveInconsistency > (float)addedCellVoltage_mean * 0.05 && s->RunMode.onCounter > UI_VOLTAGE_FIFO_SIZE* CAN0_MAX_NR_OF_SLAVES) &&
-			(s->relayState.HS_closed==TRUE &&		s->relayState.LS_closed==TRUE && s->relayState.PRECHARGE_closed==TRUE) ){
+	if((s->UiSlaveInconsistency > (addedCellVoltage_mean * 0.05) && s->RunMode.onCounter > (UI_VOLTAGE_FIFO_SIZE* CAN0_MAX_NR_OF_SLAVES)) &&
+			(s->relayState.HS_closed==TRUE &&		s->relayState.LS_closed==TRUE && s->relayState.PRECHARGE_closed==TRUE && s->UI_Board.Errors.RelayOpen == FALSE) ){
 		ErrorStackPushUiError(s,BMS_ERROR_STACK_UI_VOLTAGE_INCONSIST,BMS_ERROR_CLASS_1);
 		// Kill Relays
 		SwitchRelais( LS_RELAIS, 0);
@@ -441,7 +443,36 @@ uint32_t BMS_Set_Error_Check_voltage_inconsitency(MASTER_CAN0_STRUCT_t* s) {
 	
 	return TRUE;
 }
+/*
+ * @brief check if UI sends error flags
+ */
 
+uint32_t BMS_set_Error_Check_UI_Flags(MASTER_CAN0_STRUCT_t* s) {
+	
+	if(s->UI_Board.Errors.OffsetError ==TRUE) {
+		ErrorStackPushUiError(s,BMS_ERROR_STACK_UI_OFFSET_ERROR,BMS_ERROR_CLASS_2);
+		// Kill Relays
+		SwitchRelais( LS_RELAIS, 0);
+		SwitchRelais( PRE_CHARGE_RELAIS, 0);
+		SwitchRelais( HS_RELAIS, 0);
+		s->relayState.HS_closed=FALSE;
+		s->relayState.LS_closed=FALSE;
+		s->relayState.PRECHARGE_closed=FALSE;
+	}
+	if(s->UI_Board.Errors.SupplyError == TRUE) {
+		
+		ErrorStackPushUiError(s,BMS_ERROR_STACK_UI_SUPPLY_VOLTAGE,BMS_ERROR_CLASS_2);
+		// Kill Relays
+		SwitchRelais( LS_RELAIS, 0);
+		SwitchRelais( PRE_CHARGE_RELAIS, 0);
+		SwitchRelais( HS_RELAIS, 0);
+		s->relayState.HS_closed=FALSE;
+		s->relayState.LS_closed=FALSE;
+		s->relayState.PRECHARGE_closed=FALSE;
+	}
+	
+	return TRUE;
+}
 
 
 

+ 8 - 8
BMS Master/Sources/BMS_Startup.c

@@ -13,7 +13,7 @@
  */
 
 uint32_t write_fram_byte(uint8_t byte,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_write(Addr, (vuint8_t *const)&byte,1);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -32,7 +32,7 @@ uint32_t write_fram_byte(uint8_t byte,uint32_t timeout,const vuint16_t Addr) {
  */
 
 uint32_t write_fram_word(uint16_t word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_write(Addr, (vuint8_t *const)&word,2);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -51,7 +51,7 @@ uint32_t write_fram_word(uint16_t word,uint32_t timeout,const vuint16_t Addr) {
  */
 
 uint32_t write_fram_float(float float_value,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_write(Addr, (vuint8_t *const)&float_value,4);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -70,7 +70,7 @@ uint32_t write_fram_float(float float_value,uint32_t timeout,const vuint16_t Add
  */
 
 uint32_t write_fram_uint32(uint32_t word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_write(Addr, (vuint8_t *const)&word,4);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -85,7 +85,7 @@ uint32_t write_fram_uint32(uint32_t word,uint32_t timeout,const vuint16_t Addr)
 }
 
 uint32_t read_fram_byte(uint8_t* word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_read(Addr, (vuint8_t *const)word,2);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -100,7 +100,7 @@ uint32_t read_fram_byte(uint8_t* word,uint32_t timeout,const vuint16_t Addr) {
 }
 
 uint32_t read_fram_word(uint16_t* word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_read(Addr, (vuint8_t *const)word,2);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -115,7 +115,7 @@ uint32_t read_fram_word(uint16_t* word,uint32_t timeout,const vuint16_t Addr) {
 }
 
 uint32_t read_fram_uint32(uint32_t* word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_read(Addr, (vuint8_t *const)word,4);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);
@@ -132,7 +132,7 @@ uint32_t read_fram_uint32(uint32_t* word,uint32_t timeout,const vuint16_t Addr)
 
 
 uint32_t read_fram_float(float* word,uint32_t timeout,const vuint16_t Addr) {
-	uint32_t timestamp=Global_1msCounter;
+	uint64_t timestamp=Global_1msCounter;
 	FRAM_trigger_read(Addr, (vuint8_t *const)word,4);
 	while(Fram_S.Flags.B.JobFinished ==0 ) {
 		FRAM_update(0);

+ 2 - 2
BMS Master/Sources/BoardPeripherals.c

@@ -37,7 +37,7 @@ int8_t BoardPeriph_test_update_polled()
 {
 	static uint8_t state = 0;
 	static int8_t FRAM_result = 0;
-	static uint32_t old_Global_1msCounter = 0;
+	static uint64_t old_Global_1msCounter = 0;
 	uint8_t tick = 0;
 	int8_t result = 0;
 	
@@ -80,7 +80,7 @@ void BoardPeriph_update_1ms()
 
 void BoardPeriph_update_polled()
 {
-	static uint32_t old_Global_1msCounter = 0;
+	static uint64_t old_Global_1msCounter = 0;
 	uint8_t tick = 0;
 	if (Global_1msCounter != old_Global_1msCounter) {
 		tick = 1;

+ 3 - 3
BMS Master/Sources/main.c

@@ -93,7 +93,7 @@ void main(void)
 	volatile    uint32_t	ErrorTimeCount              = 0;
 	static float SoC_test;
 	
-	static	uint32_t	test_timestamp				= 0;
+	static	uint64_t	test_timestamp				= 0;
 	static 	uint8_t		test_data_send[4]			= {1,2,3,4};	
 
 	static	MASTER_CAN0_STRUCT_t CAN0_fsm_state;
@@ -164,8 +164,8 @@ void main(void)
 	while(BMS_Can_ID_init_fsm (&CAN0_fsm_state) == BMS_CAN_ID_INIT_RETURN_RUNNING ) {
 		// wait
 	}
-	//write_fram_clear_startup_state(&CAN0_fsm_state); 
-	//write_fram_clear_error_buffer(&CAN0_fsm_state); 
+	write_fram_clear_startup_state(&CAN0_fsm_state); 
+	write_fram_clear_error_buffer(&CAN0_fsm_state); 
 	//write_fram_set_SoC(0.03); 
 	
 	while(Global_1msCounter < DELAY_START*2)