A valid device tree configuration is provided for the ADCs of the 8 input channels and the sample adc_dt works out of the box. Obviously this is not the only possible configuration but it provides a good template for further customization without the need to lookup the ADC GPIOs and connections in the schematics. Signed-off-by: Federico Di Gregorio <fog@dndg.it>
203 lines
3.9 KiB
Text
203 lines
3.9 KiB
Text
/*
|
|
* Copyright (c) 2023 Felipe Neves
|
|
* Copyright (c) 2024 DNDG srl
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/ {
|
|
leds {
|
|
compatible = "gpio-leds";
|
|
|
|
status_led_1: led_1 {
|
|
gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
status_led_2: led_2 {
|
|
gpios = <&gpioi 1 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
status_led_3: led_3 {
|
|
gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
status_led_4: led_4 {
|
|
gpios = <&gpioh 15 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
led_reset: led_g {
|
|
gpios = <&gpioh 12 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
led_reset_red: led_r {
|
|
gpios = <&gpioh 11 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
led_user: led_b {
|
|
gpios = <&gpioe 5 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
};
|
|
|
|
relays {
|
|
compatible = "gpio-power-switches";
|
|
|
|
output_d0: d0 {
|
|
gpios = <&gpioi 6 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
output_d1: d1 {
|
|
gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
output_d2: d2 {
|
|
gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
output_d3: d3 {
|
|
gpios = <&gpioi 4 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
};
|
|
|
|
gpio_keys {
|
|
compatible = "gpio-keys";
|
|
|
|
user_button: button {
|
|
gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>;
|
|
zephyr,code = <INPUT_KEY_WAKEUP>;
|
|
};
|
|
};
|
|
|
|
aliases {
|
|
sw0 = &user_button;
|
|
led0 = &status_led_1;
|
|
led1 = &status_led_2;
|
|
led2 = &status_led_3;
|
|
led3 = &status_led_4;
|
|
relay1 = &output_d0;
|
|
relay2 = &output_d1;
|
|
relay3 = &output_d2;
|
|
relay4 = &output_d3;
|
|
};
|
|
};
|
|
|
|
&rcc {
|
|
d1cpre = <1>;
|
|
hpre = <2>;
|
|
d1ppre = <2>;
|
|
d2ppre1 = <2>;
|
|
d2ppre2 = <2>;
|
|
d3ppre = <2>;
|
|
};
|
|
|
|
&rtc {
|
|
status = "okay";
|
|
};
|
|
|
|
&mailbox {
|
|
status = "okay";
|
|
};
|
|
|
|
&rng {
|
|
status = "okay";
|
|
};
|
|
|
|
&usart3 {
|
|
pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11 &usart3_cts_pb13 &usart3_de_pb14>;
|
|
pinctrl-names = "default";
|
|
current-speed = <115200>;
|
|
/* The RS485 is often used with the ModBus protocol. */
|
|
modbus0 {
|
|
compatible = "zephyr,modbus-serial";
|
|
de-gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
|
|
re-gpios = <&gpiob 13 GPIO_ACTIVE_LOW>;
|
|
};
|
|
};
|
|
|
|
&adc1 {
|
|
pinctrl-0 = <&adc1_inp0_pa0_c &adc1_inp6_pf12>;
|
|
pinctrl-names = "default";
|
|
st,adc-clock-source = <SYNC>;
|
|
st,adc-prescaler = <4>;
|
|
vref-mv = <10000>;
|
|
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
|
|
a0: channel@0 {
|
|
reg = <0>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
a2: channel@6 {
|
|
reg = <6>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
};
|
|
|
|
&adc2 {
|
|
pinctrl-0 = <&adc2_inp9_pb0>;
|
|
pinctrl-names = "default";
|
|
st,adc-clock-source = <SYNC>;
|
|
st,adc-prescaler = <4>;
|
|
vref-mv = <10000>;
|
|
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
|
|
a3: channel@9 {
|
|
reg = <9>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
};
|
|
|
|
&adc3 {
|
|
pinctrl-0 = <&adc3_inp6_pf10 &adc3_inp7_pf8 &adc3_inp8_pf6 &adc3_inp9_pf4 &adc3_inp0_pc2_c>;
|
|
pinctrl-names = "default";
|
|
st,adc-clock-source = <SYNC>;
|
|
st,adc-prescaler = <4>;
|
|
vref-mv = <10000>;
|
|
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
|
|
a1: channel@0 {
|
|
reg = <0>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
a4: channel@6 {
|
|
reg = <6>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
a5: channel@7 {
|
|
reg = <7>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
a6: channel@8 {
|
|
reg = <8>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
|
|
a7: channel@9 {
|
|
reg = <9>;
|
|
zephyr,gain = "ADC_GAIN_1";
|
|
zephyr,reference = "ADC_REF_INTERNAL";
|
|
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
zephyr,resolution = <16>;
|
|
};
|
|
};
|