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.
This commit is contained in:
Martin Jäger
2020-05-06 12:53:26 +02:00
parent affaa9d8e8
commit 5523f93544
58 changed files with 177 additions and 542 deletions
+3 -3
View File
@@ -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:
@@ -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
@@ -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
@@ -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 | \
@@ -8,7 +8,7 @@
#include <st/l0/stm32l073Xz.dtsi>
/ {
model = "Libre Solar MPPT 1210 HUS v0.7";
model = "Libre Solar MPPT 1210 HUS";
compatible = "st,stm32l073";
pcb {
@@ -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:
@@ -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
@@ -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
@@ -1,112 +0,0 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2019 Martin Jäger / Libre Solar
*/
/dts-v1/;
#include <st/l0/stm32l073Xz.dtsi>
/ {
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 = <I2C_BITRATE_FAST>;
};
&spi1 {
status = "okay";
};
&iwdg {
status = "okay";
};
&adc1 {
status = "okay";
};
&eeprom {
status = "okay";
};
@@ -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
-101
View File
@@ -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
@@ -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
-74
View File
@@ -1,74 +0,0 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2019 Martin Jäger / Libre Solar
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <drivers/pinmux.h>
#include <sys/sys_io.h>
#include <pinmux/stm32/pinmux_stm32.h>
// 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,
};
@@ -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
}
+2 -2
View File
@@ -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 <zephyr.h>
+1 -1
View File
@@ -8,7 +8,7 @@
#include <st/g4/stm32g431Xb.dtsi>
/ {
model = "Libre Solar MPPT 2420 HPX v0.1";
model = "Libre Solar MPPT 2420 HPX";
compatible = "st,stm32g431";
soc {
@@ -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
@@ -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
@@ -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
@@ -8,7 +8,7 @@
#include <st/f0/stm32f072Xb.dtsi>
/ {
model = "Libre Solar MPPT 2420 LC v0.10";
model = "Libre Solar MPPT 2420 LC";
compatible = "st,stm32f072";
pcb {
@@ -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:
@@ -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
@@ -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
@@ -8,7 +8,7 @@
#include <st/l0/stm32l073Xz.dtsi>
/ {
model = "Libre Solar PWM 2420 LUS v0.3";
model = "Libre Solar PWM 2420 LUS";
compatible = "st,stm32l073";
pcb {
@@ -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:
@@ -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(.)
-5
View File
@@ -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"
-6
View File
@@ -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)
@@ -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
@@ -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,
-43
View File
@@ -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"
}
+1 -1
View File
@@ -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,
@@ -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,
+3 -3
View File
@@ -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%
+3 -3
View File
@@ -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
+16 -20
View File
@@ -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 =
+9
View File
@@ -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*
+54
View File
@@ -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;
};
};