Why is the rate my USB COM port reads data dependent on the laptop being plugged in?

2

Summary

I am reading serial data through a USB port and when the laptop is charging the COM Port receives about 60 updates per second and when the laptop is not charging the COM Port receives about 1 update per second.


Background (I'm not sure what information is helpful)

I am working on a project where a set of sensors communicate with a microprocessor and the microprocessor is connected to a laptop. Because I need the data to use for real time control, the rate at which the laptop receives information from the microprocessor is important.

Typically, I have been able to get about 60 updates from the microprocessor per second. However I am often occasionally faced with slow downs for no obvious reason. Today one of these slow downs occurred and I realized that when the laptop was not actively charging the updates per second was very slow, but when the laptop was charging it received updates at full speed.

Note that the microprocessor is not powered by the laptop.

Edit 1: My power plan is set to balanced.

Edit 2: I made the following changes to attempt to improve performance

  1. I set my critical processes to Real Time priority
  2. set my power plan to high performance
  3. I was outputting data to a console window pretty rapidly so I decreased console printing
  4. I disabled USB selective suspend
  5. Previously I had changed the COM Port latency timer to 1 ms and the receive (bytes) to 128 in an attempt to fix communication issues with this device.

I thought these had fixed it but after running for several minutes the slow down occurred again.

Looking at Task manager when the program is running properly the CPU usage is about 50% and Memory usage is about 50%. Right when the slowdown occurred the CPU utilization dropped to about 25%, memory usage remained unchanged.

It looked like the number of threads and handles displayed in task manager were steadily increasing over time, up to about 4000 threads and 98000 handles. When I closed my programs the thread count dropped to about 3000 and handle count to about 90,000.

COM Port settings

Edit 3:

I went into the BIOS and changed Intel Speedstep to disabled and C-states control to disabled. This did not seem to fix anything. I did this on the advice of this web page: http://smallbusiness.chron.com/prevent-drops-cpu-speed-70828.html

Edit 4: I used Docklight to confirm that the microprocessor is sending information quickly enough. So the issue is definitely on the laptop's end

James

Posted 2018-07-11T21:43:20.590

Reputation: 21

Have you verified your power plan configuration is set correctly? If the application that is receiving the updates is bound to the performance of the CPU, having the wrong power plan, could explain what you have witnessed. Provide any necessary information in an update to your question. – Ramhound – 2018-07-11T22:06:55.633

Ramhound, my power plan is set to balanced. Looking online it looks like that can cause some issues when high demands are made of the CPU. Other than viewing CPU usage while running the application how would I know if it is bound to the performance of the CPU? (I am at home presently and won't run the program until tomorrow) – James – 2018-07-11T22:21:53.110

Have you tried setting your power plan to "maximum performance" or whatever the name is? – Jamie Hanrahan – 2018-07-11T22:31:21.417

Not yet Jamie, didn't realize that could be a factor until Ramhound mentioned. When I get to the lab tomorrow I will definitely test and report back. Might be the cause but don't know yet. Thanks. – James – 2018-07-11T22:36:02.493

No answers