Intermittent Slow Data Transfer / Program Execution RRS feed

  • Question

  • I have written a program that allows the user to read in information from an external device, modify the data, and write it back. But at random times the communications is very slow.

    The Data is in a vehicles ECU (Engine Control Unit), we read it out through the CAN bus through a device we created to convert the CAN protocol to USB. The device uses a FTDI FT2232 chip to send the data to the PC through USB, I 'grab' the data from the FTDI driver when the drivers fires an event saying data is available and deal with it in my program. The ECU requires responses in less than 50ms, or it invalidates the request.

    Without any rhyme or reason I can determine, the response times will vary from a few ms to 70ms.

    The routines that communicate with the device through the FTDI drivers are written in C# and wrapped into a DLL that is called from the main program which is written in VB. All of the communications routines are in the DLL and only Data passes to VB. I run multiple tasks inside of the DLL to deal with the information being returned. The data comes in as a raw stream of bytes, is "packetized" into messages, filtered, and then queued for use. Each step is a task running in a loop. (processor utilization is small). "Packets" are held in Concurrent Queues of custom class "packet"

    It seems like execution inside the DLL is slowed down at times... "packets" will take forever to get from task to task... Is there something windows might be doing to isolate the code since it directly talks to the USB drivers, or ... I'm just baffled, can't even think of what might be happening...

    In debug I have checked to make sure I am not creating multiple instances of routines...

    You can run the program a number of times and everything is great, then the next time, it's in slow motion. All in one sitting, nothing that I can see changing...

    Just throwing this out there because I am at a loss, maybe someone else has run across something like this.



    Man, Im in way over my head!!!

    Thursday, March 1, 2018 9:21 PM

All replies

  • I think you should contact support of the device to seek advise on troubleshooting, but before that I recommend you add simple debug statement to dump the length of data in buffer on "data received" or equivalent event to confirm the problem is on your side or on hardware side.

    If the buffer data length is small, the problem would be either on hardware or driver. If the time elapsed between event is long and the buffer data length is large, the problem is on your code.

    Friday, March 2, 2018 1:17 AM
  • Thanks for the reply, I do dump the data. I Sniff the USB to find timings. The difference between when I think I send the Data and when it actually goes out the USB is about 20ms... and eternity.

    As far as contacting the device manufacturer... We designed and manufacture the device... :)

    There is something interfering with the execution of the routines in the DLL.... Just can't find it.... :(



    Man, Im in way over my head!!!

    Friday, March 2, 2018 4:24 AM
  • In that case try to run "Process Explorer" there. In the options menu, add your debug symbol path of DLL you use.

    When your program appear to not-function again, open your process and switch to "Thread" tab. If the debug symbol resolves correctly, it should be able to tell you which function the code is waiting to give you some idea.

    If your machine also have debug symbol for the driver, you can also check the "System" process to see what the driver is doing.

    Friday, March 2, 2018 8:21 AM
  • Hi John,

    Did you ever resolve your problem?  I am seeing the same problem as you.  I wrote a GUI in C# that uses the FTDI .NET DLL to talk to an FT232H.  I am using it as a USB to I2C controller to continuously read telemetry information from our power management chip.  It was running fine on Windows 10 but after the April 2018 update, I got intermittent performance issues where 90% of the time it would run about 10x slower.  Restarting the app/rebooting the computer would sometimes fix the issue but not always.  The same app running on Windows 7 has no issues.  I cannot figure out what is going on.



    Wednesday, September 5, 2018 10:11 PM