Added modbus lib and test

This commit is contained in:
2025-06-12 17:04:34 +02:00
parent 8d5139c621
commit 57f7060c0e
11 changed files with 353 additions and 10 deletions

View File

@@ -10,12 +10,12 @@
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
model = "STMicroelectronics STM32F103RB-NUCLEO board";
compatible = "st,stm32f103rb-nucleo";
model = "Iten engineering Valve Node";
compatible = "iten,valve-node", "st,stm32f103rb";
chosen {
zephyr,console = &usart2;
zephyr,shell-uart = &usart2;
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,canbus = &can1;
@@ -25,7 +25,7 @@
compatible = "gpio-leds";
green_led_2: led_2 {
gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>;
label = "User LD2";
};
};
@@ -81,8 +81,7 @@
};
&clk_hse {
hse-bypass;
clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
clock-frequency = <DT_FREQ_M(8)>;
status = "okay";
};
@@ -104,15 +103,26 @@
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
current-speed = <115200>;
};
&usart2 {
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
current-speed = <9600>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
modbus0 {
compatible = "zephyr,modbus-serial";
status = "okay";
//de-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
};
};
&usart3 {
pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>;
current-speed = <115200>;
pinctrl-names = "default";
};
&i2c1 {

View File

@@ -4,7 +4,6 @@
CONFIG_SERIAL=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# enable GPIO
CONFIG_GPIO=y