Ignore:
Timestamp:
Nov 1, 2025, 5:29:27 PM (2 days ago)
Author:
f.jahn
Message:
 
Location:
trunk/fw_g473rct/SES/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/fw_g473rct/SES/src/ads1260.c

    r25 r38  
    4545#include "ads1260.h"
    4646#include "spi.h"
    47 #include "math.h"
     47//#include "math.h"
    4848#include "main.h"
    4949#include "eeprom.h"
    5050#include <stdio.h>
     51#include "iwdg.h"
    5152//      --- EXTERNE VARIABLEN --------------------------------------------------------
    5253
     
    765766  /* 3*/ HAL_GPIO_WritePin(ADC_START_CONV_GPIO_Port, ADC_START_CONV_Pin, GPIO_PIN_SET);
    766767         HAL_Delay(150); // Delay weil die Vref braucht zeit um sich zu stabilisieren (siehe Datenblatt Seite 9)
     768                 HAL_IWDG_Refresh(&hiwdg);
    767769  /* 1*/ //HAL_GPIO_WritePin(ADC_POWER_DOWN_GPIO_Port, ADC_POWER_DOWN_Pin, GPIO_PIN_RESET);
    768770         //HAL_Delay(150); // Delay weil die Vref braucht zeit um sich zu stabilisieren (siehe Datenblatt Seite 9)
     
    771773  /* 2*/ HAL_GPIO_WritePin(ADC_RESET_GPIO_Port, ADC_RESET_Pin, GPIO_PIN_RESET);
    772774         HAL_Delay(150); // Delay weil die Vref braucht zeit um sich zu stabilisieren (siehe Datenblatt Seite 9)
     775                 HAL_IWDG_Refresh(&hiwdg);
    773776  /* 2*/ HAL_GPIO_WritePin(ADC_RESET_GPIO_Port, ADC_RESET_Pin, GPIO_PIN_SET);
    774777         HAL_Delay(150); // Delay weil die Vref braucht zeit um sich zu stabilisieren (siehe Datenblatt Seite 9)
     778                 HAL_IWDG_Refresh(&hiwdg);
    775779  /* 3*/ HAL_GPIO_WritePin(ADC_START_CONV_GPIO_Port, ADC_START_CONV_Pin, GPIO_PIN_RESET);
    776780
     
    781785  /* 5*/ ADS_1260_SetExternalReference(&hspi3);
    782786         HAL_Delay(150);
     787                 HAL_IWDG_Refresh(&hiwdg);
    783788  /* 6*/ ADS_1260_SetDataRate(&hspi3, DATA_RATE_20);
    784789  //  /* 7*/ ADS_1260_SetDigitalFilter(&hspi1, FILTER_SINC4);
     
    789794
    790795         ADS_1260_ActivateStatusData();
     796                 HAL_IWDG_Refresh(&hiwdg);
    791797         ADS_1260_ActivateLock();
     798                 HAL_IWDG_Refresh(&hiwdg);
    792799
    793800  /*10*/ //ADS_1260_SelfOffsetCalibration(&hspi1);
    794801         HAL_Delay(150);
     802                 HAL_IWDG_Refresh(&hiwdg);
    795803  /*x*/  ads1260DataCoversionState = ADC_STATE_READY_FOR_CONVERSION;
    796804         ADS1260_StartConversion();
     805                 HAL_IWDG_Refresh(&hiwdg);
    797806}
    798807
  • trunk/fw_g473rct/SES/src/battery_voltage.c

    r25 r38  
    1717
    1818//      --- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
     19
    1920#define BATTERY_VOLTAGE_FILTER  32
    20 
    2121
    2222
  • trunk/fw_g473rct/SES/src/eeprom.c

    r35 r38  
    223223        /* iBatFull                                     */                                                                                      10,                             // I-batt full 10%, 10A bei 100Ah akku
    224224        /* tBatFull                                     */                                                                                      2,                              // t-batt full 2 Sekunden
    225         /* uBatFull                                     */                                                                                      0,                              // 14V olt Ubatt full, Neu: Bei 0: Erkung von Lipro LVP als 0%
    226         /* uBatEmpty                            */                                                                                      11312,                          // 11,312V Ubatt Empty
     225#if defined SYSTEM_VOLTAGE_12V
     226        /* uBatFull                                     */                                                                                      14000,                          // 14V olt Ubatt full, Neu: Bei 0: Erkung von Lipro LVP als 0%
     227        /* uBatEmpty                            */                                                                                      12400,                          // 11,312V Ubatt Empty
     228#elif defined SYSTEM_VOLTAGE_24V
     229        /* uBatFull                                     */                                                                                      28000,                          // 14V olt Ubatt full, Neu: Bei 0: Erkung von Lipro LVP als 0%
     230        /* uBatEmpty                            */                                                                                      24800,                          // 11,312V Ubatt Empty
     231#elif defined SYSTEM_VOLTAGE_48V
     232        /* uBatFull                                     */                                                                                      56000,                          // 14V olt Ubatt full, Neu: Bei 0: Erkung von Lipro LVP als 0%
     233        /* uBatEmpty                            */                                                                                      49600,                          // 11,312V Ubatt Empty
     234#else
     235  #error "System voltage not defined"
     236#endif
     237
     238
    227239        /* socCalcMode                          */                                                                                      1,                              // SoC calculation mode: 0(default)
    228240        /* cellRatedDischargeTime       */                                                                                      2,                              // cell rated current discharge time [C/x]. For example, if 40Ah cell is rated as 0.5c, then rated discharge time is 2
    229 
     241#if defined SYSTEM_VOLTAGE_12V
    230242        /* lvpStart     */                                                                                                                      12000,                  // uint16_t lvpStart; Spannung ab der die LOW Voltage Protection aktiv wird in mV
    231243        /* lvpStop      */                                                                                                                      12500,                  // uint16_t lvpStop; Spannung ab der die LOW Voltage Protection wieder inaktiv wird
    232244        /* ovpStart     */                                                                                                                      14800,                  // uint16_t  ovpStart; Spannung ab der die OVER Voltage Protection aktiv wird in mV
    233245        /* ovpStop      */                                                                                                                      14000,                  // uint16_t  ovpStop; Spannung ab der die OVER Voltage Protection wieder inaktiv wird
     246#elif defined SYSTEM_VOLTAGE_24V
     247        /* lvpStart     */                                                                                                                      24000,                  // uint16_t lvpStart; Spannung ab der die LOW Voltage Protection aktiv wird in mV
     248        /* lvpStop      */                                                                                                                      25000,                  // uint16_t lvpStop; Spannung ab der die LOW Voltage Protection wieder inaktiv wird
     249        /* ovpStart     */                                                                                                                      29600,                  // uint16_t  ovpStart; Spannung ab der die OVER Voltage Protection aktiv wird in mV
     250        /* ovpStop      */                                                                                                                      28000,                  // uint16_t  ovpStop; Spannung ab der die OVER Voltage Protection wieder inaktiv wird
     251
     252#elif defined SYSTEM_VOLTAGE_48V
     253        /* lvpStart     */                                                                                                                      48000,                  // uint16_t lvpStart; Spannung ab der die LOW Voltage Protection aktiv wird in mV
     254        /* lvpStop      */                                                                                                                      50000,                  // uint16_t lvpStop; Spannung ab der die LOW Voltage Protection wieder inaktiv wird
     255        /* ovpStart     */                                                                                                                      59200,                  // uint16_t  ovpStart; Spannung ab der die OVER Voltage Protection aktiv wird in mV
     256        /* ovpStop      */                                                                                                                      56000,                  // uint16_t  ovpStop; Spannung ab der die OVER Voltage Protection wieder inaktiv wird
     257#else
     258  #error "System voltage not defined"
     259#endif
     260
     261
    234262
    235263#if (DEVICETYPE == 500)
     
    247275        /* chargeStopHighTemperatureStart       */                                                                      6000,                   // 80°C int16_t chargeStopHighTemperatureStart; Abschalttemperatur Ladung wegen zu hoher Temperatur
    248276        /* chargeStopHighTemperatureStop        */                                                                      5500,                   // 75°C int16_t chargeStopHighTemperatureStop;  Wiedereinschalttemperatur
    249         /* chargeStopLowTemperatureStart        */                                                                      -3000,                  // -35°C int16_t chargeStopLowTemperatureStart; Abschalttemperatur Ladung wegen zu niedriger Temperatur
    250         /* chargeStopLowTemperatureStop         */                                                                      -2500,                  // -30°C int16_t chargeStopLowTemperatureStop; Wiedereinschalttemperatur
     277        /* chargeStopLowTemperatureStart        */                                                                      -2500,                  // -35°C int16_t chargeStopLowTemperatureStart; Abschalttemperatur Ladung wegen zu niedriger Temperatur
     278        /* chargeStopLowTemperatureStop         */                                                                      -2000,                  // -30°C int16_t chargeStopLowTemperatureStop; Wiedereinschalttemperatur
    251279        /* dischargeStopHighTemperatureStart*/                                                                  6000,                   // 80°C int16_t dischargeStopHighTemperatureStart; Abschalttemperatur Entladung wegen zu hoher Temperatur
    252280        /* dischargeStopHighTemperatureStop     */                                                                      5500,                   // 75°C int16_t dischargeStopHighTemperatureStop; Wiedereinschalttemperatur
     
    256284        /* uBatEmptyCompStartTemp       */                                                                                      50,                             // 5°C We start calculating uBatEmpty compensations only when cell temperature is lower than this value
    257285        /* uBatEmptyCompStopTemp        */                                                                                      -200,                   // -20°C We stop calculating uBatEmpty compensations when cell temperature is lower than this value
     286#if defined SYSTEM_VOLTAGE_12V
    258287        /* uBatEmptyCompStopVolt        */                                                                                      10000,                  // 10V uBatEmpty voltage at temperatures lower than -20°C
     288#elif defined SYSTEM_VOLTAGE_24V
     289/* uBatEmptyCompStopVolt        */                                                                                              20000,                  // 10V uBatEmpty voltage at temperatures lower than -20°C
     290#elif defined SYSTEM_VOLTAGE_48V
     291/* uBatEmptyCompStopVolt        */                                                                                              40000,                  // 10V uBatEmpty voltage at temperatures lower than -20°C
     292#else
     293  #error "System voltage not defined"
     294#endif
    259295
    260296        /* extraDischargeStrom_mA       */                                                                                      7,                              // mA, current that LiPro consumes itself
     
    262298        /* Battery Empty Detection Mode*/                                                                               1,                              // Auto, from BMS
    263299        /* AUX MODE */                                                                                                                  AUX_MODE_HEATER,// Heizung
     300#if defined SYSTEM_VOLTAGE_12V
    264301        /* AUX SETPOINT ON */                                                                                                   13600,                  // Erkennung Ladegerät ab 13,6V
     302#elif defined SYSTEM_VOLTAGE_24V
     303        /* AUX SETPOINT ON */                                                                                                   27200,                  // Erkennung Ladegerät ab 13,6V
     304#elif defined SYSTEM_VOLTAGE_48V
     305        /* AUX SETPOINT ON */                                                                                                   54400,                  // Erkennung Ladegerät ab 13,6V
     306#else
     307#error No valid device type
     308#endif
    265309        /* AUX SETPOINT OFF */                                                                                                  100,                    // Batterie Entladung wird erkannt bei -100mA
    266310        /* AUX Inverted */                                                                                                              0,                              // Nicht invertiert
  • trunk/fw_g473rct/SES/src/esr.c

    r26 r38  
    1212int32_t current_buffer[SAMPLE_ARRAY_SIZE]; 
    1313int32_t voltage_buffer[SAMPLE_ARRAY_SIZE];
    14 //int32_t current_buffer_fast[SAMPLE_ARRAY_SIZE]; 
    15 //int32_t voltage_buffer_fast[SAMPLE_ARRAY_SIZE];
     14
    1615
    1716extern uint16_t adc12Data[SAMPLE_ARRAY_SIZE][2];
  • trunk/fw_g473rct/SES/src/outputs.c

    r28 r38  
    118118                        //Temperabschaltung Start 80°C
    119119                        //Temperaturabschaltung Stop -99°C
    120                         if (sys_data.s.values.lvpState != OUTPUTS_LVP_OVERCURRENT)
     120                        if ((sys_data.s.values.lvpState != OUTPUTS_LVP_OVERCURRENT) && (sys_data.s.values.lvpState != OUTPUTS_LVP_SHORT_PROTECTION))
    121121                        {
    122122                                //Andere Fehler, automatisches zurücksetzen, wenn keine Fehlerbedingungen mehr vorliegen
     
    209209                        //Wenn Abschaltung aufgrund zu hohem Lade/Lastrom erfolgt ist, dann muss Rücksetzen durch Reset Button erfolgen
    210210                        //Andere Fehler, automatisches zurücksetzen, wenn keine Fehlerbedingungen mehr vorliegen
    211                         if (sys_data.s.values.ovpState != OUTPUTS_OVP_OVERCURRENT)
     211                        if ((sys_data.s.values.ovpState != OUTPUTS_OVP_OVERCURRENT) && (sys_data.s.values.ovpState != OUTPUTS_OVP_SHORT_PROTECTION) )
    212212                        {
    213213                                printf("OUTPUT OVP OK\n");
  • trunk/fw_g473rct/SES/src/shunt_voltage.c

    r24 r38  
    1919#define ADC_RESOLUTION                                            32768 //65536/2 da im differential mode
    2020#define ADC_OFFSET                                                        32768
    21 #define SHUNT_VOLTAGE_DIVIDER                             6
     21
     22#if defined SYSTEM_VOLTAGE_12V
     23  #define SHUNT_VOLTAGE_DIVIDER       6.0
     24#elif defined SYSTEM_VOLTAGE_24V
     25  #define SHUNT_VOLTAGE_DIVIDER       11.0
     26#elif defined SYSTEM_VOLTAGE_48V
     27  #define SHUNT_VOLTAGE_DIVIDER       21.0
     28#else
     29  #error "System voltage not defined"
     30#endif
     31
     32
     33
    2234//      --- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
    2335
Note: See TracChangeset for help on using the changeset viewer.