Tutorial for MPPT 2420 LC software build

Hi,

Anyone has a tutorial or can tell me how to build the hex or bin for this?
I can write Python and program devices but building a hex is something else.

Did you find the firmware repository? It describes which tools you need.

In addition to that, here is some additional information about flashing.

Hi Martin,

I see you updated it last month, i tried it before but for a noob it is not that easy to build this.
I allready have visual studio and added platform io, so i need a bit more info on step 2 and 3 now.

Flashing is not a issue, loads of experience there.

The default settings should be fine. So all you need to do is to select the correct board in PlatformIO, I guess.

OK quick update, i was able to install “Visual Studio Code”, not sure i need that.
Open platform io and add workspace and i pressed build.
It was building but failed… still need to check.

Processing mppt_2420_lc (board: mppt_2420_lc; platform: ststm32@~8.0.0; framework: zephyr)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/mppt_2420_lc.html
PLATFORM: ST STM32 (8.0.0) > Libre Solar MPPT 2420 LC
HARDWARE: STM32F072RBT6 48MHz, 16KB RAM, 128KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:

  • framework-zephyr 2.20300.200823 (2.3.0)
  • framework-zephyr-canopennode 0.0.0-alpha+sha.5c6b0566d5
  • framework-zephyr-civetweb 0.0.0-alpha+sha.99129c5efc
  • framework-zephyr-cmsis 0.0.0-alpha+sha.542b2296e6
  • framework-zephyr-fatfs 0.0.0-alpha+sha.9ee6b9b951
  • framework-zephyr-hal-st 0.0.0-alpha+sha.5b3ec3e182
  • framework-zephyr-hal-stm32 0.0.0-alpha+sha.d1bc80d021
  • framework-zephyr-libmetal 0.0.0-alpha+sha.3c3c9ec83b
  • framework-zephyr-littlefs 0.0.0-alpha+sha.0aefdda69d
  • framework-zephyr-loramac-node 0.0.0-alpha+sha.29e516ec58
  • framework-zephyr-lvgl 0.0.0-alpha+sha.74fc2e753a
  • framework-zephyr-mbedtls 0.0.0-alpha+sha.4bf099f125
  • framework-zephyr-mcuboot 0.0.0-alpha+sha.e88113bbeb
  • framework-zephyr-mcumgr 0.0.0-alpha+sha.5885efb7ca
  • framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.957d46bc3c
  • framework-zephyr-open-amp 0.0.0-alpha+sha.724f7e2a45
  • framework-zephyr-openthread 0.0.0-alpha+sha.a83d18cf18
  • framework-zephyr-segger 0.0.0-alpha+sha.6fcf61606d
  • framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4
  • framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267
  • framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.7de2daa196
  • tool-cmake 3.16.4
  • tool-dtc 1.4.7
  • tool-ninja 1.9.0
  • toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 2 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- 0.2.0
    |-- 0.1.0
    Building in release mode
    Linking .pio\build\mppt_2420_lc\firmware-pre.elf
    Memory region Used Size Region Size %age Used
    FLASH: 80952 B 128 KB 61.76%
    c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX\CMakeCXXCompilerId.o: in function main': SRAM: 16064 B 16 KB 98.05% C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX/CMakeCXXCompilerId.cpp:640: multiple definition of main’; .pio\build\mppt_2420_lc\src\main.o:C:\Users\user\source\repos\charge-controller-firmware/src/main.cpp:31: first defined here
    IDT_LIST: 152 B 2 KB 7.42%
    c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC\CMakeCCompilerId.o: in function main': C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC/CMakeCCompilerId.c:649: multiple definition of main’; .pio\build\mppt_2420_lc\src\main.o:C:\Users\user\source\repos\charge-controller-firmware/src/main.cpp:31: first defined here
    c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC\CMakeCCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC/CMakeCCompilerId.c:634: multiple definition of info_language_dialect_default'; .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX\CMakeCXXCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX/CMakeCXXCompilerId.cpp:621: first defined here c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC\CMakeCCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC/CMakeCCompilerId.c:615: multiple definition of info_arch’; .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX\CMakeCXXCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX/CMakeCXXCompilerId.cpp:600: first defined here
    c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC\CMakeCCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC/CMakeCCompilerId.c:614: multiple definition of info_platform'; .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX\CMakeCXXCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX/CMakeCXXCompilerId.cpp:599: first defined here c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC\CMakeCCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdC/CMakeCCompilerId.c:321: multiple definition of info_compiler’; .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX\CMakeCXXCompilerId.o:C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\3.17.20032601-MSVC_2\CompilerIdCXX/CMakeCXXCompilerId.cpp:306: first defined here
    c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\mppt_2420_lc\src\out\build\x64-Debug (default)\CMakeFiles\ShowIncludes\main.o: in function main': C:\Users\user\source\repos\charge-controller-firmware/src\out\build\x64-Debug (default)\CMakeFiles\ShowIncludes/main.c:2: multiple definition of main’; .pio\build\mppt_2420_lc\src\main.o:C:\Users\user\source\repos\charge-controller-firmware/src/main.cpp:31: first defined here
    collect2.exe: error: ld returned 1 exit status
    *** [.pio\build\mppt_2420_lc\firmware-pre.elf] Error 1

