I am using Ubuntu 20.04 on Raspberry Pi 4 I am receiving data from another device through USB initiated as serial port with ftdi_sio with udev rules:
ACTION=="add", \
ATTRS{idVendor}=="0eb8", \
ATTRS{idProduct}=="ea02", \
RUN+="/usr/sbin/modprobe ftdi_sio" \
RUN+="/usr/bin/sh -c 'echo 0eb8 ea02 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'"
ACTION=="remove", \
ATTRS{idVendor}=="0eb8", \
ATTRS{idProduct}=="ea02", \
RUN+="/usr/bin/sh -c 'echo usb-Mettler-Toledo_Seven_Excellence-if00-port0 > /sys/bus/usb/drivers/ftdi_sio/unbind'"
I tested on Windows with few terminals like YAT or minicom, and it works perfectly, data is well-formed. But on linux it fails. I figured out 2 characters are lost every 62 characters. Also tried directly with screen software instead of python. Also verified the power, i'm using official raspi4 charger.
Same errors happened whatever software I use to read the serial port (screen, minicom, python, etc.)
Tried many configuration of dsrdtr, rtscts and xonxoff. From the other device sending data, rules might be baudrate 9600, databits 8, no parity, xonxoff enabled. (not sure, I found these parameters on another feature of the device)
Data sample, so every 62 characters, 2 are lost:
b'{misses '<?'}xml version="1.0" encoding="utf-8" standalone="yes" ?><Telegra{misses 'm '}xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:/{misses '/w'}ww.w3.org/2001/XMLSchema-instance" xmlns="LancePlatform"><EndO{misses 'fM'}ethod><m_timestamp>2023-10-24T16:20:35.0000</m_timestamp><m_eA{misses 'na'}lysisStatus>1</m_eAnalysisStatus><m_uiJobId>2</m_uiJobId><m_us{misses 'er'}></m_user></EndOfMethod></Telegram>\r\n'
UPDATE
In dmesg, found some helpful logs, but couldn't find a real answer on forums.
[ 7150.279471] ftdi_sio ttyUSB0: error from flowcontrol urb
[ 7151.045999] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 7151.054621] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 7151.062250] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 7151.069459] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 7151.075976] ftdi_sio ttyUSB0: error from flowcontrol urb
[ 7258.303870] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 7258.312491] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 7258.320253] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 7258.327452] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 7258.333835] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 7258.341355] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 7258.347832] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 7264.638935] ttyUSB ttyUSB0: 1 input overrun(s)
[ 7268.853097] ttyUSB ttyUSB0: 32 input overrun(s)
[ 7275.768053] ttyUSB ttyUSB0: 4 input overrun(s)
[ 7323.578412] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8465.312963] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 8465.321780] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 8465.329355] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8465.336715] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8465.343213] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8465.349976] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8465.359343] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 8465.367975] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 8465.375468] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8538.369178] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8564.307661] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 8564.316412] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate
[ 8564.324032] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8564.331160] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8564.337661] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8564.344415] ftdi_sio ttyUSB0: failed to get modem status: -32
[ 8564.353790] ftdi_sio ttyUSB0: ftdi_set_termios FAILED to set databits/stopbits/parity
[ 8564.362411] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to
set baudrate
[ 8564.369917] ftdi_sio ttyUSB0: failed to set flow control: -32
[ 8586.585832] ftdi_sio ttyUSB0: failed to get modem status: -32