Index: trunk/fw_g473rct/SES/inc/fast_current.h
===================================================================
--- trunk/fw_g473rct/SES/inc/fast_current.h	(revision 23)
+++ trunk/fw_g473rct/SES/inc/fast_current.h	(revision 24)
@@ -20,5 +20,5 @@
 
 //--- GLOBALE FUNKTIONS PROTOTYPEN ---------------------------------------------
-void FAST_CURRENT_Exec(uint32_t newvalP, uint32_t newvalM );
+void FAST_CURRENT_Exec(uint32_t newVal );
 
 #endif //
Index: trunk/fw_g473rct/SES/inc/int_bat_voltage.h
===================================================================
--- trunk/fw_g473rct/SES/inc/int_bat_voltage.h	(revision 24)
+++ trunk/fw_g473rct/SES/inc/int_bat_voltage.h	(revision 24)
@@ -0,0 +1,30 @@
+/******************************************************************************
+*
+* @file    ref_voltage.h
+* @author  ECS, Falko Jahn
+* @version V1.0.0
+* @date    2020-05-01
+* @brief      
+*
+******************************************************************************/
+#ifndef __REF_VOLTAGE_H
+#define __REF_VOLTAGE_H
+
+//--- INCLUDEs -----------------------------------------------------------------
+
+//--- GLOBALE TYPE DEFS --------------------------------------------------------       
+
+//--- GLOBALE DEFINES ----------------------------------------------------------
+
+//--- GLOBALE VARIABLEN PROTOTYPEN ---------------------------------------------
+
+//--- GLOBALE FUNKTIONS PROTOTYPEN ---------------------------------------------
+
+/*
+* @brief	
+* @param	kein
+* @retval	kein
+*/
+void INT_BAT_VOLTAGE_Exec(uint32_t newval);
+
+#endif // __REF_VOLTAGE_H
Index: trunk/fw_g473rct/SES/inc/ref_voltage.h
===================================================================
--- trunk/fw_g473rct/SES/inc/ref_voltage.h	(revision 23)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/******************************************************************************
-*
-* @file    ref_voltage.h
-* @author  ECS, Falko Jahn
-* @version V1.0.0
-* @date    2020-05-01
-* @brief      
-*
-******************************************************************************/
-#ifndef __REF_VOLTAGE_H
-#define __REF_VOLTAGE_H
-
-//--- INCLUDEs -----------------------------------------------------------------
-
-//--- GLOBALE TYPE DEFS --------------------------------------------------------       
-
-//--- GLOBALE DEFINES ----------------------------------------------------------
-
-//--- GLOBALE VARIABLEN PROTOTYPEN ---------------------------------------------
-
-//--- GLOBALE FUNKTIONS PROTOTYPEN ---------------------------------------------
-
-/*
-* @brief	
-* @param	kein
-* @retval	kein
-*/
-void REF_VOLTAGE_Exec(uint32_t newval);
-
-#endif // __REF_VOLTAGE_H
Index: trunk/fw_g473rct/SES/smartPro.emProject
===================================================================
--- trunk/fw_g473rct/SES/smartPro.emProject	(revision 23)
+++ trunk/fw_g473rct/SES/smartPro.emProject	(revision 24)
@@ -185,7 +185,7 @@
       <file file_name="inc/esr.h" />
       <file file_name="inc/fast_current.h" />
+      <file file_name="inc/int_bat_voltage.h" />
       <file file_name="inc/modbus.h" />
       <file file_name="inc/outputs.h" />
-      <file file_name="inc/ref_voltage.h" />
       <file file_name="inc/rtc.h" />
       <file file_name="inc/self_discharge.h" />
@@ -212,8 +212,8 @@
       <file file_name="src/esr.c" />
       <file file_name="src/fast_current.c" />
+      <file file_name="src/int_bat_voltage.c" />
       <file file_name="src/main.c" />
       <file file_name="src/modbus.c" />
       <file file_name="src/outputs.c" />
-      <file file_name="src/ref_voltage.c" />
       <file file_name="src/self_discharge.c" />
       <file file_name="src/shunt_temperature.c" />
Index: trunk/fw_g473rct/SES/src/battery_voltage.c
===================================================================
--- trunk/fw_g473rct/SES/src/battery_voltage.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/battery_voltage.c	(revision 24)
@@ -13,15 +13,15 @@
 #include "main.h"
 #include "sysdata.h"
-
+#include <stdio.h>
 //	--- EXTERNE VARIABLEN --------------------------------------------------------
 
 //	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
-#define BATTERY_VOLTAGE_FILTER  256
+#define BATTERY_VOLTAGE_FILTER  32
 
 
-#define BATTERY_VOLTAGE_VOLTAGE_DIVIDER       6
-#define ADC_RESOLUTION						  65536 //65536/2 da im differential mode
-#define ADC_OFFSET							  0
-#define VREF								  3000
+#define BATTERY_VOLTAGE_VOLTAGE_DIVIDER       6.0
+#define ADC_RESOLUTION						  32768.0 //65536/2 da im differential mode
+#define ADC_OFFSET							  32768.0
+
 //	--- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
 
@@ -37,17 +37,16 @@
 
 
-void BATTERY_VOLTAGE_Exec(int32_t newvalP )
+void BATTERY_VOLTAGE_Exec(int32_t newVal)
 {
   static int measCounter;
-  static unsigned long avgsumP = 0;
-  int32_t avgvalP;
-
+  static unsigned long avgSum = 0;
+  int32_t avgVal;
   if (measCounter < INT32_MAX) measCounter++;
 
 
   // Filterlängen in 2er-Potenzen --> Compiler optimiert
-  avgsumP -= avgsumP / BATTERY_VOLTAGE_FILTER;
-  avgsumP += newvalP;
-  avgvalP = avgsumP / BATTERY_VOLTAGE_FILTER;
+  avgSum -= avgSum / BATTERY_VOLTAGE_FILTER;
+  avgSum += newVal;
+  avgVal =  avgSum / BATTERY_VOLTAGE_FILTER;
 
   
@@ -55,5 +54,5 @@
 
   //Umrechung auf Eingangsspannung am Gerät mit Teiler
-  sys_data.s.values.batteryVoltage = ((avgvalP-2048) * 3000 * BATTERY_VOLTAGE_VOLTAGE_DIVIDER ) / 2048;
+  sys_data.s.values.batteryVoltage = ((avgVal-ADC_OFFSET) * VREF * BATTERY_VOLTAGE_VOLTAGE_DIVIDER ) / ADC_RESOLUTION;
 
   
@@ -75,7 +74,7 @@
 
 
-  //Berechnung schnellen Wert ohne Glättung:
+  //Berechnung schnelle Wert ohne Glättung:
   //Umrechung auf Eingangsspannung am Gerät mit Teiler
-  sys_data.s.values.fast_voltage = ((newvalP-ADC_OFFSET) * VREF * BATTERY_VOLTAGE_VOLTAGE_DIVIDER ) / ADC_RESOLUTION;
+  sys_data.s.values.fast_voltage = ((newVal-ADC_OFFSET) * VREF * BATTERY_VOLTAGE_VOLTAGE_DIVIDER ) / ADC_RESOLUTION;
 
 
Index: trunk/fw_g473rct/SES/src/chip_temperature.c
===================================================================
--- trunk/fw_g473rct/SES/src/chip_temperature.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/chip_temperature.c	(revision 24)
@@ -24,8 +24,8 @@
 //	--- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
 uint32_t calTemperatureSensor30Value;  // Kalibrierungswert für den Temperatursensor auf dem STM32G0 (Werksmäßig im SCB Bereich gespeichert wird beim Programmstart ausgelesen)
-uint32_t calTemperatureSensor130Value; // Kalibrierungswert für den Temperatursensor auf dem STM32G0 (Werksmäßig im SCB Bereich gespeichert wird beim Programmstart ausgelesen)
+uint32_t calTemperatureSensor110Value; // Kalibrierungswert für den Temperatursensor auf dem STM32G0 (Werksmäßig im SCB Bereich gespeichert wird beim Programmstart ausgelesen)
 uint32_t calTemperatureSensorDiff;     // Differenz calTemperatureSensor130Value und calTemperatureSensor30Value wird für die Kalibrierung des internen Temperatursensors bentigt
                                                               // Daten Temperaturanzeige µProzessor
-
+double slope;
 //	--- LOKALE FUNKTIONS PROTOTYPEN ----------------------------------------------
 
@@ -46,5 +46,5 @@
   uint16_t * pCalibrationData;
   float calibrationData30;
-  float calibrationData130;
+  float calibrationData110;
 
   // lade Temperatur Kalibrierungswert (Wert bei 30°C)
@@ -55,33 +55,34 @@
   //Berechnung Spannung in mV bei CAL Punk 30°C
   //Kalbibrierung wurde mit 12 Bit und 3000mV Vref durchgeführt
-  calibrationData30 = calibrationData30 / 4096;
-  calTemperatureSensor30Value = calibrationData30 * 3000 ;      // jetzt haben wir die Kalibrierungsspannung in Volt bei 30°C;
+  calTemperatureSensor30Value = (calibrationData30 * 3000) / 4096 ;      // jetzt haben wir die Kalibrierungsspannung in Volt bei 30°C;
 
   pCalibrationData = (uint16_t *)TEMPSENSOR_CAL2_ADDR;
-  calibrationData130  = * pCalibrationData;
+  calibrationData110  = * pCalibrationData;
 
-  //Berechnung Spannung in mV bei CAL Punk 130°C
+  //Berechnung Spannung in mV bei CAL Punk 110°C
   //Kalbibrierung wurde mit 12 Bit und 3000mV Vref durchgeführt
-  calibrationData130 = calibrationData130 / 4096;
-  calTemperatureSensor130Value = calibrationData130 * 3000;      // jetzt haben wir die Kalibrierungsspannung in Volt bei 130°C;
+  calTemperatureSensor110Value = (calibrationData110 * 3000 / 4096);      // jetzt haben wir die Kalibrierungsspannung in Volt bei 110°C;
 
   // Spannungsdifferenz bei 100 Kelvin Temperatureunterschied
-  calTemperatureSensorDiff = (calTemperatureSensor130Value - calTemperatureSensor30Value);
+  // Slope enthält die Änderung in mV pro °C
+  calTemperatureSensorDiff = (calTemperatureSensor110Value - calTemperatureSensor30Value);
+  slope = (double) calTemperatureSensorDiff / (TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP);
+
+
 }
 
 void CHIP_TEMPERATURE_Exec(uint32_t chiptemperature)
 {
-    int32_t voltage;
+    double voltage;
     //Aktuelle Spannung am Temp Sensor
-    voltage = (3300 * chiptemperature) / 65536;
+    voltage = (3000 * chiptemperature) / 65536;
 
 
     voltage = voltage - calTemperatureSensor30Value;
-    voltage = voltage * 100000; //100000 da Kalibrierwerte 100 Kelvin Delta T haben und wir alles in m°C rechnen
-    voltage = voltage / (int32_t)(calTemperatureSensorDiff);
-    voltage = voltage + 30000; //30000 da Erste Kalibrierpunkt bei 30°C --> 30 000 m°C
+    voltage = voltage  / slope;
+    voltage = voltage + 30.0;
 
-    //Durch 10 teilen, damit es in 16 Bit signed modbus register passt
-    sys_data.s.values.chipTemperature = voltage /10 ;
+	//*100 für Kommastellen
+    sys_data.s.values.chipTemperature = voltage * 100  ;
 
 	calc_temp_compensation();
Index: trunk/fw_g473rct/SES/src/fast_current.c
===================================================================
--- trunk/fw_g473rct/SES/src/fast_current.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/fast_current.c	(revision 24)
@@ -17,9 +17,8 @@
 
 //	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
-//#define FAST_CURRENT_FILTER  2
-
-
 
 #define I_SENSE_GAIN    40.0
+#define ADC_OFFSET							  32768
+#define ADC_RESOLUTION						  32768 //65536/2 da im differential mode
 
 
@@ -51,34 +50,13 @@
 
 
-void FAST_CURRENT_Exec(uint32_t newvalP, uint32_t newvalM )
+void FAST_CURRENT_Exec(uint32_t newVal )
 {
-  static int measCounter;
-  static unsigned long avgsumP = 0;
-  uint32_t avgvalP;
-
-  if (measCounter < INT32_MAX) measCounter++;
-
-
-  // Filterlängen in 2er-Potenzen --> Compiler optimiert 
- // avgsumP -= avgsumP / FAST_CURRENT_FILTER;
- // avgsumP += newvalP;
-//  avgvalP = avgsumP / FAST_CURRENT_FILTER;
-
-//  static unsigned long avgsumM = 0;
-//  uint32_t avgvalM;
-  // Filterlängen in 2er-Potenzen --> Compiler optimiert 
-//  avgsumM -= avgsumM / FAST_CURRENT_FILTER;
-//  avgsumM += newvalM;
-//  avgvalM = avgsumM / FAST_CURRENT_FILTER;
-
-
-  //Berechne Differenzspannung am ADC Eingnag
-  double diff;
-  diff = (int32_t) newvalP - (int32_t) newvalM; 
-  diff = (diff * sys_data.s.values.realVdd)  / 65536;
-
+ 
   //Umrechung auf Strom
   double temp_current;
-  temp_current = (diff / I_SENSE_GAIN) /  SHUNT_RESISTOR;
+  temp_current = ((int32_t) newVal - ADC_OFFSET) * VREF ;
+  temp_current = temp_current / ADC_RESOLUTION;
+  temp_current = temp_current / I_SENSE_GAIN ;
+  temp_current = temp_current / SHUNT_RESISTOR ;
   sys_data.s.values.fast_current = temp_current * (sys_data.s.parameter.batteryCurrentGainCorrectionFaktor / 1000000.0);
  
Index: trunk/fw_g473rct/SES/src/int_bat_voltage.c
===================================================================
--- trunk/fw_g473rct/SES/src/int_bat_voltage.c	(revision 24)
+++ trunk/fw_g473rct/SES/src/int_bat_voltage.c	(revision 24)
@@ -0,0 +1,46 @@
+/******************************************************************************
+*
+* @file    ref_voltage.c
+* @author  ECS, Falko Jahn
+* @version V1.0.0
+* @date    2020-05-01
+* @brief       
+*
+******************************************************************************/
+
+//	--- INCLUDES -----------------------------------------------------------------
+#include "main.h"
+#include "sysdata.h"
+#include "int_bat_voltage.h"
+//	--- EXTERNE VARIABLEN -------------------------------------------------------- 
+
+//	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
+#define REF_FILTER              64
+//	--- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
+
+//	--- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------
+
+//	--- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
+
+//	--- LOKALE FUNKTIONS PROTOTYPEN ---------------------------------------------- 
+/*
+* @brief
+* @param	kein
+* @retval	kein
+*/
+
+//	--- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------
+
+
+
+//	--- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------
+void INT_BAT_VOLTAGE_Exec(uint32_t newval)
+{
+  // Messung Externe Spannung basierend auf 3,3V Versorgungsspannung
+  // Nur für Debug Zwecke
+  sys_data.s.values.voltageVref = VREF;
+  
+  
+  sys_data.s.values.realVdd =  3 * (newval * VREF) / 65536;
+}
+/*************************** End of file ****************************/
Index: trunk/fw_g473rct/SES/src/main.c
===================================================================
--- trunk/fw_g473rct/SES/src/main.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/main.c	(revision 24)
@@ -39,4 +39,9 @@
 #include "battery_voltage.h"
 #include "ads1260.h"
+#include "shunt_voltage.h"
+#include "fast_current.h"
+#include "int_bat_voltage.h"
+#include "chip_temperature.h"
+#include "shunt_temperature.h"
 /* USER CODE END Includes */
 
@@ -61,5 +66,5 @@
 modbus_t modbusData __attribute__((section(".RAM1")));
 
-__IO uint16_t adc12Data[2] __attribute__((section(".RAM1")));
+__IO uint16_t adc12Data[100][2] __attribute__((section(".RAM1")));
 __IO uint32_t adc1Data[1] __attribute__((section(".RAM1")));
 __IO uint32_t adc2Data[1] __attribute__((section(".RAM1")));
@@ -68,6 +73,8 @@
 __IO uint32_t adc5Data[4] __attribute__((section(".RAM1")));
 int silentmode =0;
-static volatile uint32_t newADC1Data = 0;
-static volatile uint32_t newADC2Data = 0;
+static volatile uint32_t newADC12Data = 0;
+static volatile uint32_t newADC3Data = 0;
+static volatile uint32_t newADC4Data = 0;
+static volatile uint32_t newADC5Data = 0;
 /* USER CODE END PV */
 
@@ -95,4 +102,6 @@
     uint8_t firstStartCatcher;
 	int mode_button_disable_time=0;
+	uint32_t adc12_time;
+	uint32_t adc12_lasttime;
   /* USER CODE END 1 */
 
@@ -160,5 +169,5 @@
 
     // STM32G0 Chiptemperatur Kalibrierung
-  CHIP_TEMPERATURE_Calibration(/*&sys_data*/);
+  CHIP_TEMPERATURE_Calibration();
 
   HAL_ADCEx_Calibration_Start(&hadc1, ADC_DIFFERENTIAL_ENDED);
@@ -169,5 +178,4 @@
 
 
-
   //SET_BIT(hadc2.Instance->CFGR, ADC_CFGR_DMAEN); //Enable DMA transfer for ADC slave (ADC12_CCR.MDMA = 0b00 -> MDMA mode disabled)
   //HAL_DMA_Start(hadc2.DMA_Handle,(uint32_t)&hadc2.Instance->DR, (uint32_t)adc2Data,1); //Start ADC slave DMA 
@@ -175,9 +183,22 @@
   
     //HAL_ADC_Start_DMA(&hadc2, (uint32_t*)adc2Data, 1);
-  if (HAL_ADCEx_MultiModeStart_DMA(&hadc1,(uint32_t *)adc12Data,1))  //Start ADC interleaved mode
+  if (HAL_ADCEx_MultiModeStart_DMA(&hadc1,(uint32_t *)adc12Data,100))  //Start ADC interleaved mode
   {
      /* Start Error */
      Error_Handler();
   }
+
+  if (HAL_ADC_Start_DMA(&hadc3, (uint32_t *) adc3Data , 3))
+  {
+     /* Start Error */
+     Error_Handler();
+  }
+
+  if (HAL_ADC_Start_DMA(&hadc4, (uint32_t *) adc4Data , 1))
+  {
+     /* Start Error */
+     Error_Handler();
+  }
+
 
   if (HAL_ADC_Start_DMA(&hadc5, (uint32_t *) adc5Data , 4))
@@ -196,9 +217,36 @@
 
     /* USER CODE BEGIN 3 */
-	if (newADC1Data == 1)
-    {
-	  BATTERY_VOLTAGE_Exec( adc12Data[1]);
-	}
-
+	if (newADC12Data == 1)
+    {
+	  //Mit ADC_DIV2,Sample time 12,5Cycklen, ADC Clock 50Mhz, Oversampling 256
+	  //Tconv = 6400 Takte = 0,128ms Pro Konvertierung. Also für 100 messwerte 12,8mS
+	  BATTERY_VOLTAGE_Exec( adc12Data[0][1]);
+	  FAST_CURRENT_Exec(adc12Data[0][0]); 
+	  newADC12Data = 0;
+	  adc12_time = HAL_GetTick() - adc12_lasttime;
+	  adc12_lasttime = HAL_GetTick();
+
+	}
+
+
+	if (newADC3Data == 1)
+    {
+	  SHUNT_TEMPERATURE_Exec(adc3Data[0]);
+	}
+
+
+	if (newADC4Data == 1)
+    {
+	  SHUNT_VOLTAGE_Exec( adc4Data[0]);
+	}
+
+
+	if (newADC5Data == 1)
+    {
+	  CHIP_TEMPERATURE_Exec(adc5Data[0]);
+	  INT_BAT_VOLTAGE_Exec( adc5Data[1]);
+	  sys_data.s.values.ovp_sense =  (adc5Data[2] * VREF * 21 ) / 65536.0;
+      sys_data.s.values.lvp_sense =  (adc5Data[3] * VREF * 21 ) / 65536.0;
+	}
 
 	if(sys_data.s.parameter.command != 0)
@@ -327,10 +375,21 @@
     if (hadc->Instance==ADC1)
 	{
-	  newADC1Data=1;
-	}
-
-	if (hadc->Instance==ADC2)
+	  newADC12Data=1;
+	}
+
+	if (hadc->Instance==ADC3)
 	{
-	  newADC2Data=1;
+	  newADC3Data=1;
+	}
+
+
+	if (hadc->Instance==ADC4)
+	{
+	  newADC4Data=1;
+	}
+
+	if (hadc->Instance==ADC5)
+	{
+	  newADC5Data=1;
 	}
  }
Index: trunk/fw_g473rct/SES/src/modbus.c
===================================================================
--- trunk/fw_g473rct/SES/src/modbus.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/modbus.c	(revision 24)
@@ -183,9 +183,11 @@
 	}
 	
-	uint32_t fixedDelayInBitDurations = (FAST_BAUDRATE_INTERFRAME_DELAY_us * baudrate) / 1000000UL + 1UL;
-//	HAL_UART_EnableReceiverTimeout( usart);
-//	HAL_UART_ReceiverTimeout_Config(usart,  fixedDelayInBitDurations);
-
-    if(HAL_UARTEx_ReceiveToIdle_DMA(mb_data->uart, mb_data->rx_buffer, RXBUFFERSIZE) != HAL_OK)
+	
+	HAL_UART_EnableReceiverTimeout( usart);
+	HAL_UART_ReceiverTimeout_Config(usart,  3.5 * nrOfBitsPerChar);
+	SET_BIT(usart->Instance->CR1, USART_CR1_RTOIE); 
+
+
+    if(HAL_UART_Receive_DMA(mb_data->uart, mb_data->rx_buffer, RXBUFFERSIZE) != HAL_OK)
     {
       printf("uart error \n\r");
@@ -202,10 +204,12 @@
     modbusData.mb_rx_frame_complete = 1;
     modbusData.setRxLed = false;
-	modbusData.rx_head= 0;
-
+	modbusData.rx_head = huart->RxXferSize - __HAL_DMA_GET_COUNTER(huart->hdmarx);
+	
 
   if (huart->ErrorCode == HAL_UART_ERROR_RTO)
   {
-	printf("MB RTO Event! \n\r");
+
+	// printf("MB RTO Event! \n\r");
+	// Kein Fehler, normale Funktion
   }
   if (huart->ErrorCode == HAL_UART_ERROR_FE)
@@ -240,5 +244,6 @@
 
 
-  if(HAL_UARTEx_ReceiveToIdle_DMA(huart, huart->pRxBuffPtr, RXBUFFERSIZE) != HAL_OK)
+  
+  if(HAL_UART_Receive_DMA(huart, huart->pRxBuffPtr, RXBUFFERSIZE) != HAL_OK)
    {
      printf("Uart Error bei neustart nach Fehler \n\r");
@@ -250,22 +255,22 @@
 }
 
-void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
-{
-  //printf("MB rxEvent!RX=%d \n\r",Size);
-  modbusData.setRxLed = true;
-
-  modbusData.mb_rx_frame_complete = 1;
-  modbusData.rx_head= Size +1;
-
-  if(HAL_UARTEx_ReceiveToIdle_DMA(huart, huart->pRxBuffPtr, RXBUFFERSIZE) != HAL_OK)
-   {
-     printf("uart error \n\r");
-  //   while(1)
-  //   {
-  //   }     
-   }    
-  
-
-}
+//void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
+//{
+//  //printf("MB rxEvent!RX=%d \n\r",Size);
+//  modbusData.setRxLed = true;
+
+//  modbusData.mb_rx_frame_complete = 1;
+//  modbusData.rx_head= Size +1;
+
+//  if(HAL_UART_Receive_DMA(huart, huart->pRxBuffPtr, RXBUFFERSIZE) != HAL_OK)
+//   {
+//     printf("uart error \n\r");
+//  //   while(1)
+//  //   {
+//  //   }     
+//   }    
+  
+
+//}
 
 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
Index: trunk/fw_g473rct/SES/src/ref_voltage.c
===================================================================
--- trunk/fw_g473rct/SES/src/ref_voltage.c	(revision 23)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/******************************************************************************
-*
-* @file    ref_voltage.c
-* @author  ECS, Falko Jahn
-* @version V1.0.0
-* @date    2020-05-01
-* @brief       
-*
-******************************************************************************/
-
-//	--- INCLUDES -----------------------------------------------------------------
-#include "main.h"
-#include "sysdata.h"
-//	--- EXTERNE VARIABLEN -------------------------------------------------------- 
-
-//	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
-#define REF_FILTER              64
-//	--- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
-
-//	--- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------
-
-//	--- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
-
-//	--- LOKALE FUNKTIONS PROTOTYPEN ---------------------------------------------- 
-/*
-* @brief
-* @param	kein
-* @retval	kein
-*/
-
-//	--- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------
-
-
-
-//	--- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------
-void REF_VOLTAGE_Exec(uint32_t newval)
-{
-   static unsigned long avgsum = 0;
-   uint32_t avgval;
-   // Filterlängen in 2er-Potenzen --> Compiler optimiert 
-   avgsum -= avgsum / REF_FILTER;
-   avgsum += newval;
-   avgval = avgsum / REF_FILTER;
-
-  // Messung Externe Spannung basierend auf 3,3V Versorgungsspannung
-  // Nur für Debug Zwecke
-  sys_data.s.values.voltageVref =  (avgval * 3300) / 65536;
-  
-  // Ermittlung Vdd als Referenz
-  sys_data.s.values.realVdd =  3000L * 65536 / avgval;;
-}
-/*************************** End of file ****************************/
Index: trunk/fw_g473rct/SES/src/shunt_temperature.c
===================================================================
--- trunk/fw_g473rct/SES/src/shunt_temperature.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/shunt_temperature.c	(revision 24)
@@ -38,21 +38,18 @@
 void SHUNT_TEMPERATURE_Exec(int32_t adcval)
 {
-  int32_t temp;
+  double temp;
 
 
   //Umrechnung Spannung in mV
-  temp =  (adcval * 3300 ) / 65536; 
+  temp =  (adcval * VREF ) / 65536.0; 
 
-  //Umrechnung in °C mit PT 1000 Sensor
-//  temp = temp - 747;
-//  temp = temp * 70.406;
 
   //Umrechnung in °C mit LM61 Sensor
   temp = temp - 600;
-  temp = temp * 100;
+  temp = temp / 10;
 
   //2Nackommastellen
   //milli grad in grad * 100 /festkomma
-  sys_data.s.values.shuntTemperature = temp / 10;
+  sys_data.s.values.shuntTemperature = temp * 100;
 
 
Index: trunk/fw_g473rct/SES/src/shunt_voltage.c
===================================================================
--- trunk/fw_g473rct/SES/src/shunt_voltage.c	(revision 23)
+++ trunk/fw_g473rct/SES/src/shunt_voltage.c	(revision 24)
@@ -17,6 +17,7 @@
 
 //	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
-
-#define SHUNT_VOLTAGE_DIVIDER       6
+#define ADC_RESOLUTION						  32768 //65536/2 da im differential mode
+#define ADC_OFFSET							  32768
+#define SHUNT_VOLTAGE_DIVIDER				  6
 //	--- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
 
@@ -44,12 +45,5 @@
 void SHUNT_VOLTAGE_Exec(int32_t newval)
 {
-   static unsigned long avgsum = 0;
-   uint32_t avgval;
-   // Filterlängen in 2er-Potenzen --> Compiler optimiert 
-   //avgsum -= avgsum/SHUNT_FILTER;
-   //avgsum += newval;
-   //avgval = avgsum / SHUNT_FILTER;
-
-   sys_data.s.values.shuntVoltage =  (newval * (uint64_t)sys_data.s.values.realVdd * SHUNT_VOLTAGE_DIVIDER ) / 65536;
+   sys_data.s.values.shuntVoltage =  ((newval-ADC_OFFSET) * VREF * SHUNT_VOLTAGE_DIVIDER ) / ADC_RESOLUTION;
 
 }
