From 7a785b041e7480eaedc9fdf48bf3453b554aa862 Mon Sep 17 00:00:00 2001 From: xuyanghang Date: Wed, 23 Apr 2025 17:25:49 +0800 Subject: [PATCH] Support WISDOM DTZ178 and WASION DTSD342 meter data acquisition on CH32V208RBT6 board --- .../ch32v208rbt6/third_party_driver/rs485/connect_rs485.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/rs485/connect_rs485.c b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/rs485/connect_rs485.c index a8b67cffb..9160cbf73 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/rs485/connect_rs485.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/rs485/connect_rs485.c @@ -99,7 +99,10 @@ static uint32 Rs485Init(struct SerialDriver *rs485_drv, struct BusConfigureInfo switch (rs485_cfg->data_cfg.serial_data_bits) { case DATA_BITS_8: - USART_InitStructure_Rs485.USART_WordLength = USART_WordLength_8b; + if (rs485_cfg->data_cfg.serial_parity_mode == PARITY_ODD || rs485_cfg->data_cfg.serial_parity_mode == PARITY_EVEN) + USART_InitStructure_Rs485.USART_WordLength = USART_WordLength_9b; + else + USART_InitStructure_Rs485.USART_WordLength = USART_WordLength_8b; break; case DATA_BITS_9: USART_InitStructure_Rs485.USART_WordLength = USART_WordLength_9b;