diff --git a/src/pcb.h b/src/pcb.h index 6dc6a2a..ceb51fb 100644 --- a/src/pcb.h +++ b/src/pcb.h @@ -23,43 +23,6 @@ * Includes PCB hardware specific settings like pin names depending on the compiler flags set in platformio.ini. */ -// generic settings (for all charge controller boards) -/////////////////////////////////////////////////////////////////////////////// - -/** Main control function frequency (Hz) - * - * Frequencies higher than 10 Hz caused issues with MPPT control during lab test with - * PV simulator. Might be different with actual solar panel. - */ -#define CONTROL_FREQUENCY 10 - -/** Maximum Tj of MOSFETs (°C) - * - * This value is used for model-based control of overcurrent protection. It represents - * the steady-state junction temperature for max. continuous current at ambient - * temperature of 25°C. - */ -#define MOSFET_MAX_JUNCTION_TEMP 120 - -/** Internal reference temperature at full load (°C) - * - * This value is used for model-based control of overcurrent protection. It represents - * the steady-state internal temperature for max. continuous current at ambient - * temperature of 25°C. - */ -#define INTERNAL_MAX_REFERENCE_TEMP 50 - -/** Thermal time constant junction to ambient (s) - * - * This value is used for model-based control of overcurrent protection. It does not reflect - * the much lower MOSFET-internal time constant junction to case, but includes thermal inertia - * of the board. - * - * Around 5s seems to be a good conservative estimation for 5x6 type SMD MOSFETs - */ -#define MOSFET_THERMAL_TIME_CONSTANT 5 - - // specific board settings /////////////////////////////////////////////////////////////////////////////// @@ -79,4 +42,48 @@ #error "PCB has to be specified!" #endif +// generic default settings (if not defined different in board config) +/////////////////////////////////////////////////////////////////////////////// + +/** Main control function frequency (Hz) + * + * Frequencies higher than 10 Hz caused issues with MPPT control during lab test with + * PV simulator. Might be different with actual solar panel. + */ +#ifndef CONTROL_FREQUENCY +#define CONTROL_FREQUENCY 10 +#endif + +/** Maximum Tj of MOSFETs (°C) + * + * This value is used for model-based control of overcurrent protection. It represents + * the steady-state junction temperature for max. continuous current at ambient + * temperature of 25°C. + */ +#ifndef MOSFET_MAX_JUNCTION_TEMP +#define MOSFET_MAX_JUNCTION_TEMP 120 +#endif + +/** Internal reference temperature at full load (°C) + * + * This value is used for model-based control of overcurrent protection. It represents + * the steady-state internal temperature for max. continuous current at ambient + * temperature of 25°C. Value here is conservative and can be overwritten in PCB configuration. + */ +#ifndef INTERNAL_MAX_REFERENCE_TEMP +#define INTERNAL_MAX_REFERENCE_TEMP 50 +#endif + +/** Thermal time constant junction to ambient (s) + * + * This value is used for model-based control of overcurrent protection. It does not reflect + * the much lower MOSFET-internal time constant junction to case, but includes thermal inertia + * of the board. + * + * Around 5s seems to be a good conservative estimation for 5x6 type SMD MOSFETs + */ +#ifndef MOSFET_THERMAL_TIME_CONSTANT +#define MOSFET_THERMAL_TIME_CONSTANT 5 +#endif + #endif /* PCB_H */ diff --git a/src/pcbs/pwm_2420_lus.h b/src/pcbs/pwm_2420_lus.h index 53e8faa..146bdc7 100644 --- a/src/pcbs/pwm_2420_lus.h +++ b/src/pcbs/pwm_2420_lus.h @@ -33,14 +33,21 @@ #define FEATURE_LOAD_OUTPUT 1 #define PWM_TIM 3 // use TIM3 timer -#define PWM_FREQUENCY 25 // Hz +#define PWM_FREQUENCY 50 // Hz -#define PWM_CURRENT_MAX 20 // PCB maximum PWM switch (solar) current -#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current +// Current reduced to 15A. Increase to 20A PCB max values only if attached to a big heat sink. +#define PWM_CURRENT_MAX 15 // PCB maximum PWM switch (solar) current +#define LOAD_CURRENT_MAX 15 // PCB maximum load switch current -#define LOW_SIDE_VOLTAGE_MAX 30 // Maximum voltage at battery port (V) +#define LOW_SIDE_VOLTAGE_MAX 32 // Maximum voltage at battery port (V) #define HIGH_SIDE_VOLTAGE_MAX 55 // Maximum voltage at PV input port (V) +// The MCU, where internal temperature is measured, is close to the MOSFETs. Tests showed that +// temperature at heat sink is only 10-20°C above measured internal temp. As PWM CC doesn't +// use electrolytic cap for core charging function, internal temperature of 70°C can be allowed. +// This value is used for thermal overcurrent model. +#define INTERNAL_MAX_REFERENCE_TEMP 70 + #define PIN_UEXT_TX PA_2 #define PIN_UEXT_RX PA_3 #define PIN_UEXT_SCL PB_6 @@ -84,6 +91,7 @@ static const PinName led_pins[NUM_LED_PINS] = { PB_13, PB_14, PB_15 }; +#ifndef LEDS_WRONG_POLARITY static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_HIGH, PIN_LOW, PIN_FLOAT }, // LED1 { PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED2 @@ -91,8 +99,7 @@ static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_FLOAT, PIN_HIGH, PIN_LOW }, // LED4 { PIN_FLOAT, PIN_LOW, PIN_HIGH } // LED5 }; - -/* +#else // LEDs with wrong polarity static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED1 @@ -101,7 +108,7 @@ static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_FLOAT, PIN_LOW, PIN_HIGH }, // LED4 { PIN_FLOAT, PIN_HIGH, PIN_LOW } // LED5 }; -*/ +#endif // pin definition only needed in adc_dma.cpp to detect if they are present on the PCB #define PIN_ADC_TEMP_BAT