That’s strange and seems to be an issue in the toolchain. Two suggestions:

  • Delete the generated .pio folder in the firmware directory and build again.
  • Upgrade to most recent release of platformio by setting platform = ststm32@~8.1.0 in platformio.ini.

Let me know if that fixed the issues.

Both options did not work so i tried to reinstall. Now its even worse:

Processing mppt_2420_lc (board: mppt_2420_lc; platform: ststm32@~8.0.0; framework: zephyr)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/mppt_2420_lc.html
PLATFORM: ST STM32 (8.0.0) > Libre Solar MPPT 2420 LC
HARDWARE: STM32F072RBT6 48MHz, 16KB RAM, 128KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:

  • framework-zephyr 2.20300.200823 (2.3.0)

  • framework-zephyr-canopennode 0.0.0-alpha+sha.5c6b0566d5

  • framework-zephyr-civetweb 0.0.0-alpha+sha.99129c5efc

  • framework-zephyr-cmsis 0.0.0-alpha+sha.542b2296e6

  • framework-zephyr-fatfs 0.0.0-alpha+sha.9ee6b9b951

  • framework-zephyr-hal-st 0.0.0-alpha+sha.5b3ec3e182

  • framework-zephyr-hal-stm32 0.0.0-alpha+sha.d1bc80d021

  • framework-zephyr-libmetal 0.0.0-alpha+sha.3c3c9ec83b

  • framework-zephyr-littlefs 0.0.0-alpha+sha.0aefdda69d

  • framework-zephyr-loramac-node 0.0.0-alpha+sha.29e516ec58

  • framework-zephyr-lvgl 0.0.0-alpha+sha.74fc2e753a

  • framework-zephyr-mbedtls 0.0.0-alpha+sha.4bf099f125
    [WinError 145] De map is niet leeg: ‘C:\Users\user\source\repos\charge-controller-firmware\charge-controller-firmware\.pio\build\mppt_2420_lc’
    Please manually remove the file C:\Users\user\source\repos\charge-controller-firmware\charge-controller-firmware\.pio\build\mppt_2420_lc - framework-zephyr-mcuboot 0.0.0-alpha+sha.e88113bbeb

  • framework-zephyr-mcumgr 0.0.0-alpha+sha.5885efb7ca

  • framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.957d46bc3c

  • framework-zephyr-open-amp 0.0.0-alpha+sha.724f7e2a45

  • framework-zephyr-openthread 0.0.0-alpha+sha.a83d18cf18

  • framework-zephyr-segger 0.0.0-alpha+sha.6fcf61606d

  • framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4

  • framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267

  • framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.7de2daa196

  • tool-cmake 3.16.4

  • tool-dtc 1.4.7

  • tool-ninja 1.9.0

  • toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
    Reading CMake configuration…
    – Application: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr
    – Zephyr version: 2.3.0 (C:/Users/user/.platformio/packages/framework-zephyr)
    – Found Python3: C:/Users/user/.platformio/penv/Scripts/python.exe (found suitable exact version “3.7.7”) found components: Interpreter
    – Board: mppt_2420_lc
    – Found dtc: C:/Users/user/.platformio/packages/tool-dtc/dtc.exe (found suitable version “1.4.7”, minimum required is “1.4.6”)
    – Found toolchain: gnuarmemb (C:/Users/user/.platformio/packages/toolchain-gccarmnoneeabi)
    – Found BOARD.dts: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/boards/arm/mppt_2420_lc/mppt_2420_lc.dts
    – Generated zephyr.dts: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/zephyr.dts
    – Generated devicetree_unfixed.h: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/include/generated/devicetree_unfixed.h
    Parsing C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr/Kconfig

