LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-8451 I2C communicating very slowly on some computers

Alright Everyone I have a new development that might shed some light on the situation. I originally stated that it was taking 1600ms to communicate with my devices but as I have been playing around with new experiments I have noticed that number has been increasing. It's now around 6500ms and I know why, or at least I know what I have to do to make is slow down.

 

Every time I unplug and replug the USB-8451 the communication time increases by about 150ms

 

For example: I plug in the USB-8451 and it takes 6000ms to run my VI I let it run over and over all night long and in the morning it's still taking 6000ms. I unplug and replug the USB-8451 and now it takes 6150ms I run it once. Then I unplug and replug 2 more times and run it once more and it's at 6450ms I run it all night long and it's still 6450ms in the morning.

 

The point I'm trying to make is the VI isn't getting slow as it runs (aka not a memory leak) but it gets incrementally slower each time the device is unplugged and replugged.

 

What the heck is going on??

 

-Aaron

0 Kudos
Message 11 of 17
(650 Views)

Hi Aaron,

 

That is some strange behavior. I have a couple of thoughts for you:

 

First, can you check in Device Manager and in Measurement & Automation Explorer on the machines where you are seeing this behavior to see if the USB-8451 is showing up as expected? I've attached screenshots of how they should appear.

 

My other thought is that the problem could lie within the executable that you've built. You mentioned earlier that the problem does not show up on your development PC, which is the only PC that is not running the executable. Could you attempt to run the executable on your development PC and see if the issue appears there? Also, if you could try placing a new copy of the executable on the laptops that are showing the problem to see if that executable will also behave in such a manner.

 

Finally, if you could post your code, I would like to look through it to see if I can replicate the issue on my end. 

 

Best,

Dan N

Applications Engineer

National Instruments 

Download All
0 Kudos
Message 12 of 17
(636 Views)

@Dan N wrote:

Hi Aaron,

 

That is some strange behavior. I have a couple of thoughts for you:

 

First, can you check in Device Manager and in Measurement & Automation Explorer on the machines where you are seeing this behavior to see if the USB-8451 is showing up as expected? I've attached screenshots of how they should appear.

 

My other thought is that the problem could lie within the executable that you've built. You mentioned earlier that the problem does not show up on your development PC, which is the only PC that is not running the executable. Could you attempt to run the executable on your development PC and see if the issue appears there? Also, if you could try placing a new copy of the executable on the laptops that are showing the problem to see if that executable will also behave in such a manner.

 

Finally, if you could post your code, I would like to look through it to see if I can replicate the issue on my end. 

 

Best,

Dan N

Applications Engineer

National Instruments 


Hey Dan, thanks for taking the time to respond!

 

Unfortunately the USB-8451 shows up in MAX and device manager as it should. Also, for what it's worth, in MAX the device status is "This device is working properly."

 

Perhaps I was a little unclear when I described the problem before so I'll go over it again:

 

I have 4 computers: 1 development PC, 1 test PC and 2 test laptops.

 

When I first created the executable program (and indeed many other programs that use the same USB-8451 VIs before it) they all ran fine on all 4 computers, that includes running these executables on my development PC. Then, recently, one of the laptops started to exhibit this "slowing" behavior and a few weeks later the other one started to "slow" as well. There was no event that I can think of to explain the shift from working normally to working slowly. If I put the exact same executable on all 4 computers now, as a test, the program will run slowly on the laptops and just find on my test PC and development PC.

 

I also want to reiterate that the clock still operates at 100 KHz (confirmed with an oscilloscope) but for some reason there is an extremely long delay from when I start the VI to when it makes and completes the communication. And as I mentioned in my previous post, this delay is a more or less fixed value (currently around 6500 ms) that will increase by about 150ms each time I disconnect and reconnect the USB 8451 which just seems super weird to me.

 

I have attached the simplest VI I can make and still see the problem.

 

Thanks as always for you help! I hope we can figure this out.

 

-Aaron

0 Kudos
Message 13 of 17
(624 Views)

Hi Aaron,

 

I've got some more thoughts and a couple of questions:

 

Looking at the VI that you've posted (thank you for posting it), you don't have the I2C code in a while loop, but you mentioned that you're running your code for quite a long time. How are you starting and stopping your VI when you run your executable? Are you using the Run Continuously button to start it or the abort button to stop? Both of these may leave unhandled I2C references. The best practice is to configure your I2C script once, then pass it to "Run Script.vi" numerous times in a while loop. If you run through the entire process that you've illustrated in the VI you posted every time that you create a script, you may see a memory leak. 

 

Finally, when you mentioned that you were plugging in and unplugging the 8451 between the computers and you noticed the delay, were you doing this while the VI was running?

 

I apologize if these seem like low level questions; I want to make sure that we're covering all of our bases here. 

 

Best,

Dan Nelson

Applications Engineer

National Instruments

http://www.ni.com/support 

0 Kudos
Message 14 of 17
(603 Views)

This VI runs in a much larger program that would be somewhat difficult to post here. When I say I run it over night it's being called again and again by the larger VI. But the VI I posted still exhibits the slowing problem I mentioned. Whether I run it once or with the run continuously (and yes, I stop it with the run continuously button as well) it will still be slow.

 

Again I'm quite sure it's not a memory leak since this VI (or the larger one I mentioned, or 10 other programs that all talk to the USB-8451) don't slow down over time. From the first communication to the 10,000th the delay is the same. The length of the delay does however grow if I disconnect and reconnect the device. But once I start the program the delay doesn't change.

 

When I mentioned I was plugging and unplugging the 8451 I was doing it when the program was not running. 

 

Hope this helps!

0 Kudos
Message 15 of 17
(599 Views)

Hey Aaron,

 

Thanks again for all the info. I've got another step for us to try here:

 

Try getting a NI I/O Trace capture of the calls to the USB-8451 operating on the computer that shows the slowdown, and then on the computer that doesn't. This KnowledgeBase article should walk you through the process pretty well. Note that the KnowledgeBase article says to start NI I/O Trace from MAX, but it should also show up as an individual program in Windows. NI I/O Trace will capture the calls that LabVIEW is putting out to the 8451, so we should be able to see if there are additional calls being made on the machines that are causing the slowdowns. 

 

Give that a shot; if you can't see anything in the I/O trace calls, post them here and I can take a look.

 

Best,

Dan N

Applications Engineer

National Instruments 

0 Kudos
Message 16 of 17
(589 Views)

Hello Again,

 

Sorry I haven't responded in a while, I got moved to a higher priority project and haven't had a chance to continue debugging this weird issue. But I'm back now and still no luck finding the cause of the problem.

 

I did as you asked and ran NI IO Trace on both computers and the primary difference that I noticed is the entry "viParseRsrcEx" takes over 5 seconds to run on the slow machine and around 15ms to run on the fast PC. This is obviously where the slowing is occuring now the only question is: Why? The two files are attached if you want a closer look ( I had to change the extension to .txt because I was not allowed to add files with extension .nitrace for some reason. Anyway, to view them just change the .txt to .nitrace and you should be fine).

 

I searched the forums, NIs website and Google for anything about viParseRsrcEx but no luck so far. Hopefully someone can shed some light on this for me.

 

Thanks for your help, I feel like we're getting somewhere!

-Aaron

Download All
0 Kudos
Message 17 of 17
(540 Views)