11-27-2024 08:15 AM
I'm trying to output a sine wave at some frequency and measuring the resulting voltage and current for some period of time. On one of my PXIe-4139 boards, the program is working well without any error. Another board gives timeout errors. But only about 50% of the time...
Here is my minimum working example (also attached):
I create a single period of a sinewave and input that as the sequence. Then I calculate how many samples I need to measure and make a single fetch. Simple enough, and works well on one of my boards.
On the other board, if I run this program continuously, it's basically random whether the fetch times out or not. The fetch time when it works is 500 ms, which is correct. A timeout of 1 seconds should be enough. In fact, increasing it doesn't help.
What can I do? The same program behaves differently on 2 different boards.
11-27-2024 11:48 AM
The first problem I see is that your code is just a downhill run and you are using "continuous run" mode to constantly restart it once it completes. Would it work better after designing a proper toplevel program instead of constantly configuring and closing the device?? Hard to tell....
(I am not familiar with your instrument or drivers. I sure somebody can give more specific advice here)
11-27-2024 12:22 PM
Of course the real program will have a proper architecture, this is just an example. I use the run continuous to demonstrate that with same situation (init -> setup -> acquire) sometimes it works sometimes it fails.
I just want to add that one of the boards is installed in an MXI PXI Chassis (1073) and the failing board in a Thunderbolt chassis (1083). It is the only difference in hardware. Unfortunately I don't have to option of swapping out the boards.
11-29-2024 08:32 AM
@Basjong53 wrote:
Of course the real program will have a proper architecture, this is just an example. I use the run continuous to demonstrate that with same situation (init -> setup -> acquire) sometimes it works sometimes it fails.
I just want to add that one of the boards is installed in an MXI PXI Chassis (1073) and the failing board in a Thunderbolt chassis (1083). It is the only difference in hardware. Unfortunately I don't have to option of swapping out the boards.
Using the "run continuously" button is like clicking the run button as fast as possible over and over again, which definitely NOT the same as running the code in a loop.
11-29-2024 08:51 AM
Do not use the Run continuously feature while repeatedly opening and closing an IO Session! The session manager will get confused and potentially release improperly. The why's and wherefore are way down in Windows Garbage collection (which actually releases the Session) sometimes when you least expect it!
Use a proper loop around the fetch and only open the session once.
11-29-2024 09:01 AM
Like I said, it was just for demonstation purposes to show the random errors. Let's say I completely restart my system, open the vi and run it. It'll still be random whether or not it times out.
Also, I don't want to fetch multiple times, just once. No need for a loop. I just want to apply a sine wave, measure it by fetching once and display the result. That's it, and it's not working with the program I have.