DC/DC: HS MOSFET fail-safe protection enabled

This commit is contained in:
Martin Jaeger
2020-01-27 15:12:15 +01:00
parent a457c2cc9b
commit dc394cc198
4 changed files with 27 additions and 8 deletions
+5
View File
@@ -32,6 +32,11 @@
#define CONFIG_DEVICE_ID 12345678
// This enables a safety-feature for the MPPT charge controllers to blow the fuse and disable
// charging in case the HS MOSFET was shorted (e.g. by someone connecting a solar panel with
// too high voltage).
#define CONFIG_HS_MOSFET_FAIL_SAFE_PROTECTION 1
#define THINGSET_USER_PASSWORD "user123"
#define THINGSET_MAKER_PASSWORD "maker456"
+14 -7
View File
@@ -11,6 +11,7 @@
#include "helper.h"
#include "half_bridge.h"
#include "eeprom.h"
#include <math.h> // for fabs function
#include <stdlib.h> // for min/max function
@@ -263,13 +264,19 @@ void Dcdc::emergency_stop()
off_timestamp = uptime();
}
void Dcdc::self_destruction()
void Dcdc::fuse_destruction()
{
print_error("Charge controller self-destruction called!\n");
//half_bridge_stop();
//half_bridge_init(50, 0, 0, 0.98); // reset safety limits to allow 0% duty cycle
//half_bridge_start(0);
// now the fuse should be triggered and we disappear
static int counter = 0;
if (counter > 20) { // wait 20s to be able to send out data
print_error("Charge controller fuse destruction called!\n");
eeprom_store_data();
half_bridge_stop();
half_bridge_init(50, 0, 0, 0.98); // reset safety limits to allow 0% duty cycle
half_bridge_start(0);
// now the fuse should be triggered and we disappear
}
counter++;
}
#endif /* CHARGER_TYPE_PWM */
#endif /* CONFIG_HAS_DCDC_CONVERTER */
+1 -1
View File
@@ -90,7 +90,7 @@ public:
* reason for self destruction should be logged and stored to EEPROM prior to calling this
* function, as the charge controller power supply will be cut after the fuse is destroyed.
*/
void self_destruction();
void fuse_destruction();
DcdcOperationMode mode; ///< DC/DC mode (buck, boost or nanogrid)
bool enabled; ///< Can be used to disable the DC/DC power stage
+7
View File
@@ -155,6 +155,7 @@ int main()
#if CONFIG_HAS_DCDC_CONVERTER
bat_terminal.pass_voltage_targets(&dcdc_lv_port);
#endif
#if CONFIG_HAS_PWM_SWITCH
bat_terminal.pass_voltage_targets(&pwm_port_int);
#endif
@@ -166,6 +167,12 @@ int main()
ext_mgr.process_1s();
#if CONFIG_HS_MOSFET_FAIL_SAFE_PROTECTION && CONFIG_HAS_DCDC_CONVERTER
if (dev_stat.has_error(ERR_DCDC_HS_MOSFET_SHORT)) {
dcdc.fuse_destruction();
}
#endif
last_call = now;
}
feed_the_dog();