Loaded configuration ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig’

Merged configuration ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr/prj.conf’

Configuration saved to ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/.config’

Kconfig header saved to ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/include/generated/autoconf.h’

– The C compiler identification is GNU 8.2.1
– The CXX compiler identification is GNU 8.2.1
– The ASM compiler identification is GNU
– Found assembler: C:/Users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe
– Cache files will be written to: C:/Users/user/.platformio/packages/framework-zephyr/.cache
– Could NOT find Git (missing: GIT_EXECUTABLE)
– Configuring incomplete, errors occurred!
See also “C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/CMakeFiles/CMakeOutput.log”.
See also “C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/CMakeFiles/CMakeError.log”.

Including boilerplate (Zephyr base): C:/Users/user/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake
Python path: C:/Users/user/.platformio/penv/Scripts/python.exe
CMake Error at CMakeLists.txt:13 (add_subdirectory):
The source directory

C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/lib/thingset

does not contain a CMakeLists.txt file.

CMake Error at CMakeLists.txt:14 (add_subdirectory):
The source directory

C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/lib/oled-display

does not contain a CMakeLists.txt file.

=============================================================================== [FAILED] Took 5.54 seconds ===============================================================================

Environment Status Duration


mppt_2420_lc FAILED 00:00:05.543
========================================================================= 1 failed, 0 succeeded in 00:00:05.543 =========================================================================
The terminal process “C:\Users\user.platformio\penv\Scripts\platformio.exe ‘run’” terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Executing task in folder charge-controller-firmware: C:\Users\user.platformio\penv\Scripts\platformio.exe run <

