Faster load short circuit protection via LPTIM

The PWM charge controllers don't have a fuse and need a reliable load short
circuit protection implemented in the microcontroller. The comparator
monitoring the load current now triggers LPTIM connected to the load
disable pin. This allows to switch off the load with a defined time delay
and glitch filter.

During tests, switching off the load in an ISR triggered by COMP2 did
not lead to reliable delays (especially in case of wake-up from sleep),
hence this alternative solution using LPTIM was implemented.

The load switch functions were moved from hardware.cpp to load.cpp.
This commit is contained in:
Martin Jaeger
2019-06-12 09:45:19 +02:00
parent f0301625d7
commit 0e91c834ac
5 changed files with 194 additions and 115 deletions
+5 -3
View File
@@ -27,9 +27,11 @@
//#define DCDC_MODE_INIT MODE_NANOGRID
// basic battery configuration
#define BATTERY_TYPE BAT_TYPE_GEL // GEL most suitable for general batteries (see battery.h for other types)
#define BATTERY_NUM_CELLS 6 // For lead-acid batteries: 6 for 12V system, 12 for 24V system
#define BATTERY_CAPACITY 40 // Cell capacity or sum of parallel cells capacity (Ah)
#define BATTERY_TYPE BAT_TYPE_GEL ///< GEL most suitable for general batteries (see battery.h for other types)
#define BATTERY_NUM_CELLS 6 ///< For lead-acid batteries: 6 for 12V system, 12 for 24V system
#define BATTERY_CAPACITY 40 ///< Cell capacity or sum of parallel cells capacity (Ah)
#define LOAD_OVERCURRENT_RECOVERY_TIMEOUT (5*30) ///< Seconds to wait until load is switched back on after an overcurrent event
#define DEVICE_ID 12345678