Replace the temperature calculation in daq.cpp by the DAQ NTC sensor driver. Temperatures below -50 °C are still considered as a missing sensor. A missing MOSFET temperature sensor keeps the previous value instead of setting an implausible temperature. The series resistor of the NTCs was specified as multiplier of the DAQ channels before. It is moved to the pullup-ohm property of the new ntc-fets and ntc-bat nodes and the gain of the DAQ channels is set to 1. Note for out-of-tree boards: The temp-fets and temp-bat DAQ channels need the labels daq_temp_fets and daq_temp_bat and a corresponding libresolar,daq-ntc-thermistor node with the labels ntc_fets and ntc_bat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
153 lines
2.8 KiB
Plaintext
153 lines
2.8 KiB
Plaintext
/*
|
|
* Copyright (c) The Libre Solar Project Contributors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/ {
|
|
/* delete conflicting nodes from Zephyr native_sim board */
|
|
/delete-node/ leds;
|
|
/delete-node/ aliases;
|
|
|
|
pcb {
|
|
compatible = "charge-controller";
|
|
|
|
type = "Native POSIX dummy";
|
|
version-str = "v0.1";
|
|
version-num = <1>;
|
|
|
|
hs-voltage-max = <80>;
|
|
ls-voltage-max = <32>;
|
|
dcdc-current-max = <20>;
|
|
};
|
|
|
|
chosen {
|
|
zephyr,console = &uart0;
|
|
zephyr,shell-uart = &uart0;
|
|
zephyr,flash = &flash0;
|
|
};
|
|
|
|
leds {
|
|
compatible = "charlieplexing-leds";
|
|
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>, /* chg red */
|
|
<&gpio0 14 GPIO_ACTIVE_LOW>, /* chg green */
|
|
<&gpio0 9 GPIO_ACTIVE_LOW>, /* dis red */
|
|
<&gpio0 15 GPIO_ACTIVE_LOW>; /* dis green */
|
|
|
|
pwr {
|
|
states = <0 1 0 0>;
|
|
};
|
|
|
|
load {
|
|
states = <0 0 0 1>;
|
|
};
|
|
};
|
|
|
|
load_switch: load-switch {
|
|
compatible = "libresolar,gpio-power-switch";
|
|
gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
|
|
current-max = <20>;
|
|
};
|
|
|
|
outputs {
|
|
compatible = "outputs";
|
|
|
|
can_en {
|
|
gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
|
};
|
|
};
|
|
|
|
adc1: adc1 {
|
|
compatible = "zephyr,dummy-adc";
|
|
#io-channel-cells = <1>;
|
|
};
|
|
|
|
ntc_fets: ntc-fets {
|
|
compatible = "libresolar,daq-ntc-thermistor";
|
|
daq-channel = <&daq_temp_fets>;
|
|
pullup-ohm = <10000>;
|
|
};
|
|
|
|
adc-inputs {
|
|
compatible = "libresolar,daq-emul";
|
|
|
|
v-low {
|
|
io-channels = <&adc1 12>;
|
|
multiplier = <105600>;
|
|
divider = <5600>;
|
|
};
|
|
|
|
v-high {
|
|
io-channels = <&adc1 15>;
|
|
multiplier = <102200>;
|
|
divider = <2200>;
|
|
};
|
|
|
|
v-pwm {
|
|
io-channels = <&adc1 4>;
|
|
multiplier = <25224>; // (12*8.2 + 120*8.2 + 120*12) * 10
|
|
divider = <984>; // (8.2*12) * 10
|
|
offset = <37414>; // 65536 / (1 + 8.2/120 + 8.2/12)
|
|
};
|
|
|
|
daq_temp_fets: temp-fets {
|
|
io-channels = <&adc1 11>;
|
|
multiplier = <1>;
|
|
divider = <1>;
|
|
};
|
|
|
|
vref-mcu {
|
|
io-channels = <&adc1 18>;
|
|
multiplier = <1>;
|
|
divider = <1>;
|
|
};
|
|
|
|
temp-mcu {
|
|
io-channels = <&adc1 16>;
|
|
multiplier = <1>;
|
|
divider = <1>;
|
|
};
|
|
|
|
i-dcdc {
|
|
io-channels = <&adc1 1>;
|
|
// amp gain: 25, resistor: 2 mOhm
|
|
multiplier = <1000>; // 1000
|
|
divider = <50>; // 2*25
|
|
};
|
|
|
|
i-load {
|
|
io-channels = <&adc1 2>;
|
|
// amp gain: 25, resistor: 2 mOhm
|
|
multiplier = <1000>; // 1000
|
|
divider = <50>; // 2*25
|
|
};
|
|
|
|
i-pwm {
|
|
io-channels = <&adc1 5>;
|
|
// amp gain: 68/2.2, resistor: 2 mOhm
|
|
multiplier = <2200>; // 1000*2.2
|
|
divider = <136>; // 2*68
|
|
};
|
|
};
|
|
|
|
halfbridge: halfbridge {
|
|
compatible = "libresolar,half-bridge-emul";
|
|
clock-frequency = <24000000>;
|
|
frequency = <70000>;
|
|
deadtime-ns = <300>;
|
|
};
|
|
|
|
pwm_switch: pwm-switch {
|
|
compatible = "libresolar,power-switch-emul";
|
|
frequency = <50>;
|
|
current-max = <20>;
|
|
};
|
|
|
|
aliases {
|
|
uart-dbg = &uart0;
|
|
uart-uext = &uart0;
|
|
// spi-uext = &spi1;
|
|
// i2c-uext = &i2c1;
|
|
};
|
|
};
|