0

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
4
  • Looks like you already posted your question on raspberrypi.stackexchange.com. Besides, you might be interested by the answer there.
    – xhienne
    Nov 2, 2023 at 14:30
  • Hello @xhienne, thanks for answering. I did publish it in many places to maximise my chances because it's a pro use case quite urgent sadly. For the answer, I did see that one, but power management is disabled on my device. And I tried it with multiple computers all on Ubuntu, none worked.
    – lalannou
    Nov 3, 2023 at 8:15
  • I understand you want to maximize your chances of getting an answer but cross-posting is prohibited here.
    – xhienne
    Nov 3, 2023 at 13:24
  • @xhienne Oh, my bad. Deleted on the other side :) As I guess here is the best place to get help for this
    – lalannou
    Nov 5, 2023 at 17:29

2 Answers 2

0

The device is compatible with the USB CDC Class standard. You can use the "generic" serial device directly. Tested on rpi3, Debian bookworm, I can open the port and read the device information telegram correctly, response about 1.8kByte

ACTION=="add", \
ATTRS{idVendor}=="0eb8", \
ATTRS{idProduct}=="ea02", \
RUN+="/usr/sbin/modprobe usbserial" \
RUN+="/bin/sh -c 'echo 0eb8 ea02 > /sys/bus/usb-serial/drivers/generic/new_id'"

Log

[ 6303.984478] usb 1-1.3: new full-speed USB device number 11 using dwc2                                                                                             
[ 6304.095741] usb 1-1.3: not running at top speed; connect to a high speed hub                                                                                      
[ 6304.116616] usb 1-1.3: New USB device found, idVendor=0eb8, idProduct=ea02, bcdDevice= 0.00                                                                       
[ 6304.129901] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3                                                                                   
[ 6304.139771] usb 1-1.3: Product: Seven Excellence                                                                                                                  
[ 6304.146830] usb 1-1.3: Manufacturer: Mettler-Toledo                                                                                                               
[ 6304.154119] usb 1-1.3: SerialNumber: A000000000                                                                                                                   
[ 6304.162207] usbserial_generic 1-1.3:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.                                              
[ 6304.175985] usbserial_generic 1-1.3:1.0: Tell [email protected] to add your device to a proper driver.                                                    
[ 6304.189463] usbserial_generic 1-1.3:1.0: generic converter detected                                                                                               
[ 6304.198137] usb 1-1.3: generic converter now attached to ttyUSB0
1
  • Thank you! That's a way i should try if anytime soon I want to use something else than python
    – lalannou
    Nov 14, 2023 at 10:43
0

To anyone who is having the same issue. At the end, it was a driver issue, ftdi_sio was not suitable for this device, don't know why, don't know how.

Here is the driver that worked: https://github.com/pyusb/pyusb.

It forces me to use python, but at least it works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .