During tests, the deep discharge counter increased by several 100 counts per day under certain circumstances, most probably because of quite small battery making the voltage toggle between disconnect and reconnect voltage. This commit suggests several improvements.
- Load reconnect voltage increased
- Don't reconnect before waiting at least 1h (lvd_timestamp in load.cpp)
- SOC filter calculation slightly changed to make sure 100% is reached fast enough.
- The DC/DC test function slowly ramps up the duty cycle to 50% to allow defined measurements of gate driver, switch node etc. with an oscilloscope (without disturbance by the MPPT algorithm)
- The dead-time between HS and LS gate on/off is now configurable for each PCB and not fixed to 300 ns for all PCBs anymore.
* Reduced codesize: Switch to newlib-nano
Figured out how to switch to newlib-nano in a simple way.
Reduced build size by about 29k. Applied this to all STM32 builds.
Please test with the STM32L072 hardware, I don't have one of those,
only STM32F072
Also "upgraded" the compiler accepted language standard to gnu c++11 (from gnu++98).
And finally defined that all floating point constants are to be treated
as "floats" and not as double (which is the default). Reduces the number
of implicit double promotions almost to the required minimum.
In some places the double functions are applied to floats which also
causes some unwanted time and code growth. But this is not fixed yet.
* Change travis to try to deploy only on "master" repo
* Fixed typo
gnu++11 was not really enabled, due to copy'n'paste typo.
* Minor fix in documentation
* Make CAN compile again
* Now able to disable uart_serial
* Boots and runs CAN
Requires matching thingset-cpp library
The placement of the ts_can.process_asap/process_1s is a little hack,
but I did want to add even more ifdefs in the main method.
Renaming the functions could do the trick.
BTW, serial and CAN thingset can be run at the same time, no problems.
* Some cleanups in the CAN interface
* log.h: fix signature of log_update_min_max_values
looks like it was changed in log.cpp, but not adjusted in log.h,
somewhen in the past
* adc_dma: only define variables if they are really required
* reduce scope of variables in interface_can.cpp
* `changed` was reassigned a value before the old one was used
* README: reformat flashing troubleshooting section
* README: punctuation fixes
* README: add troubleshooting tip for bad connection between nucleo and MPPT
This way the OLED display does not overwrite useful data since
the stack on the F072RB in mbed is just 1k and the logog is also 1k.
Also fixed minor issue in OLED display code (refactoring not done).
- Battery temperature set to 25 degC if no external sensor connected
- EEPROM selection added to PCB config file
- UEXT power supply enable added to UEXT init functions
Firmware still gets stuck when OLED display is enabled... Error still to be found!
Previously, the DC/DC started at 90% of the solar panel OCV to be closer to the MPP (at around 80% of OCV). This creates stress on the MOSFETs due to high inrush currents. In addtion to that, a high power panel might not be derated fast enough, which caused issues in the 12V/10A charge controller connected to a 280W panel. This commit improves the situation and starts the MPPT slightly below the measured solar voltage with low power.
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.
- Immediate load cut-off in case of current > 2x rated current (still to be fine-tuned)
- Using built-in comparator of STM32 MCU
- Currently only supported by PWM charge controller PCB, as it doesn't have an internal fuse
- Correct negative sign for incoming solar current
- Current multiplied with PWM duty cycle to get average current
- Min/max calculation moved to log.cpp
- Using PlatformIO's embedded unit testing with native environment
- mbed-dependent .cpp files escaped with #ifndef UNIT_TEST
- First tests for charger module added under test/ directory
- Files for interfaces connected via UEXT are stored in separate uext/ directory
- UEXT init and process function names independent of connected module
- LED function names adjusted to start with leds_
- main.cpp structure simplified