feat(app): Add CAN node application
This commit introduces a new CAN node application for the irrigation system. The application initializes the settings subsystem and the valve system. It is intended to be used on a CAN bus to control a valve. Signed-off-by: Eduard Iten <eduard@iten.pro>
This commit is contained in:
7
software/apps/can_node/boards/bluepill_f103rb.conf
Normal file
7
software/apps/can_node/boards/bluepill_f103rb.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
# Disable UART console
|
||||
CONFIG_UART_CONSOLE=n
|
||||
|
||||
# Enable RTT console
|
||||
CONFIG_RTT_CONSOLE=y
|
||||
CONFIG_USE_SEGGER_RTT=y
|
||||
CONFIG_SHELL_BACKEND_RTT=y
|
||||
43
software/apps/can_node/boards/bluepill_f103rb.overlay
Normal file
43
software/apps/can_node/boards/bluepill_f103rb.overlay
Normal file
@@ -0,0 +1,43 @@
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,console = &rtt;
|
||||
zephyr,shell = &rtt;
|
||||
zephyr,settings-partition = &storage_partition;
|
||||
};
|
||||
|
||||
rtt: rtt {
|
||||
compatible = "segger,rtt-uart";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
label = "RTT";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* Application partition starts at the beginning of flash */
|
||||
slot0_partition: partition@0 {
|
||||
label = "image-0";
|
||||
reg = <0x00000000 DT_SIZE_K(120)>;
|
||||
};
|
||||
|
||||
/* Use the last 8K for settings */
|
||||
storage_partition: partition@1E000 {
|
||||
label = "storage";
|
||||
reg = <0x0001E000 DT_SIZE_K(8)>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&usart1 {
|
||||
modbus0 {
|
||||
compatible = "zephyr,modbus-serial";
|
||||
status = "okay";
|
||||
};
|
||||
status = "okay";
|
||||
};
|
||||
47
software/apps/can_node/boards/native_sim.overlay
Normal file
47
software/apps/can_node/boards/native_sim.overlay
Normal file
@@ -0,0 +1,47 @@
|
||||
/ {
|
||||
aliases {
|
||||
vnd7050aj = &vnd7050aj;
|
||||
};
|
||||
|
||||
vnd7050aj: vnd7050aj {
|
||||
compatible = "st,vnd7050aj";
|
||||
status = "okay";
|
||||
|
||||
input0-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
|
||||
input1-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
|
||||
select0-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
|
||||
select1-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
|
||||
sense-enable-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
|
||||
fault-reset-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||
io-channels = <&adc0 0>;
|
||||
r-sense-ohms = <1500>;
|
||||
k-vcc = <4000>;
|
||||
};
|
||||
|
||||
modbus_uart: uart_2 {
|
||||
compatible = "zephyr,native-pty-uart";
|
||||
status = "okay";
|
||||
current-speed = <19200>;
|
||||
|
||||
modbus0: modbus0 {
|
||||
compatible = "zephyr,modbus-serial";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&adc0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
ref-internal-mv = <3300>;
|
||||
ref-external1-mv = <5000>;
|
||||
|
||||
channel@0 {
|
||||
reg = <0>;
|
||||
zephyr,gain = "ADC_GAIN_1";
|
||||
zephyr,reference = "ADC_REF_INTERNAL";
|
||||
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
||||
zephyr,resolution = <12>;
|
||||
};
|
||||
};
|
||||
48
software/apps/can_node/boards/weact_stm32g431_core.overlay
Normal file
48
software/apps/can_node/boards/weact_stm32g431_core.overlay
Normal file
@@ -0,0 +1,48 @@
|
||||
/ {
|
||||
aliases {
|
||||
vnd7050aj = &vnd7050aj;
|
||||
};
|
||||
|
||||
vnd7050aj: vnd7050aj {
|
||||
compatible = "st,vnd7050aj";
|
||||
status = "okay";
|
||||
|
||||
input0-gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>;
|
||||
input1-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>;
|
||||
select0-gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
|
||||
select1-gpios = <&gpiob 1 GPIO_ACTIVE_HIGH>;
|
||||
sense-enable-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
|
||||
fault-reset-gpios = <&gpiob 5 GPIO_ACTIVE_LOW>;
|
||||
io-channels = <&adc1 1>;
|
||||
r-sense-ohms = <1500>;
|
||||
k-vcc = <4000>;
|
||||
};
|
||||
};
|
||||
|
||||
&adc1 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&adc1_in1_pa0>;
|
||||
pinctrl-names = "default";
|
||||
st,adc-clock-source = "SYNC";
|
||||
st,adc-prescaler = <4>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
channel@1 {
|
||||
reg = <1>;
|
||||
zephyr,gain = "ADC_GAIN_1";
|
||||
zephyr,reference = "ADC_REF_INTERNAL";
|
||||
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
||||
zephyr,resolution = <12>;
|
||||
};
|
||||
};
|
||||
|
||||
&usart1 {
|
||||
modbus0 {
|
||||
compatible = "zephyr,modbus-serial";
|
||||
status = "okay";
|
||||
};
|
||||
status = "okay";
|
||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; // PA9=TX, PA10=RX for Modbus communication
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
Reference in New Issue
Block a user