Files
charge-controller-firmware/boards/libresolar/mppt_2420_lc/mppt_2420_lc.dts
T
Martin Jäger 167fc5d3ac Upgrade to Zephyr v4.3 and migrate boards
Also use new Zephyr CI environment and compile all boards.

Board migration script example:

python ../zephyr/scripts/utils/board_v1_to_v2.py --board-root . \
  -v libresolar -g libresolar -b pwm_2420_lus -s stm32l072xx
2026-03-08 06:25:56 +01:00

240 lines
4.1 KiB
Devicetree

/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/f0/stm32f072Xb.dtsi>
#include <st/f0/stm32f072c(8-b)tx-pinctrl.dtsi>
/ {
model = "Libre Solar MPPT 2420 LC";
compatible = "st,stm32f072";
pcb {
compatible = "charge-controller";
type = "MPPT 2420 LC";
version-str = "v0.10";
version-num = <10>;
hs-voltage-max = <55>;
ls-voltage-max = <32>;
dcdc-current-max = <20>;
};
chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>,
<&gpiob 15 GPIO_ACTIVE_HIGH>;
pwr {
states = <1 0>;
};
load {
states = <0 1>;
};
};
outputs {
compatible = "outputs";
load {
gpios = <&gpiob 2 GPIO_ACTIVE_LOW>;
current-max = <20>;
kconfig-flag; /* make node visible in Kconfig */
};
uext_en {
gpios = <&gpioc 14 GPIO_ACTIVE_LOW>;
};
can_en {
gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
};
aux_en {
gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>;
};
vbus_en {
gpios = <&gpioc 15 GPIO_ACTIVE_LOW>;
};
};
adc-inputs {
compatible = "adc-inputs";
temp-bat {
io-channels = <&adc1 0>;
multiplier = <10000>; // 10k NTC series resistor
divider = <1>;
};
temp-fets {
io-channels = <&adc1 1>;
multiplier = <10000>; // 10k NTC series resistor
divider = <1>;
};
vref {
io-channels = <&adc1 5>;
multiplier = <1>;
divider = <1>;
};
v-low {
io-channels = <&adc1 6>;
multiplier = <110000>;
divider = <10000>;
};
v-high {
io-channels = <&adc1 7>;
multiplier = <105600>;
divider = <5600>;
};
i-load {
io-channels = <&adc1 8>;
// amp gain: 150/2.2, resistor: 2 mOhm
multiplier = <2200>; // 1000*2.2
divider = <300>; // 2*150
};
i-dcdc {
io-channels = <&adc1 9>;
// amp gain: 150/2.2, resistor: 2 mOhm
multiplier = <2200>; // 1000*2.2
divider = <300>; // 2*150
};
temp-mcu {
io-channels = <&adc1 16>;
multiplier = <1>;
divider = <1>;
};
vref-mcu {
io-channels = <&adc1 17>;
multiplier = <1>;
divider = <1>;
};
};
aliases {
uart-dbg = &usart1;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
};
&clk_hse {
clock-frequency = <DT_FREQ_M(8)>;
status = "okay";
};
&pll {
clocks = <&clk_hse>;
prediv = <1>;
mul = <6>;
status = "okay";
};
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(48)>;
ahb-prescaler = <1>;
apb1-prescaler = <2>;
};
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};
&usart1_rx_pa10 {
bias-pull-up; // avoid junk characters if pin is left floating
};
&usart2 {
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
};
&usart2_rx_pa3 {
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
status = "okay";
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};
&i2c2 {
status = "okay";
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
eeprom: eeprom@50 {
// Microchip 24AA32A
compatible = "atmel,at24";
reg = <0x50>;
size = <32768>;
pagesize = <32>; // 24AA01: 8 bytes
address-width = <16>; // 24AA01: 8 bit
/*
* 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>;
pinctrl-names = "default";
cs-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
status = "okay";
};
&iwdg {
status = "okay";
};
&timers1 {
status = "okay";
halfbridge: halfbridge {
compatible = "half-bridge";
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
pinctrl-names = "default";
frequency = <70000>;
deadtime = <300>;
};
};
&can1 {
pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>;
pinctrl-names = "default";
bus-speed = <500000>;
status = "okay";
};