Processing mppt_2420_lc (board: mppt_2420_lc; platform: ststm32@~8.0.0; framework: zephyr)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/mppt_2420_lc.html
PLATFORM: ST STM32 (8.0.0) > Libre Solar MPPT 2420 LC
HARDWARE: STM32F072RBT6 48MHz, 16KB RAM, 128KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:

  • framework-zephyr 2.20300.200823 (2.3.0)
  • framework-zephyr-canopennode 0.0.0-alpha+sha.5c6b0566d5
  • framework-zephyr-civetweb 0.0.0-alpha+sha.99129c5efc
  • framework-zephyr-cmsis 0.0.0-alpha+sha.542b2296e6
  • framework-zephyr-fatfs 0.0.0-alpha+sha.9ee6b9b951
  • framework-zephyr-hal-st 0.0.0-alpha+sha.5b3ec3e182
  • framework-zephyr-hal-stm32 0.0.0-alpha+sha.d1bc80d021
  • framework-zephyr-libmetal 0.0.0-alpha+sha.3c3c9ec83b
  • framework-zephyr-littlefs 0.0.0-alpha+sha.0aefdda69d
  • framework-zephyr-loramac-node 0.0.0-alpha+sha.29e516ec58
  • framework-zephyr-lvgl 0.0.0-alpha+sha.74fc2e753a
  • framework-zephyr-mbedtls 0.0.0-alpha+sha.4bf099f125
  • framework-zephyr-mcuboot 0.0.0-alpha+sha.e88113bbeb
  • framework-zephyr-mcumgr 0.0.0-alpha+sha.5885efb7ca
  • framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.957d46bc3c
  • framework-zephyr-open-amp 0.0.0-alpha+sha.724f7e2a45
  • framework-zephyr-openthread 0.0.0-alpha+sha.a83d18cf18
  • framework-zephyr-segger 0.0.0-alpha+sha.6fcf61606d
  • framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4
  • framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267
  • framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.7de2daa196
  • tool-cmake 3.16.4
  • tool-dtc 1.4.7
  • tool-ninja 1.9.0
  • toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
    Reading CMake configuration…
    – Application: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr
    – Zephyr version: 2.3.0 (C:/Users/user/.platformio/packages/framework-zephyr)
    – Found Python3: C:/Users/user/.platformio/penv/Scripts/python.exe (found suitable exact version “3.7.7”) found components: Interpreter
    – Board: mppt_2420_lc
    – Found dtc: C:/Users/user/.platformio/packages/tool-dtc/dtc.exe (found suitable version “1.4.7”, minimum required is “1.4.6”)
    – Found toolchain: gnuarmemb (C:/Users/user/.platformio/packages/toolchain-gccarmnoneeabi)
    – Found BOARD.dts: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/boards/arm/mppt_2420_lc/mppt_2420_lc.dts
    – Generated zephyr.dts: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/zephyr.dts
    – Generated devicetree_unfixed.h: C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/include/generated/devicetree_unfixed.h
    Parsing C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr/Kconfig

Loaded configuration ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig’

Merged configuration ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/zephyr/prj.conf’

Configuration saved to ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/.config’

Kconfig header saved to ‘C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/zephyr/include/generated/autoconf.h’

– The C compiler identification is GNU 8.2.1
– The CXX compiler identification is GNU 8.2.1
– The ASM compiler identification is GNU
– Found assembler: C:/Users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe
– Cache files will be written to: C:/Users/user/.platformio/packages/framework-zephyr/.cache
– Could NOT find Git (missing: GIT_EXECUTABLE)
– Configuring incomplete, errors occurred!
See also “C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/CMakeFiles/CMakeOutput.log”.
See also “C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/.pio/build/mppt_2420_lc/CMakeFiles/CMakeError.log”.

Including boilerplate (Zephyr base): C:/Users/user/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake
Python path: C:/Users/user/.platformio/penv/Scripts/python.exe
CMake Error at CMakeLists.txt:13 (add_subdirectory):
The source directory

C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/lib/thingset

does not contain a CMakeLists.txt file.

CMake Error at CMakeLists.txt:14 (add_subdirectory):
The source directory

C:/Users/user/source/repos/charge-controller-firmware/charge-controller-firmware/lib/oled-display

does not contain a CMakeLists.txt file.

You didn’t follow the README in the charge controller repository, as it seems like you didn’t clone the repository recursively. You also need to have git installed for that, of course.

Thank you!
I do not understand what went wrong the first time. I do have Git installed so i cloned again and this time the build was fine without any problems!
I was able to build 4 firmwares.
I also want to note “Visual Studio Code” is a requirment i noticed somewhere.

Great that it works now.

VS Code is not really a requirement, but it’s the most easy way to get started. You can basically use any editor you like and build + flash the firmware from the command line. Even on the command line you have two options: PlatformIO (which is just a Python package, so it’s easy to install) or the Zephyr native SDK using the west tool (which requires a bit more of setup).

Hi Martin, can you please add pick place file as csv or excel format? jlcpcb not accepting test format. or u can mail me. rkwije79@gmail.com
thanks

You can export the pick&place files from KiCad, similar to the gerber files as explained here.