Sign in to follow this  
felisandria

Tuning my USB COM port

Recommended Posts

I have a system that has a sensor input running at 100 Hz, and 2 outputs that I would like to have running at 100 Hz each. All of this goes through a single USB port, to a USB hub. On the laptop, it resolves to each of these 3 lines pretending to be a separate COM port. Sensor input is 20kbps (25 bytes * 100 Hz), one output line is 77.6 kbps (97 bytes * 100 Hz), and the second output line is 23.2 kbps (29 bytes * 100 Hz), for a total of 120.8 kbps. All 3 COM ports are set to 115200 for their baud rate. The problem is that on these settings, the CPU clocks up to 100% after about 15 minutes which is obviously bad, then the system locks up eventually. I've ruled out memory leaks through repeat debugging sessions. It appears that it's backing up in the port and not writing fast enough. The input sensor seems fine as long as the outputs are brought way down or turned off. I'm using asynchronous winsock. My output has the following settings for timeouts:
ReadIntervalTimeout = 100;
ReadTotalTimeoutConstant = 100;
ReadTotalTimeoutMultiplier = MAXDWORD;
WriteTotalTimeoutConstant = 10;
WriteTotalTimeoutMultiplier = 10;
Is there anything I can tweak to get better performance out of this? I'm kind of surprised that I'm only able to get a fraction of what I would expect moving in and out of the USB port. Are my timeouts wrong or something? Anyone better at serial communications than me able to give some settings suggestions? Thanks much -fel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this