Jump to content
  • Advertisement
Sign in to follow this  

Tuning my USB COM port

This topic is 4955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!