note that this is a duplicate of my question on stackoverflow
I am currently working on a software that use Python3 (pyserial) to interface with a lot of serial port (~24) on a Raspberry Pi Compute Module 3+ Lite. The serial ports are interfaced using multiple FTDI4232H chips. We access the board through a Ethernet USB interface. All of these are connected to the only USB OTG port of the Compute Module.
What I noticed is that when all serial ports are open, even if there is no serial communication going on, the Ethernet speed slows down drastically. speedtest result goes from 198.78 Mbits/sec to 1.48 Mbits/s. When using ssh to access the device, everything is stuttery.
My guess is that there is a pre-allowed minimum data bandwidth for each Serial connection, but have no clues as how to fix this.
Here is a MRE
import multiprocessing
import time
from serial import Serial
QTY = 23
STOP_TEST_AFTER = 30
def serial_test(serial_port):
serial_port = Serial(port=f"/dev/ttyUSB{serial_port}", baudrate=19200)
timer = time.time()
while time.time() - timer < STOP_TEST_AFTER:
time.sleep(0.1)
if __name__ == "__main__":
process_list = []
for i in range(0, QTY):
new_process = multiprocessing.Process(target=serial_test, args=(i,))
new_process.start()
for proc in process_list:
proc.join()
Thanks for your help!
Martin