Skip to content

7-bit Even Parity (7E1) Data Corruption on Waveshare SKU 28214 #48

@maovidal

Description

@maovidal

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:

  1. Connect a Waveshare SKU 28214 (Or any ch348 based device?) to a Modbus ASCII slave.
  2. Configure the port for 7E1 (115200 baud).
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions