Re: data throttling under load when serial to usb adapter is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 20, 2021 at 09:11:06AM +0100, Filip Žaludek wrote:
> 
> 
> 
> Hi,
>  under load I am experiencing data throttling when serial to usb adapter is used,
> but only in direction from wires to usb. Opposite direction seems to be robust.
>  To reproduce plug both ends of usb to serial adapter into same hardware and run
> attached script. You should see data flowing in both directions, then saturate cpu
> `stress --cpu #cpus_plus_two`.
>  Data will be corrupted only in serial to usb direction, usually from beginning,
> often within first urb. Not seems to be due to flow control.
>  Even though chopped bytes are received, rx/tx counters are correctly incremented.
> Script implements data sending in two ways, first utilizing socat and second standard
> cat command. It is adjusted for RPi4 with miniUART ttyS0, for multiport hardware
> and/or ttyAMA0 you will need to tailor accordingly.
> 
> Rough failure rates observed (former trials with ~32k dmesg):
> ttyAMA0: 'cat' 20% vs. 'socat'  2%
> ttyS0  : 'cat' 90% vs. 'socat' 40%
> 
> Why to plug both adapter ends into same hardware?
> - I believe this is sub-issue of two connected devices, but it is hard to reproduce
> - serial port programming
> 
> 
> 
> 
> Regards,
> Filip Zaludek
> 
> 
> 
> 
> Tested chipsets:
> 
> ftdi_sio [TTL], Bus 004 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
> pl2303 [TTL], Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P
> ch341-uart [RS232], Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics CH340 serial converter

Using 'cat' is not a good way to ever use a serial port.  Please use a
tool that can properly detect and use the serial port flow control
settings, which should prevent the issues you are seeing here.

Is socat using flow control?  If so, which settings, hardware or
software flow control?

Also please note that the usb-serial devices you are using here are
_very_ cheap and not good for huge amounts of data like you seem to want
to use here.  I would recommend a much more robust usb-serial device if
you need high data rates and good hardware flow control handling.  Most
of the time, the devices you have here do not even have any hardware
flow control support as the manufacturers do not hook up those lines.
So be careful.

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux