Description:
I am experiencing data corruption when using the Waveshare SKU 28214 (ch348) with a Modbus ASCII RS485 device. The communication requires 115200 baud, 7 data bits, Even parity, and 1 stop bit (7E1).
While a generic USB-RS485 adapter works perfectly with these exact settings, the Waveshare device using the ch9344 driver results in corrupted exchanges. It appears to me the driver is not correctly handling the 7-bit parity bit or is failing to mask the 8th bit, leading the Modbus slave to misinterpret the frames.
On the Linux device with Kernel 6.12, the Waveshare is correctly identified by the driver:
Bus 001 Device 007: ID 1a86:55d9 wch.cn USB2.0 To Multi Serial Ports
Steps to Reproduce:
- Connect a Waveshare SKU 28214 (Or any ch348 based device?) to a Modbus ASCII slave.
- Configure the port for 7E1 (115200 baud).
- Attempt a standard Modbus read (Function Code 04).
Observed Behavior:
The exchange is corrupted. The slave receives or returns invalid ASCII patterns such as:
:A
D R4LC
:0104344A43000E0003000500200000000101250000000000000000000F00070004000400020000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCD
In a working exchange with a generic adapter, the pattern is clean Modbus ASCII:
:01040000001AE1
:0104344A43000E0003000500200000000101240000000000004000000F00070004000400040000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8C
Port Configuration (stty -a):
Linux reports this when the Modbus application has configured the port:
speed 115200 baud; line = 0;
parenb -parodd -cmspar cs7 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
Requested Action:
Please verify the parity calculation logic in ch9344.c, specifically for CS7 (7-bit) modes. It seems the 8th bit (parity) is not being correctly managed or positioned within the byte frame, which is critical for Modbus ASCII compliance.
Description:
I am experiencing data corruption when using the Waveshare SKU 28214 (ch348) with a Modbus ASCII RS485 device. The communication requires 115200 baud, 7 data bits, Even parity, and 1 stop bit (7E1).
While a generic USB-RS485 adapter works perfectly with these exact settings, the Waveshare device using the ch9344 driver results in corrupted exchanges. It appears to me the driver is not correctly handling the 7-bit parity bit or is failing to mask the 8th bit, leading the Modbus slave to misinterpret the frames.
On the Linux device with Kernel 6.12, the Waveshare is correctly identified by the driver:
Bus 001 Device 007: ID 1a86:55d9 wch.cn USB2.0 To Multi Serial PortsSteps to Reproduce:
Observed Behavior:
The exchange is corrupted. The slave receives or returns invalid ASCII patterns such as:
In a working exchange with a generic adapter, the pattern is clean Modbus ASCII:
Port Configuration (stty -a):
Linux reports this when the Modbus application has configured the port:
Requested Action:
Please verify the parity calculation logic in ch9344.c, specifically for CS7 (7-bit) modes. It seems the 8th bit (parity) is not being correctly managed or positioned within the byte frame, which is critical for Modbus ASCII compliance.