Add MPPT 2420 HC v0.2 board

This commit is contained in:
Martin Jäger
2021-03-12 18:40:21 +01:00
parent 2bbba0ba13
commit c87e5f974a
10 changed files with 185 additions and 55 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ The software is configurable to support different charge controller PCBs with ST
| Board | Default revision | Older revisions |
|-----------------------------------------------------|------------------|-----------------|
| [Libre Solar MPPT 2420 HC](https://github.com/LibreSolar/mppt-2420-hc) | 0.1 | |
| [Libre Solar MPPT 2420 HC](https://github.com/LibreSolar/mppt-2420-hc) | 0.2 | 0.1 |
| [Libre Solar MPPT 2420 LC](https://github.com/LibreSolar/mppt-2420-lc) | 0.10 | |
| [Libre Solar MPPT 1210 HUS](https://github.com/LibreSolar/mppt-1210-hus) | 0.7 | 0.4 |
| [Libre Solar PWM 2420 LUS](https://github.com/LibreSolar/pwm-2420-lus) | 0.3 | 0.2 |
+12 -49
View File
@@ -16,8 +16,6 @@
compatible = "charge-controller";
type = "MPPT 2420 HC";
version-str = "v0.1";
version-num = <1>;
hs-voltage-max = <80>;
ls-voltage-max = <32>;
@@ -31,23 +29,20 @@
zephyr,flash = &flash0;
};
/* temporary solution w/o using RGB LED */
/* temporary solution only using green color LED */
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>, /* red */
<&gpiob 15 GPIO_ACTIVE_LOW>, /* green */
<&gpiob 9 GPIO_ACTIVE_LOW>; /* blue */
gpios = <&gpioa 6 GPIO_ACTIVE_LOW>, /* chg red */
<&gpioc 14 GPIO_ACTIVE_LOW>, /* chg green */
<&gpiob 9 GPIO_ACTIVE_LOW>, /* dis red */
<&gpioc 15 GPIO_ACTIVE_LOW>; /* dis green */
pwr {
states = <1 0 0>;
states = <0 1 0 0>;
};
load {
states = <0 1 0>;
};
rxtx {
states = <0 0 1>;
states = <0 0 0 1>;
};
};
@@ -142,6 +137,7 @@
&i2c1 {
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
clock-frequency = <I2C_BITRATE_STANDARD>;
status = "okay";
};
@@ -151,26 +147,12 @@
status = "okay";
};
&usb {
&spi2 {
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
cs-gpios = <&gpioa 5 GPIO_ACTIVE_LOW>;
status = "okay";
};
&rtc {
status = "okay";
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
};
};
&iwdg {
status = "okay";
};
@@ -180,7 +162,7 @@
halfbridge {
compatible = "half-bridge";
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pc13>;
frequency = <70000>;
deadtime = <300>;
};
@@ -196,25 +178,6 @@
};
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
eeprom@50 {
// Microchip 24AA32A
compatible = "atmel,at24";
reg = <0x50>;
label = "EEPROM_0";
size = <32768>;
pagesize = <32>;
address-width = <16>;
/*
* timeout of 5 ms as suggested in datasheet seems too optimistic
* (several write errors occured during testing)
*/
timeout = <7>;
};
};
&can1 {
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
bus-speed = <250000>;
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_I2C=y
CONFIG_EEPROM=y
CONFIG_EEPROM_AT24=y
@@ -0,0 +1,68 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2021 Martin Jäger / Libre Solar
*/
/ {
pcb {
version-str = "v0.1";
version-num = <1>;
};
/* temporary solution w/o using RGB LED */
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>, /* red */
<&gpiob 15 GPIO_ACTIVE_LOW>, /* green */
<&gpiob 9 GPIO_ACTIVE_LOW>; /* blue */
pwr {
states = <1 0 0>;
};
load {
states = <0 1 0>;
};
rxtx {
states = <0 0 1>;
};
};
};
&i2c1 {
eeprom@50 {
// Microchip 24AA32A
compatible = "atmel,at24";
reg = <0x50>;
label = "EEPROM_0";
size = <32768>;
pagesize = <32>;
address-width = <16>;
/*
* timeout of 5 ms as suggested in datasheet seems too optimistic
* (several write errors occured during testing)
*/
timeout = <7>;
};
};
&spi1 {
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
cs-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
status = "okay";
};
&timers1 {
halfbridge {
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
};
};
&spi2 {
status = "disabled";
/delete-node/ pinctrl-0;
/delete-node/ cs-gpios;
};
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_LOG_LEVEL_WRN=y
#CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_RUNTIME=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NVS=y
CONFIG_NVS_LOG_LEVEL_WRN=y
@@ -0,0 +1,81 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2021 Martin Jäger / Libre Solar
*/
/ {
pcb {
version-str = "v0.2";
version-num = <2>;
};
chosen {
zephyr,code-partition = &slot0_partition;
};
};
&spi2 {
w25q80dv: w25q80dv@0 {
compatible = "jedec,spi-nor";
label = "W25Q80DV";
reg = <0>;
spi-max-frequency = <4000000>;
size = <0x800000>; /* bits */
has-dpd;
t-enter-dpd = <4000>;
t-exit-dpd = <25000>;
jedec-id = [ef 40 14];
};
};
/*
* Below partition layout allows to use MCUboot if CONFIG_BOOTLOADER_MCUBOOT is enabled. Otherwise,
* the code will just use the entire available flash of the MCU.
*/
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* bootloader slot: 32 KiB */
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x8000>;
read-only;
};
/* application image slot: 96 KiB */
slot0_partition: partition@8000 {
label = "image-0";
reg = <0x00008000 0x18000>;
};
};
};
&w25q80dv {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* backup slot: 96 KiB */
slot1_partition: partition@0 {
label = "image-1";
reg = <0x00000000 0x18000>;
};
/* swap slot: 96 KiB */
scratch_partition: partition@18000 {
label = "image-scratch";
reg = <0x00018000 0x00018000>;
};
/* remaining 832 KiB of SPI flash used as storage */
storage_partition: partition@30000 {
label = "storage";
reg = <0x00030000 0x000D0000>;
};
};
};
@@ -58,10 +58,6 @@ CONFIG_ARM_MPU=y
CONFIG_PWM=y
CONFIG_I2C=y
CONFIG_EEPROM=y
CONFIG_EEPROM_AT24=y
CONFIG_CAN=y
CONFIG_THINGSET_CAN=y
+3
View File
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
board_check_revision(FORMAT MAJOR.MINOR.PATCH)
+1 -1
View File
@@ -71,7 +71,7 @@ board = mppt_2420_rc
# https://github.com/LibreSolar/mppt-2420-hc
[env:mppt_2420_hc]
board = mppt_2420_hc
board = mppt_2420_hc@0.2
# https://github.com/LibreSolar/mppt-1210-hus
[env:mppt_1210_hus]