Martin Jaeger 0e91c834ac 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.
2019-06-12 09:45:19 +02:00
2019-03-05 15:32:41 +01:00
2019-03-31 18:14:57 +02:00
2016-08-02 14:02:09 +02:00
2017-04-14 18:04:13 +02:00

Libre Solar Charge Controller Firmware

build badge

Firmware based on ARM mbed framework for the Libre Solar MPPT/PWM solar charge controllers

Supported devices

The software is configurable to support different charge controller PCBs with either STM32F072 (including CAN support) or low-power STM32L072/3 MCUs.

Toolchain and flashing instructions

See the Libre Solar website for a detailed instruction how to develop software and flash new firmware.

Remark: Flashing the STM32L072 MCU (as used in the MPPT 1210 HUS and the PWM charge controller) using OpenOCD with the standard settings from PlatformIO fails in many cases. Possible workarounds:

  1. Change OpenOCD settings to set WORKAREASIZE 0x1000 in the file ~/.platformio/packages/tool-openocd/scripts/board/st_nucleo_l073rz.cfg.

  2. Use ST-Link tools. For Windows there is a GUI tool. Under Linux use following command:

    st-flash write .pioenvs/mppt-2420-lc-v0.10/firmware.bin 0x08000000

  3. Use other debuggers and tools, e.g. Segger J-Link.

Initial software setup (IMPORTANT!)

  1. Select the correct board in platformio.ini by removing the comment before the board name under [platformio]
  2. Copy config.h_template to config.h and adjust basic settings (config.h is ignored by git, so your changes are kept after software updates using git pull)

API documentation

The documentation auto-generated by Doxygen can be found here.

Unit tests

In order to run the unit tests, you need a PlatformIO Plus account. Run tests with the following command:

platformio test -e unit-test-native

Additional firmware documentation (docs folder)

S
Description
Firmware for Libre Solar MPPT/PWM charge controllers
https://libre.solar/charge-controller-firmware/
Readme
5.7 MiB
Languages
C++ 77.6%
C 18.1%
CMake 1.6%
Python 1.4%
Shell 0.7%
Other 0.6%