Skip to content

Board ch32v006evt error running sample program modbus/rtu_server #90421

Open
@Colt-Ma

Description

@Colt-Ma

The same is to test uart1, I test the example program driver/uart/echo_bot is no problem, indicating that there is no problem with the hardware, but there is a problem with the test sample program modbus/rtu_server, No matter what is sent to the serial port, the serial port will return multiple bytes of 0x00.

I've made the following changes to the these files:

&usart1 {
	status = "okay";
	current-speed = <9600>;
	pinctrl-0 = <&usart1_default>;
	pinctrl-names = "default";
	modbus0 {
		compatible = "zephyr,modbus-serial";
		status = "okay";
		//de-gpios = <&gpioa 6 GPIO_ACTIVE_LOW>;
	};
};
CONFIG_LOG=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
static int uart_wch_configure(const struct device *dev,
				const struct uart_config *cfg)
{

	return 0;
};
#endif
const static struct modbus_iface_param server_param = {
	.mode = MODBUS_MODE_RTU,
	.server = {
		.user_cb = &mbs_cbs,
		.unit_id = 1,
	},
	.serial = {
		.baud = 9600,
		.parity = UART_CFG_PARITY_NONE,
	},
};

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions