ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB- Serial good info

Solved!
Go to solution

OK so I just spent a day debugging an app that had an insidieous race condition and thought I'd share a bit.

 

The system communicates with a DUT using a USB- Serial adaptor with theFTDIser driver installed.  what I saw was sub-vi's that each completed fine on there own however when run from the "test" system I saw some timeout errors. 

 

Adding delays had limited effect however breakpoints and property nodes both solved the issue (so of course I suspected I was insane)

 

So I ran across this rather interesting post.  and yes- I used async calls to VISA read and VISA Write.  AHhhh async calls do NOT force async behavior only request async behavior!  so I looked into latency of the ftdi driver here and here.

 

with the async calls I managed to race follow-up VISA calls by starting the second function BEFORE the first completed and locked up the interface.  The Breakpoints and property nodes FORCED a switch to th UI thread and the async calls completed synchronously.  

 

Replacing the VISA calls with synchronous calls saved my bacon. (at some time penalty) 


"Should be" isn't "Is" -Jay
Message 1 of 3
(5,842 Views)

Jeff,

 

I'm sure others will find this information very informative and will save others in this community quite a bit of time!

 

Thanks for the post!

Steven T.

0 Kudos
Message 2 of 3
(5,806 Views)
Solution
Accepted by topic author JÞB

Steven T wrote:

Jeff,

 

I'm sure others will find this information very informative and will save others in this community quite a bit of time!

 

Thanks for the post!

Steven T.


Yes, And i've found a great place to save links to the tech documents that I'd otherwise spend hours looking for when I need to get down to this level again (say in 2-3 years)  Smiley Very Happy


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 3
(5,797 Views)