From 5523f9354484cf1b9e295a3ed8a4f4104e6db87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Sun, 5 Apr 2020 13:15:57 +0200 Subject: [PATCH] Handle PCB versioning with DTS overlays This commit completely removes versions like _0v4 in board names and adds DTS overlays to zephyr/ directory. These can be used to compile for older board versions. Some additional configuration changes are handled in board.h file using board version number from DT_CHARGE_CONTROLLER_PCB_VERSION_NUM. --- .travis.yml | 6 +- .../CMakeLists.txt | 0 .../Kconfig | 0 .../Kconfig.board | 4 +- .../Kconfig.defconfig | 4 +- .../board.cmake | 0 .../board.h | 54 +++++++-- .../mppt_1210_hus.dts} | 2 +- .../mppt_1210_hus.yaml} | 4 +- .../mppt_1210_hus_defconfig} | 0 .../pinmux.c | 13 ++ .../support/openocd.cfg | 0 .../arm/mppt_1210_hus_0v4/Kconfig.defconfig | 39 ------ .../mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts | 112 ------------------ boards/arm/mppt_1210_hus_0v7/Kconfig.board | 6 - boards/arm/mppt_1210_hus_0v7/board.h | 101 ---------------- .../mppt_1210_hus_0v7/mppt_1210_hus_0v7.yaml | 18 --- boards/arm/mppt_1210_hus_0v7/pinmux.c | 74 ------------ .../arm/mppt_1210_hus_0v7/support/openocd.cfg | 27 ----- boards/arm/mppt_2420_hpx/board.h | 4 +- boards/arm/mppt_2420_hpx/mppt_2420_hpx.dts | 2 +- .../CMakeLists.txt | 0 .../Kconfig | 0 .../Kconfig.board | 4 +- .../Kconfig.defconfig | 4 +- .../board.cmake | 0 .../board.h | 4 +- .../mppt_2420_lc.dts} | 2 +- .../mppt_2420_lc.yaml} | 4 +- .../mppt_2420_lc_defconfig} | 0 .../pinmux.c | 0 .../support/openocd.cfg | 0 .../CMakeLists.txt | 0 .../Kconfig | 0 .../Kconfig.board | 4 +- .../Kconfig.defconfig | 6 +- .../board.cmake | 0 .../board.h | 0 .../pinmux.c | 0 .../pwm_2420_lus.dts} | 2 +- .../pwm_2420_lus.yaml} | 4 +- .../pwm_2420_lus_defconfig} | 0 .../support/openocd.cfg | 0 boards/arm/pwm_2420_lus_0v3/CMakeLists.txt | 9 -- boards/arm/pwm_2420_lus_0v3/Kconfig | 5 - boards/arm/pwm_2420_lus_0v3/board.cmake | 6 - .../pwm_2420_lus_0v3_defconfig | 35 ------ ...t_1210_hus_0v4.json => mppt_1210_hus.json} | 2 +- boards/mppt_1210_hus_0v7.json | 43 ------- boards/mppt_2420_hpx.json | 2 +- ...pt_2420_lc_0v10.json => mppt_2420_lc.json} | 2 +- ...wm_2420_lus_0v3.json => pwm_2420_lus.json} | 0 check.bat | 6 +- check.sh | 6 +- platformio.ini | 36 +++--- zephyr/.gitignore | 9 ++ zephyr/mppt_1210_hus.overlay_0v4 | 54 +++++++++ ...s_0v2.overlay => pwm_2420_lus.overlay_0v2} | 0 58 files changed, 177 insertions(+), 542 deletions(-) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/CMakeLists.txt (100%) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/Kconfig (100%) rename boards/arm/{pwm_2420_lus_0v3 => mppt_1210_hus}/Kconfig.board (63%) mode change 100644 => 100755 rename boards/arm/{mppt_1210_hus_0v7 => mppt_1210_hus}/Kconfig.defconfig (87%) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/board.cmake (100%) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/board.h (66%) rename boards/arm/{mppt_1210_hus_0v7/mppt_1210_hus_0v7.dts => mppt_1210_hus/mppt_1210_hus.dts} (97%) rename boards/arm/{pwm_2420_lus_0v3/pwm_2420_lus_0v3.yaml => mppt_1210_hus/mppt_1210_hus.yaml} (76%) mode change 100644 => 100755 rename boards/arm/{mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig => mppt_1210_hus/mppt_1210_hus_defconfig} (100%) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/pinmux.c (87%) rename boards/arm/{mppt_1210_hus_0v4 => mppt_1210_hus}/support/openocd.cfg (100%) delete mode 100755 boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig delete mode 100755 boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts delete mode 100755 boards/arm/mppt_1210_hus_0v7/Kconfig.board delete mode 100644 boards/arm/mppt_1210_hus_0v7/board.h delete mode 100755 boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.yaml delete mode 100755 boards/arm/mppt_1210_hus_0v7/pinmux.c delete mode 100755 boards/arm/mppt_1210_hus_0v7/support/openocd.cfg rename boards/arm/{mppt_1210_hus_0v7 => mppt_2420_lc}/CMakeLists.txt (100%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/Kconfig (100%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/Kconfig.board (62%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/Kconfig.defconfig (86%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/board.cmake (100%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/board.h (98%) rename boards/arm/{mppt_2420_lc_0v10/mppt_2420_lc_0v10.dts => mppt_2420_lc/mppt_2420_lc.dts} (97%) rename boards/arm/{mppt_2420_lc_0v10/mppt_2420_lc_0v10.yaml => mppt_2420_lc/mppt_2420_lc.yaml} (74%) rename boards/arm/{mppt_2420_lc_0v10/mppt_2420_lc_0v10_defconfig => mppt_2420_lc/mppt_2420_lc_defconfig} (100%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/pinmux.c (100%) rename boards/arm/{mppt_2420_lc_0v10 => mppt_2420_lc}/support/openocd.cfg (100%) rename boards/arm/{mppt_2420_lc_0v10 => pwm_2420_lus}/CMakeLists.txt (100%) mode change 100755 => 100644 rename boards/arm/{mppt_1210_hus_0v7 => pwm_2420_lus}/Kconfig (100%) rename boards/arm/{mppt_1210_hus_0v4 => pwm_2420_lus}/Kconfig.board (62%) mode change 100755 => 100644 rename boards/arm/{pwm_2420_lus_0v3 => pwm_2420_lus}/Kconfig.defconfig (81%) rename boards/arm/{mppt_1210_hus_0v7 => pwm_2420_lus}/board.cmake (100%) mode change 100755 => 100644 rename boards/arm/{pwm_2420_lus_0v3 => pwm_2420_lus}/board.h (100%) rename boards/arm/{pwm_2420_lus_0v3 => pwm_2420_lus}/pinmux.c (100%) rename boards/arm/{pwm_2420_lus_0v3/pwm_2420_lus_0v3.dts => pwm_2420_lus/pwm_2420_lus.dts} (97%) rename boards/arm/{mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml => pwm_2420_lus/pwm_2420_lus.yaml} (75%) mode change 100755 => 100644 rename boards/arm/{mppt_1210_hus_0v7/mppt_1210_hus_0v7_defconfig => pwm_2420_lus/pwm_2420_lus_defconfig} (100%) mode change 100755 => 100644 rename boards/arm/{pwm_2420_lus_0v3 => pwm_2420_lus}/support/openocd.cfg (100%) delete mode 100644 boards/arm/pwm_2420_lus_0v3/CMakeLists.txt delete mode 100644 boards/arm/pwm_2420_lus_0v3/Kconfig delete mode 100644 boards/arm/pwm_2420_lus_0v3/board.cmake delete mode 100644 boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3_defconfig rename boards/{mppt_1210_hus_0v4.json => mppt_1210_hus.json} (94%) delete mode 100644 boards/mppt_1210_hus_0v7.json rename boards/{mppt_2420_lc_0v10.json => mppt_2420_lc.json} (94%) rename boards/{pwm_2420_lus_0v3.json => pwm_2420_lus.json} (100%) create mode 100644 zephyr/.gitignore create mode 100644 zephyr/mppt_1210_hus.overlay_0v4 rename zephyr/{pwm_2420_lus_0v2.overlay => pwm_2420_lus.overlay_0v2} (100%) diff --git a/.travis.yml b/.travis.yml index 634fa74..1d9201e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,9 @@ addons: script: # check for trailing white spaces (comparing with first commit in git log) - git diff --check `git rev-list HEAD | tail -n 1`..$TRAVIS_BRANCH - - platformio run -e mppt-2420-lc-v0.10 -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 - - platformio test -e unit-test-native - - platformio check -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 + - platformio run -e mppt_2420_lc -e mppt_1210_hus -e mppt_2420_hpx -e pwm_2420_lus + - platformio test -e unit_test + - platformio check -e mppt_1210_hus -e pwm_2420_lus - doxygen Doxyfile deploy: diff --git a/boards/arm/mppt_1210_hus_0v4/CMakeLists.txt b/boards/arm/mppt_1210_hus/CMakeLists.txt similarity index 100% rename from boards/arm/mppt_1210_hus_0v4/CMakeLists.txt rename to boards/arm/mppt_1210_hus/CMakeLists.txt diff --git a/boards/arm/mppt_1210_hus_0v4/Kconfig b/boards/arm/mppt_1210_hus/Kconfig similarity index 100% rename from boards/arm/mppt_1210_hus_0v4/Kconfig rename to boards/arm/mppt_1210_hus/Kconfig diff --git a/boards/arm/pwm_2420_lus_0v3/Kconfig.board b/boards/arm/mppt_1210_hus/Kconfig.board old mode 100644 new mode 100755 similarity index 63% rename from boards/arm/pwm_2420_lus_0v3/Kconfig.board rename to boards/arm/mppt_1210_hus/Kconfig.board index 76e35d0..9bf7c9d --- a/boards/arm/pwm_2420_lus_0v3/Kconfig.board +++ b/boards/arm/mppt_1210_hus/Kconfig.board @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -config BOARD_PWM_2420_LUS_0V3 - bool "Libre Solar PWM 2420 LUS v0.3" +config BOARD_MPPT_1210_HUS + bool "Libre Solar MPPT 1210 HUS" depends on SOC_STM32L073XX diff --git a/boards/arm/mppt_1210_hus_0v7/Kconfig.defconfig b/boards/arm/mppt_1210_hus/Kconfig.defconfig similarity index 87% rename from boards/arm/mppt_1210_hus_0v7/Kconfig.defconfig rename to boards/arm/mppt_1210_hus/Kconfig.defconfig index 6bb595c..912ab75 100755 --- a/boards/arm/mppt_1210_hus_0v7/Kconfig.defconfig +++ b/boards/arm/mppt_1210_hus/Kconfig.defconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -if BOARD_MPPT_1210_HUS_0V7 +if BOARD_MPPT_1210_HUS config BOARD - default "mppt_1210_hus_0v7" + default "mppt_1210_hus" config HAS_LOAD_OUTPUT default y diff --git a/boards/arm/mppt_1210_hus_0v4/board.cmake b/boards/arm/mppt_1210_hus/board.cmake similarity index 100% rename from boards/arm/mppt_1210_hus_0v4/board.cmake rename to boards/arm/mppt_1210_hus/board.cmake diff --git a/boards/arm/mppt_1210_hus_0v4/board.h b/boards/arm/mppt_1210_hus/board.h similarity index 66% rename from boards/arm/mppt_1210_hus_0v4/board.h rename to boards/arm/mppt_1210_hus/board.h index 75d9717..206b6ec 100644 --- a/boards/arm/mppt_1210_hus_0v4/board.h +++ b/boards/arm/mppt_1210_hus/board.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2018 Martin Jäger / Libre Solar + * Copyright (c) 2019 Martin Jäger / Libre Solar * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef MPPT_1210_HUS_0V4_H -#define MPPT_1210_HUS_0V4_H +#ifndef MPPT_1210_HUS_H +#define MPPT_1210_HUS_H #define LOAD_CURRENT_MAX 10 // PCB maximum load switch current @@ -21,9 +21,6 @@ #define PIN_SWD_TX PA_9 #define PIN_SWD_RX PA_10 -#define PIN_LOAD_EN PC_13 -#define PIN_USB_PWR_EN PB_12 - #define PIN_REF_I_DCDC PA_4 enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT }; @@ -34,16 +31,26 @@ enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT }; #define LED_SOC_1 0 // LED1 #define LED_SOC_2 1 // LED2 #define LED_SOC_3 2 // LED3 +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 #define LED_RXTX 3 // LED4, used to indicate when sending data #define LED_LOAD 4 // LED5 +#else +#define LED_LOAD 3 // LED4 +#define LED_RXTX 4 // LED5, used to indicate when sending data +#endif // LED pins and pin state configuration to switch above LEDs on +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 #define NUM_LED_PINS 5 +#else +#define NUM_LED_PINS 3 +#endif // defined in board definition pinmux.c extern const char *led_ports[NUM_LED_PINS]; extern const int led_pins[NUM_LED_PINS]; +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_HIGH, PIN_LOW, PIN_LOW, PIN_LOW, PIN_LOW }, // LED1 { PIN_LOW, PIN_HIGH, PIN_LOW, PIN_LOW, PIN_LOW }, // LED2 @@ -51,9 +58,22 @@ const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { { PIN_LOW, PIN_LOW, PIN_LOW, PIN_HIGH, PIN_LOW }, // LED4 { PIN_LOW, PIN_LOW, PIN_LOW, PIN_LOW, PIN_HIGH } // LED5 }; +#else +static const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { + { PIN_HIGH, PIN_LOW, PIN_FLOAT }, // LED1 + { PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED2 + { PIN_HIGH, PIN_FLOAT, PIN_LOW }, // LED3 + { PIN_FLOAT, PIN_HIGH, PIN_LOW }, // LED4 + { PIN_FLOAT, PIN_LOW, PIN_HIGH } // LED5 +}; +#endif // pin definition only needed in adc_dma.cpp to detect if they are present on the PCB +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 #define PIN_ADC_TEMP_FETS PA_5 +#else +#define PIN_ADC_TEMP_BAT +#endif // typical value for Semitec 103AT-5 thermistor: 3435 #define NTC_BETA_VALUE 3435 @@ -61,10 +81,16 @@ const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { #define ADC_GAIN_V_LOW (105.6 / 5.6) // both voltage dividers: 100k + 5.6k #define ADC_GAIN_V_HIGH (105.6 / 5.6) +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 #define ADC_GAIN_I_LOAD (1000 / 4 / 50) // amp gain: 50, resistor: 4 mOhm #define ADC_GAIN_I_DCDC (1000 / 4 / 50) +#else +#define ADC_GAIN_I_LOAD (1000.0 / 3.0 / 50.0) // amp gain: 50, resistor: 3 mOhm +#define ADC_GAIN_I_DCDC (1000.0 / 3.0 / 50.0) +#endif // position in the array written by the DMA controller +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 enum { ADC_POS_V_LOW, // ADC 0 (PA_0) ADC_POS_V_HIGH, // ADC 1 (PA_1) @@ -80,11 +106,23 @@ enum { #endif NUM_ADC_CH // trick to get the number of elements }; +#else +enum { + ADC_POS_V_LOW, // ADC 0 (PA_0) + ADC_POS_V_HIGH, // ADC 1 (PA_1) + ADC_POS_I_LOAD, // ADC 5 (PA_5) + ADC_POS_I_DCDC, // ADC 6 (PA_6) + ADC_POS_TEMP_BAT, // ADC 7 (PA_7) + ADC_POS_VREF_MCU, // ADC 17 + ADC_POS_TEMP_MCU, // ADC 18 + NUM_ADC_CH // trick to get the number of elements +}; +#endif #define NUM_ADC_1_CH NUM_ADC_CH // selected ADC channels (has to match with above enum) -#if defined(STM32F0) || defined(CONFIG_SOC_SERIES_STM32F0X) +#if defined(CONFIG_SOC_SERIES_STM32F0X) #define ADC_CHSEL ( \ ADC_CHSELR_CHSEL0 | \ ADC_CHSELR_CHSEL1 | \ @@ -94,7 +132,7 @@ enum { ADC_CHSELR_CHSEL16 | \ ADC_CHSELR_CHSEL17 \ ) -#elif defined(STM32L0) || defined(CONFIG_SOC_SERIES_STM32L0X) +#elif defined(CONFIG_SOC_SERIES_STM32L0X) #define ADC_CHSEL ( \ ADC_CHSELR_CHSEL0 | \ ADC_CHSELR_CHSEL1 | \ diff --git a/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.dts b/boards/arm/mppt_1210_hus/mppt_1210_hus.dts similarity index 97% rename from boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.dts rename to boards/arm/mppt_1210_hus/mppt_1210_hus.dts index d033b50..5c11a31 100755 --- a/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.dts +++ b/boards/arm/mppt_1210_hus/mppt_1210_hus.dts @@ -8,7 +8,7 @@ #include / { - model = "Libre Solar MPPT 1210 HUS v0.7"; + model = "Libre Solar MPPT 1210 HUS"; compatible = "st,stm32l073"; pcb { diff --git a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.yaml b/boards/arm/mppt_1210_hus/mppt_1210_hus.yaml old mode 100644 new mode 100755 similarity index 76% rename from boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.yaml rename to boards/arm/mppt_1210_hus/mppt_1210_hus.yaml index d657416..9d127d6 --- a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.yaml +++ b/boards/arm/mppt_1210_hus/mppt_1210_hus.yaml @@ -1,5 +1,5 @@ -identifier: pwm_2420_lus_0v3 -name: PWM-2420-LUS-0V3 +identifier: mppt_1210_hus +name: MPPT-1210-HUS type: mcu arch: arm toolchain: diff --git a/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig b/boards/arm/mppt_1210_hus/mppt_1210_hus_defconfig similarity index 100% rename from boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig rename to boards/arm/mppt_1210_hus/mppt_1210_hus_defconfig diff --git a/boards/arm/mppt_1210_hus_0v4/pinmux.c b/boards/arm/mppt_1210_hus/pinmux.c similarity index 87% rename from boards/arm/mppt_1210_hus_0v4/pinmux.c rename to boards/arm/mppt_1210_hus/pinmux.c index 893e737..556f766 100755 --- a/boards/arm/mppt_1210_hus_0v4/pinmux.c +++ b/boards/arm/mppt_1210_hus/pinmux.c @@ -62,6 +62,7 @@ static int pinmux_stm32_init(struct device *port) SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); +#if DT_CHARGE_CONTROLLER_PCB_VERSION_NUM == 4 const char *led_ports[] = { DT_GPIO_LEDS_GND_GPIOS_CONTROLLER, DT_GPIO_LEDS_SOC12_GPIOS_CONTROLLER, @@ -76,3 +77,15 @@ const int led_pins[] = { DT_GPIO_LEDS_RXTX_GPIOS_PIN, DT_GPIO_LEDS_LOAD_GPIOS_PIN }; +#else +const char *led_ports[] = { + DT_GPIO_LEDS_A_GPIOS_CONTROLLER, + DT_GPIO_LEDS_C_GPIOS_CONTROLLER, + DT_GPIO_LEDS_B_GPIOS_CONTROLLER, +}; +const int led_pins[] = { + DT_GPIO_LEDS_A_GPIOS_PIN, + DT_GPIO_LEDS_C_GPIOS_PIN, + DT_GPIO_LEDS_B_GPIOS_PIN, +}; +#endif diff --git a/boards/arm/mppt_1210_hus_0v4/support/openocd.cfg b/boards/arm/mppt_1210_hus/support/openocd.cfg similarity index 100% rename from boards/arm/mppt_1210_hus_0v4/support/openocd.cfg rename to boards/arm/mppt_1210_hus/support/openocd.cfg diff --git a/boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig b/boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig deleted file mode 100755 index 6dfe225..0000000 --- a/boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -if BOARD_MPPT_1210_HUS_0V4 - -config BOARD - default "mppt_1210_hus_0v4" - -config HAS_LOAD_OUTPUT - default y - -config HAS_USB_PWR_OUTPUT - default y - -if UART_CONSOLE - -config UART_2 - default y - -endif # UART_CONSOLE - -if I2C - -config I2C_1 - default y - -endif # I2C - -if SPI - -config SPI_1 - default y - -config SPI_STM32_INTERRUPT - default y - -endif # SPI - -endif # BOARD_MPPT_1210_HUS_0V4 diff --git a/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts deleted file mode 100755 index da1f195..0000000 --- a/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts +++ /dev/null @@ -1,112 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2019 Martin Jäger / Libre Solar - */ - -/dts-v1/; -#include - -/ { - model = "Libre Solar MPPT 1210 HUS v0.4"; - compatible = "st,stm32l073"; - - pcb { - compatible = "charge-controller"; - - type = "MPPT 1210 HUS"; - version-str = "v0.4"; - version-num = <4>; - - hs-voltage-max = <40>; - ls-voltage-max = <16>; - }; - - dcdc { - compatible = "dcdc"; - pwm-frequency = <50000>; - pwm-deadtime = <230>; - current-max = <10>; - }; - - chosen { - zephyr,console = &usart1; - zephyr,shell-uart = &usart1; - zephyr,sram = &sram0; - zephyr,flash = &flash0; - }; - - leds { - compatible = "gpio-leds"; - gnd { - gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>; - label = "LED GND"; - }; - soc12 { - gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>; - label = "LED SOC12"; - }; - soc3 { - gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>; - label = "LED SOC3"; - }; - rxtx { - gpios = <&gpiob 11 GPIO_ACTIVE_HIGH>; - label = "LED RXTX"; - }; - load { - gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; - label = "LED Load"; - }; - }; - - switches { - compatible = "switch"; - load { - gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>; - label = "Load enable"; - }; - usb-pwr { - gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>; - label = "USB charging port enable"; - }; - }; - - aliases { - uart-dbg = &usart1; - uext-uart = &usart2; - spi-uext = &spi1; - i2c-uext = &i2c1; - }; -}; - -&usart1 { - current-speed = <115200>; - status = "okay"; -}; - -&usart2 { - current-speed = <115200>; - status = "okay"; -}; - -&i2c1 { - status = "okay"; - clock-frequency = ; -}; - -&spi1 { - status = "okay"; -}; - -&iwdg { - status = "okay"; -}; - -&adc1 { - status = "okay"; -}; - -&eeprom { - status = "okay"; -}; diff --git a/boards/arm/mppt_1210_hus_0v7/Kconfig.board b/boards/arm/mppt_1210_hus_0v7/Kconfig.board deleted file mode 100755 index 0e83836..0000000 --- a/boards/arm/mppt_1210_hus_0v7/Kconfig.board +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -config BOARD_MPPT_1210_HUS_0V7 - bool "Libre Solar MPPT 1210 HUS v0.7" - depends on SOC_STM32L073XX diff --git a/boards/arm/mppt_1210_hus_0v7/board.h b/boards/arm/mppt_1210_hus_0v7/board.h deleted file mode 100644 index c8e8bf3..0000000 --- a/boards/arm/mppt_1210_hus_0v7/board.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2019 Martin Jäger / Libre Solar - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef MPPT_1210_HUS_0V7_H -#define MPPT_1210_HUS_0V7_H - -#define LOAD_CURRENT_MAX 10 // PCB maximum load switch current - -#define PIN_UEXT_TX PA_2 -#define PIN_UEXT_RX PA_3 -#define PIN_UEXT_SCL PB_6 -#define PIN_UEXT_SDA PB_7 -#define PIN_UEXT_MISO PB_4 -#define PIN_UEXT_MOSI PB_5 -#define PIN_UEXT_SCK PB_3 -#define PIN_UEXT_SSEL PA_15 - -#define PIN_SWD_TX PA_9 -#define PIN_SWD_RX PA_10 - -#define PIN_LOAD_EN PC_13 -#define PIN_USB_PWR_EN PB_10 -#define PIN_V_SOLAR_EN PC_14 -#define PIN_5V_PGOOD PC_15 - -#define PIN_EXT_BTN PB_12 -#define PIN_BOOT0_EN PB_12 - -#define PIN_REF_I_DCDC PA_4 - -// Internal NTC temperature currently ignored by firmware as it is similar to MCU temperature and -// does not reflect external battery temperature. Feature will be removed in future HW revisions. -#define PIN_TEMP_INT_PD PA_8 - -enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT }; - -// assignment LED numbers on PCB to their meaning -#define NUM_LEDS 5 - -#define LED_SOC_1 0 // LED1 -#define LED_SOC_2 1 // LED2 -#define LED_SOC_3 2 // LED3 -#define LED_LOAD 3 // LED4 -#define LED_RXTX 4 // LED5, used to indicate when sending data - -// LED pins and pin state configuration to switch above LEDs on -#define NUM_LED_PINS 3 - -// defined in board definition pinmux.c -extern const char *led_ports[NUM_LED_PINS]; -extern const int led_pins[NUM_LED_PINS]; - -static const enum pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { - { PIN_HIGH, PIN_LOW, PIN_FLOAT }, // LED1 - { PIN_LOW, PIN_HIGH, PIN_FLOAT }, // LED2 - { PIN_HIGH, PIN_FLOAT, PIN_LOW }, // LED3 - { PIN_FLOAT, PIN_HIGH, PIN_LOW }, // LED4 - { PIN_FLOAT, PIN_LOW, PIN_HIGH } // LED5 -}; - -// pin definition only needed in adc_dma.cpp to detect if they are present on the PCB -#define PIN_ADC_TEMP_BAT - -// typical value for Semitec 103AT-5 thermistor: 3435 -#define NTC_BETA_VALUE 3435 -#define NTC_SERIES_RESISTOR 10000.0 - -#define ADC_GAIN_V_LOW (105.6 / 5.6) // both voltage dividers: 100k + 5.6k -#define ADC_GAIN_V_HIGH (105.6 / 5.6) -#define ADC_GAIN_I_LOAD (1000.0 / 3.0 / 50.0) // amp gain: 50, resistor: 3 mOhm -#define ADC_GAIN_I_DCDC (1000.0 / 3.0 / 50.0) - -// position in the array written by the DMA controller -enum { - ADC_POS_V_LOW, // ADC 0 (PA_0) - ADC_POS_V_HIGH, // ADC 1 (PA_1) - ADC_POS_I_LOAD, // ADC 5 (PA_5) - ADC_POS_I_DCDC, // ADC 6 (PA_6) - ADC_POS_TEMP_BAT, // ADC 7 (PA_7) - ADC_POS_VREF_MCU, // ADC 17 - ADC_POS_TEMP_MCU, // ADC 18 - NUM_ADC_CH // trick to get the number of elements -}; - -#define NUM_ADC_1_CH NUM_ADC_CH - -// selected ADC channels (has to match with above enum) -#define ADC_CHSEL ( \ - ADC_CHSELR_CHSEL0 | \ - ADC_CHSELR_CHSEL1 | \ - ADC_CHSELR_CHSEL5 | \ - ADC_CHSELR_CHSEL6 | \ - ADC_CHSELR_CHSEL7 | \ - ADC_CHSELR_CHSEL17 | \ - ADC_CHSELR_CHSEL18 \ -) - -#endif diff --git a/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.yaml b/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.yaml deleted file mode 100755 index 0cd3e63..0000000 --- a/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7.yaml +++ /dev/null @@ -1,18 +0,0 @@ -identifier: mppt_1210_hus_0v7 -name: MPPT-1210-HUS-0V7 -type: mcu -arch: arm -toolchain: - - zephyr - - gnuarmemb - - xtools -ram: 20 -flash: 192 -supported: - - arduino_i2c - - gpio - - i2c - - spi - - watchdog - - adc - - eeprom diff --git a/boards/arm/mppt_1210_hus_0v7/pinmux.c b/boards/arm/mppt_1210_hus_0v7/pinmux.c deleted file mode 100755 index 41f6a4d..0000000 --- a/boards/arm/mppt_1210_hus_0v7/pinmux.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2019 Martin Jäger / Libre Solar - */ - -#include -#include -#include -#include -#include - -#include - -// preliminary fix until PR for pinmux_stm32l0.h got accepted and merged to Zephyr master branch, -// see also here: https://github.com/zephyrproject-rtos/zephyr/pull/20997 -#ifndef STM32L0_PINMUX_FUNC_PB6_I2C1_SCL -#define STM32L0_PINMUX_FUNC_PB6_I2C1_SCL \ - (STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP) -#endif -#ifndef STM32L0_PINMUX_FUNC_PB7_I2C1_SDA -#define STM32L0_PINMUX_FUNC_PB7_I2C1_SDA \ - (STM32_PINMUX_ALT_FUNC_1 | STM32_OPENDRAIN_PULLUP) -#endif - -/* pin assignments for NUCLEO-L073RZ board */ -static const struct pin_config pinconf[] = { -#ifdef CONFIG_UART_1 - {STM32_PIN_PA9, STM32L0_PINMUX_FUNC_PA9_USART1_TX}, - {STM32_PIN_PA10, STM32L0_PINMUX_FUNC_PA10_USART1_RX}, -#endif /* CONFIG_UART_1 */ -#ifdef CONFIG_UART_2 - {STM32_PIN_PA2, STM32L0_PINMUX_FUNC_PA2_USART2_TX}, - {STM32_PIN_PA3, STM32L0_PINMUX_FUNC_PA3_USART2_RX}, -#endif /* CONFIG_UART_2 */ -#ifdef CONFIG_I2C_1 - {STM32_PIN_PB6, STM32L0_PINMUX_FUNC_PB6_I2C1_SCL}, - {STM32_PIN_PB7, STM32L0_PINMUX_FUNC_PB7_I2C1_SDA}, -#endif /* CONFIG_I2C_1 */ -#ifdef CONFIG_SPI_1 - {STM32_PIN_PA5, STM32L0_PINMUX_FUNC_PA5_SPI1_SCK}, - {STM32_PIN_PA6, STM32L0_PINMUX_FUNC_PA6_SPI1_MISO}, - {STM32_PIN_PA7, STM32L0_PINMUX_FUNC_PA7_SPI1_MOSI}, -#endif /* CONFIG_SPI_1 */ -#ifdef CONFIG_ADC_1 - {STM32_PIN_PA0, STM32L0_PINMUX_FUNC_PA0_ADC_IN0}, -#endif /* CONFIG_ADC_1 */ -#ifdef CONFIG_DAC_1 - {STM32_PIN_PA4, STM32L0_PINMUX_FUNC_PA4_DAC_OUT1}, -#endif /* CONFIG_ADC_1 */ -}; - -static int pinmux_stm32_init(struct device *port) -{ - ARG_UNUSED(port); - - stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf)); - - return 0; -} - -SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, - CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); - -const char *led_ports[] = { - DT_GPIO_LEDS_A_GPIOS_CONTROLLER, - DT_GPIO_LEDS_C_GPIOS_CONTROLLER, - DT_GPIO_LEDS_B_GPIOS_CONTROLLER, -}; -const int led_pins[] = { - DT_GPIO_LEDS_A_GPIOS_PIN, - DT_GPIO_LEDS_C_GPIOS_PIN, - DT_GPIO_LEDS_B_GPIOS_PIN, -}; diff --git a/boards/arm/mppt_1210_hus_0v7/support/openocd.cfg b/boards/arm/mppt_1210_hus_0v7/support/openocd.cfg deleted file mode 100755 index b2f37ca..0000000 --- a/boards/arm/mppt_1210_hus_0v7/support/openocd.cfg +++ /dev/null @@ -1,27 +0,0 @@ -# STM32L072 MCU - -source [find interface/stlink.cfg] - -transport select hla_swd - -set WORKAREASIZE 0x2000 - -source [find target/stm32l0.cfg] - -# Add the second flash bank. -set _FLASHNAME $_CHIPNAME.flash1 -flash bank $_FLASHNAME stm32lx 0 0 0 0 $_TARGETNAME - -# There is only system reset line and JTAG/SWD command can be issued when SRST -reset_config srst_only - -$_TARGETNAME configure -event gdb-attach { - echo "Debugger attaching: halting execution" - reset halt - gdb_breakpoint_override hard -} - -$_TARGETNAME configure -event gdb-detach { - echo "Debugger detaching: resuming execution" - resume -} diff --git a/boards/arm/mppt_2420_hpx/board.h b/boards/arm/mppt_2420_hpx/board.h index c48a987..59a6013 100644 --- a/boards/arm/mppt_2420_hpx/board.h +++ b/boards/arm/mppt_2420_hpx/board.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef MPPT_2420_HPX_0V1_H -#define MPPT_2420_HPX_0V1_H +#ifndef MPPT_2420_HPX_H +#define MPPT_2420_HPX_H #include diff --git a/boards/arm/mppt_2420_hpx/mppt_2420_hpx.dts b/boards/arm/mppt_2420_hpx/mppt_2420_hpx.dts index dec6e44..579cabb 100644 --- a/boards/arm/mppt_2420_hpx/mppt_2420_hpx.dts +++ b/boards/arm/mppt_2420_hpx/mppt_2420_hpx.dts @@ -8,7 +8,7 @@ #include / { - model = "Libre Solar MPPT 2420 HPX v0.1"; + model = "Libre Solar MPPT 2420 HPX"; compatible = "st,stm32g431"; soc { diff --git a/boards/arm/mppt_1210_hus_0v7/CMakeLists.txt b/boards/arm/mppt_2420_lc/CMakeLists.txt similarity index 100% rename from boards/arm/mppt_1210_hus_0v7/CMakeLists.txt rename to boards/arm/mppt_2420_lc/CMakeLists.txt diff --git a/boards/arm/mppt_2420_lc_0v10/Kconfig b/boards/arm/mppt_2420_lc/Kconfig similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/Kconfig rename to boards/arm/mppt_2420_lc/Kconfig diff --git a/boards/arm/mppt_2420_lc_0v10/Kconfig.board b/boards/arm/mppt_2420_lc/Kconfig.board similarity index 62% rename from boards/arm/mppt_2420_lc_0v10/Kconfig.board rename to boards/arm/mppt_2420_lc/Kconfig.board index 98e59f9..942c145 100755 --- a/boards/arm/mppt_2420_lc_0v10/Kconfig.board +++ b/boards/arm/mppt_2420_lc/Kconfig.board @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2020 Martin Jäger / Libre Solar -config BOARD_MPPT_2420_LC_0V10 - bool "Libre Solar MPPT 2420 LC v0.10" +config BOARD_MPPT_2420_LC + bool "Libre Solar MPPT 2420 LC" depends on SOC_STM32F072XB diff --git a/boards/arm/mppt_2420_lc_0v10/Kconfig.defconfig b/boards/arm/mppt_2420_lc/Kconfig.defconfig similarity index 86% rename from boards/arm/mppt_2420_lc_0v10/Kconfig.defconfig rename to boards/arm/mppt_2420_lc/Kconfig.defconfig index 7adc474..5b08613 100755 --- a/boards/arm/mppt_2420_lc_0v10/Kconfig.defconfig +++ b/boards/arm/mppt_2420_lc/Kconfig.defconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -if BOARD_MPPT_2420_LC_0V10 +if BOARD_MPPT_2420_LC config BOARD - default "mppt_2420_lc_0v10" + default "mppt_2420_lc" config HAS_LOAD_OUTPUT default y diff --git a/boards/arm/mppt_2420_lc_0v10/board.cmake b/boards/arm/mppt_2420_lc/board.cmake similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/board.cmake rename to boards/arm/mppt_2420_lc/board.cmake diff --git a/boards/arm/mppt_2420_lc_0v10/board.h b/boards/arm/mppt_2420_lc/board.h similarity index 98% rename from boards/arm/mppt_2420_lc_0v10/board.h rename to boards/arm/mppt_2420_lc/board.h index 18db9f3..22cbd5e 100644 --- a/boards/arm/mppt_2420_lc_0v10/board.h +++ b/boards/arm/mppt_2420_lc/board.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef MPPT_2420_LC_0V10_H -#define MPPT_2420_LC_0V10_H +#ifndef MPPT_2420_LC_H +#define MPPT_2420_LC_H #define LOAD_CURRENT_MAX 20 // PCB maximum load switch current diff --git a/boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.dts b/boards/arm/mppt_2420_lc/mppt_2420_lc.dts similarity index 97% rename from boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.dts rename to boards/arm/mppt_2420_lc/mppt_2420_lc.dts index 96f550c..57fcec0 100755 --- a/boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.dts +++ b/boards/arm/mppt_2420_lc/mppt_2420_lc.dts @@ -8,7 +8,7 @@ #include / { - model = "Libre Solar MPPT 2420 LC v0.10"; + model = "Libre Solar MPPT 2420 LC"; compatible = "st,stm32f072"; pcb { diff --git a/boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.yaml b/boards/arm/mppt_2420_lc/mppt_2420_lc.yaml similarity index 74% rename from boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.yaml rename to boards/arm/mppt_2420_lc/mppt_2420_lc.yaml index d1aca38..b4ed3e0 100755 --- a/boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10.yaml +++ b/boards/arm/mppt_2420_lc/mppt_2420_lc.yaml @@ -1,5 +1,5 @@ -identifier: mppt_2420_LC_0v10 -name: MPPT-2420-LC-0V10 +identifier: mppt_2420_lc +name: MPPT-2420-LC type: mcu arch: arm toolchain: diff --git a/boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10_defconfig b/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/mppt_2420_lc_0v10_defconfig rename to boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig diff --git a/boards/arm/mppt_2420_lc_0v10/pinmux.c b/boards/arm/mppt_2420_lc/pinmux.c similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/pinmux.c rename to boards/arm/mppt_2420_lc/pinmux.c diff --git a/boards/arm/mppt_2420_lc_0v10/support/openocd.cfg b/boards/arm/mppt_2420_lc/support/openocd.cfg similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/support/openocd.cfg rename to boards/arm/mppt_2420_lc/support/openocd.cfg diff --git a/boards/arm/mppt_2420_lc_0v10/CMakeLists.txt b/boards/arm/pwm_2420_lus/CMakeLists.txt old mode 100755 new mode 100644 similarity index 100% rename from boards/arm/mppt_2420_lc_0v10/CMakeLists.txt rename to boards/arm/pwm_2420_lus/CMakeLists.txt diff --git a/boards/arm/mppt_1210_hus_0v7/Kconfig b/boards/arm/pwm_2420_lus/Kconfig similarity index 100% rename from boards/arm/mppt_1210_hus_0v7/Kconfig rename to boards/arm/pwm_2420_lus/Kconfig diff --git a/boards/arm/mppt_1210_hus_0v4/Kconfig.board b/boards/arm/pwm_2420_lus/Kconfig.board old mode 100755 new mode 100644 similarity index 62% rename from boards/arm/mppt_1210_hus_0v4/Kconfig.board rename to boards/arm/pwm_2420_lus/Kconfig.board index cde21e2..8d97758 --- a/boards/arm/mppt_1210_hus_0v4/Kconfig.board +++ b/boards/arm/pwm_2420_lus/Kconfig.board @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -config BOARD_MPPT_1210_HUS_0V4 - bool "Libre Solar MPPT 1210 HUS v0.4" +config BOARD_PWM_2420_LUS + bool "Libre Solar PWM 2420 LUS" depends on SOC_STM32L073XX diff --git a/boards/arm/pwm_2420_lus_0v3/Kconfig.defconfig b/boards/arm/pwm_2420_lus/Kconfig.defconfig similarity index 81% rename from boards/arm/pwm_2420_lus_0v3/Kconfig.defconfig rename to boards/arm/pwm_2420_lus/Kconfig.defconfig index 50a99f7..1c1c861 100644 --- a/boards/arm/pwm_2420_lus_0v3/Kconfig.defconfig +++ b/boards/arm/pwm_2420_lus/Kconfig.defconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -if BOARD_PWM_2420_LUS_0V3 +if BOARD_PWM_2420_LUS config BOARD - default "pwm_2420_lus_0v3" + default "pwm_2420_lus" config HAS_LOAD_OUTPUT default y @@ -36,4 +36,4 @@ config SPI_STM32_INTERRUPT endif # SPI -endif # BOARD_PWM_2420_LUS_0V3 +endif # BOARD_PWM_2420_LUS diff --git a/boards/arm/mppt_1210_hus_0v7/board.cmake b/boards/arm/pwm_2420_lus/board.cmake old mode 100755 new mode 100644 similarity index 100% rename from boards/arm/mppt_1210_hus_0v7/board.cmake rename to boards/arm/pwm_2420_lus/board.cmake diff --git a/boards/arm/pwm_2420_lus_0v3/board.h b/boards/arm/pwm_2420_lus/board.h similarity index 100% rename from boards/arm/pwm_2420_lus_0v3/board.h rename to boards/arm/pwm_2420_lus/board.h diff --git a/boards/arm/pwm_2420_lus_0v3/pinmux.c b/boards/arm/pwm_2420_lus/pinmux.c similarity index 100% rename from boards/arm/pwm_2420_lus_0v3/pinmux.c rename to boards/arm/pwm_2420_lus/pinmux.c diff --git a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.dts b/boards/arm/pwm_2420_lus/pwm_2420_lus.dts similarity index 97% rename from boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.dts rename to boards/arm/pwm_2420_lus/pwm_2420_lus.dts index eb0bddb..fda8f40 100644 --- a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3.dts +++ b/boards/arm/pwm_2420_lus/pwm_2420_lus.dts @@ -8,7 +8,7 @@ #include / { - model = "Libre Solar PWM 2420 LUS v0.3"; + model = "Libre Solar PWM 2420 LUS"; compatible = "st,stm32l073"; pcb { diff --git a/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml b/boards/arm/pwm_2420_lus/pwm_2420_lus.yaml old mode 100755 new mode 100644 similarity index 75% rename from boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml rename to boards/arm/pwm_2420_lus/pwm_2420_lus.yaml index 1d4c5e7..23e38af --- a/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml +++ b/boards/arm/pwm_2420_lus/pwm_2420_lus.yaml @@ -1,5 +1,5 @@ -identifier: mppt_1210_hus_0v4 -name: MPPT-1210-HUS-0V4 +identifier: pwm_2420_lus +name: PWM-2420-LUS type: mcu arch: arm toolchain: diff --git a/boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7_defconfig b/boards/arm/pwm_2420_lus/pwm_2420_lus_defconfig old mode 100755 new mode 100644 similarity index 100% rename from boards/arm/mppt_1210_hus_0v7/mppt_1210_hus_0v7_defconfig rename to boards/arm/pwm_2420_lus/pwm_2420_lus_defconfig diff --git a/boards/arm/pwm_2420_lus_0v3/support/openocd.cfg b/boards/arm/pwm_2420_lus/support/openocd.cfg similarity index 100% rename from boards/arm/pwm_2420_lus_0v3/support/openocd.cfg rename to boards/arm/pwm_2420_lus/support/openocd.cfg diff --git a/boards/arm/pwm_2420_lus_0v3/CMakeLists.txt b/boards/arm/pwm_2420_lus_0v3/CMakeLists.txt deleted file mode 100644 index ac5a362..0000000 --- a/boards/arm/pwm_2420_lus_0v3/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_PINMUX) -zephyr_library() -zephyr_library_sources(pinmux.c) -zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) -endif() - -zephyr_include_directories(.) diff --git a/boards/arm/pwm_2420_lus_0v3/Kconfig b/boards/arm/pwm_2420_lus_0v3/Kconfig deleted file mode 100644 index abfb339..0000000 --- a/boards/arm/pwm_2420_lus_0v3/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/boards/arm/pwm_2420_lus_0v3/board.cmake b/boards/arm/pwm_2420_lus_0v3/board.cmake deleted file mode 100644 index 6f20255..0000000 --- a/boards/arm/pwm_2420_lus_0v3/board.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -board_runner_args(jlink "--device=STM32L073RZ" "--speed=4000") - -include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) -include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3_defconfig b/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3_defconfig deleted file mode 100644 index 039e685..0000000 --- a/boards/arm/pwm_2420_lus_0v3/pwm_2420_lus_0v3_defconfig +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_STM32L0X=y -CONFIG_SOC_STM32L073XX=y - -# General Kernel Options -CONFIG_CORTEX_M_SYSTICK=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 - -# Serial Drivers -CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -# Pinmux Driver -CONFIG_PINMUX=y - -# GPIO Controller -CONFIG_GPIO=y - -# Clock configuration -CONFIG_CLOCK_CONTROL=y -# SYSCLK selection -CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y - -# PLL configuration -CONFIG_CLOCK_STM32_PLL_SRC_HSI=y -CONFIG_CLOCK_STM32_PLL_MULTIPLIER=4 -CONFIG_CLOCK_STM32_PLL_DIVISOR=2 -CONFIG_CLOCK_STM32_AHB_PRESCALER=1 -CONFIG_CLOCK_STM32_APB1_PRESCALER=1 - -CONFIG_EEPROM=y -CONFIG_EEPROM_STM32=y diff --git a/boards/mppt_1210_hus_0v4.json b/boards/mppt_1210_hus.json similarity index 94% rename from boards/mppt_1210_hus_0v4.json rename to boards/mppt_1210_hus.json index edbe160..ae5817f 100644 --- a/boards/mppt_1210_hus_0v4.json +++ b/boards/mppt_1210_hus.json @@ -26,7 +26,7 @@ "stm32cube", "zephyr" ], - "name": "Libre Solar MPPT 1210 HUS v0.4", + "name": "Libre Solar MPPT 1210 HUS", "upload": { "maximum_ram_size": 20480, "maximum_size": 196608, diff --git a/boards/mppt_1210_hus_0v7.json b/boards/mppt_1210_hus_0v7.json deleted file mode 100644 index 535106a..0000000 --- a/boards/mppt_1210_hus_0v7.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "build": { - "cpu": "cortex-m0plus", - "extra_flags": "-DSTM32L073xx", - "f_cpu": "32000000L", - "framework_extra_flags": { - "arduino": "-D__CORTEX_SC=0" - }, - "mcu": "stm32l073rz", - "variant": "MPPT-1210-HUS" - }, - "debug": { - "default_tools": [ - "stlink" - ], - "jlink_device": "STM32L073RZ", - "onboard_tools": [ - "stlink" - ], - "openocd_board": "st_nucleo_l073rz", - "svd_path": "STM32L07x.svd" - }, - "frameworks": [ - "arduino", - "mbed", - "stm32cube", - "zephyr" - ], - "name": "Libre Solar MPPT 1210 HUS v0.7", - "upload": { - "maximum_ram_size": 20480, - "maximum_size": 196608, - "protocol": "stlink", - "protocols": [ - "jlink", - "stlink", - "blackmagic", - "mbed" - ] - }, - "url": "http://libre.solar/", - "vendor": "Libre Solar" -} diff --git a/boards/mppt_2420_hpx.json b/boards/mppt_2420_hpx.json index 7536850..f3a9d32 100644 --- a/boards/mppt_2420_hpx.json +++ b/boards/mppt_2420_hpx.json @@ -25,7 +25,7 @@ "stm32cube", "zephyr" ], - "name": "Libre Solar MPPT 2420 HPX v0.1", + "name": "Libre Solar MPPT 2420 HPX", "upload": { "maximum_ram_size": 32768, "maximum_size": 131072, diff --git a/boards/mppt_2420_lc_0v10.json b/boards/mppt_2420_lc.json similarity index 94% rename from boards/mppt_2420_lc_0v10.json rename to boards/mppt_2420_lc.json index a4c4fa0..a36a753 100644 --- a/boards/mppt_2420_lc_0v10.json +++ b/boards/mppt_2420_lc.json @@ -24,7 +24,7 @@ "stm32cube", "zephyr" ], - "name": "Libre Solar MPPT 2420 LC v0.10", + "name": "Libre Solar MPPT 2420 LC", "upload": { "maximum_ram_size": 16384, "maximum_size": 131072, diff --git a/boards/pwm_2420_lus_0v3.json b/boards/pwm_2420_lus.json similarity index 100% rename from boards/pwm_2420_lus_0v3.json rename to boards/pwm_2420_lus.json diff --git a/check.bat b/check.bat index 6b2535b..70780ba 100644 --- a/check.bat +++ b/check.bat @@ -11,21 +11,21 @@ if errorlevel 1 ( ) echo "---------- Running compile check -------------" -platformio run -e mppt-2420-lc-v0.10 -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 -e pwm-2420-lus-v0.3-zephyr +platformio run -e mppt_2420_lc -e mppt_1210_hus -e mppt_2420_hpx -e pwm_2420_lus if errorlevel 1 ( echo Failure Reason is %errorlevel% exit /b %errorlevel% ) echo "---------- Running unit-tests -------------" -platformio test -e unit-test-native +platformio test -e unit_test if errorlevel 1 ( echo Failure Reason is %errorlevel% exit /b %errorlevel% ) echo "---------- Running static code checks -------------" -platformio check -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 +platformio check -e mppt_1210_hus -e pwm_2420_lus if errorlevel 1 ( echo Failure Reason is %errorlevel% exit /b %errorlevel% diff --git a/check.sh b/check.sh index ea370d3..953e5fa 100755 --- a/check.sh +++ b/check.sh @@ -11,19 +11,19 @@ if [ $? != 0 ]; then fi echo "---------- Running compile check -------------" -platformio run -e mppt-2420-lc-v0.10 -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 +platformio run -e mppt_2420_lc -e mppt_1210_hus -e mppt_2420_hpx -e pwm_2420_lus if [ $? != 0 ]; then exit 1; fi echo "---------- Running unit-tests -------------" -platformio test -e unit-test-native +platformio test -e unit_test if [ $? != 0 ]; then exit 1; fi echo "---------- Running static code checks -------------" -platformio check -e mppt-1210-hus-v0.7 -e pwm-2420-lus-v0.3 +platformio check -e mppt_1210_hus -e pwm_2420_lus if [ $? != 0 ]; then exit 1; fi diff --git a/platformio.ini b/platformio.ini index 2737a5e..e5ea6bb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,12 +9,10 @@ # Select the charge controller hardware by uncommenting one of the following lines default_envs = -# mppt-2420-lc-v0.10 -# mppt-2420-hpx-v0.1 -# mppt-1210-hus-v0.4 -# mppt-1210-hus-v0.7 -# pwm-2420-lus-v0.3 -# unit-test-native +# mppt_2420_lc +# mppt_2420_hpx +# mppt_1210_hus +# pwm_2420_lus # Or create your own custom.ini file to overwrite settings in this file, e.g. for board selection. # For further information see here: @@ -60,31 +58,29 @@ check_flags = #### BOARD DEFINITIONS ######################################################## # https://github.com/LibreSolar/MPPT-2420-LC/tree/5bc39183c8 -[env:mppt-2420-lc-v0.10] -board = mppt_2420_lc_0v10 - -# https://github.com/LibreSolar/MPPT-1210-HUS/tree/63e5842671 -[env:mppt-1210-hus-v0.4] -board = mppt_1210_hus_0v4 +[env:mppt_2420_lc] +board = mppt_2420_lc # https://github.com/LibreSolar/MPPT-1210-HUS -[env:mppt-1210-hus-v0.7] -board = mppt_1210_hus_0v7 +[env:mppt_1210_hus] +board = mppt_1210_hus -[env:mppt-2420-hpx-v0.1] +# https://github.com/LibreSolar/mppt-2420-hpx +[env:mppt_2420_hpx] board = mppt_2420_hpx # https://github.com/LibreSolar/PWM-2420-LUS -[env:pwm-2420-lus-v0.3] -board = pwm_2420_lus_0v3 +[env:pwm_2420_lus] +board = pwm_2420_lus -[env:pwm-2420-lus-v0.3-bl] -board = pwm_2420_lus_0v3 +# The changed linker setting should also be handled by DTS overlays in the future +[env:pwm_2420_lus_bl] +board = pwm_2420_lus build_flags = ${env.build_flags} -D BOOTLOADER_ENABLED -Wl,-T'"$PROJECT_DIR/boards/STM32L073XZ.ld.link_script.ld"',-v -[env:unit-test-native] +[env:unit_test] platform = native framework = build_flags = diff --git a/zephyr/.gitignore b/zephyr/.gitignore new file mode 100644 index 0000000..15dfe17 --- /dev/null +++ b/zephyr/.gitignore @@ -0,0 +1,9 @@ + +# custom DTS overlays +*.overlay + +# custom project configuration per board +prj_*.conf + +# alternative location for custom DTS overlays or conf files +boards* diff --git a/zephyr/mppt_1210_hus.overlay_0v4 b/zephyr/mppt_1210_hus.overlay_0v4 new file mode 100644 index 0000000..16c3ecd --- /dev/null +++ b/zephyr/mppt_1210_hus.overlay_0v4 @@ -0,0 +1,54 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2020 Martin Jäger / Libre Solar + */ + +/ { + pcb { + version-str = "v0.4"; + version-num = <4>; + }; + + leds { + compatible = "gpio-leds"; + gnd { + gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>; + label = "LED GND"; + }; + soc12 { + gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>; + label = "LED SOC12"; + }; + soc3 { + gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>; + label = "LED SOC3"; + }; + rxtx { + gpios = <&gpiob 11 GPIO_ACTIVE_HIGH>; + label = "LED RXTX"; + }; + load { + gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; + label = "LED Load"; + }; + /delete-node/ a; + /delete-node/ b; + /delete-node/ c; + }; + + switches { + compatible = "switch"; + load { + gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>; + label = "Load enable"; + }; + usb-pwr { + gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>; + label = "USB charging port enable"; + }; + /delete-node/ v-solar; + /delete-node/ boot0; + }; + +}; diff --git a/zephyr/pwm_2420_lus_0v2.overlay b/zephyr/pwm_2420_lus.overlay_0v2 similarity index 100% rename from zephyr/pwm_2420_lus_0v2.overlay rename to zephyr/pwm_2420_lus.overlay_0v2