Warning and Timeout in DAQ when using session on NI USB-6259

5 views (last 30 days)
Hi,
I'm running a very basic code in matlab (2012a 64bit) trying to attain some data through the NI USB-6259. But it prompts me back with multiple warnings due to a callback error (full error below), which ends in a timeout on the data sampling. I've tried searching around for the problem, but without success. It may be a very simple mistake on my part but i just can't see it so any help would be greatly appreciated.
If any additional information is needed for clarification, i'll provide them as soon as i see the message.
Kind regards, Simon
code:
Logtime = 10;
Fs = 20000;
s = daq.createSession('ni');
s.addAnalogInputChannel('Dev1','ai0','Voltage');
s.addAnalogInputChannel('Dev1','ai1','Voltage');
s.Rate = Fs;
s.DurationInSeconds = Logtime;
[data time]=s.startForeground();
Error/warning:
Warning: Error occurred while executing callback:
Error using +
Invalid type of input arguments (should be uint64)
> In Channel>Channel.onCustomEvent at 360
In Channel>@(source,data)obj.onCustomEvent(data.Type,data.Data) at 286
In Session>Session.doWait at 2365
In StateHardwareRunning>StateHardwareRunning.checkForTimeout at 193
In Session>Session.doStartForeground at 2240
In StateReadyToStart>StateReadyToStart.startForeground at 100
In Session>Session.startForeground at 613
Timeout expired before operation could complete.
  3 Comments
Simon Thomsen
Simon Thomsen on 21 May 2013
Thank you for replying, but sadly not the solution, got the error:
Expected input number 3, rate, to be one of these types:
double
Instead its type was uint64.
Simon Thomsen
Simon Thomsen on 21 May 2013
Even without stating Fs or Logtime (just using defaults) something is still off. I haven't played around with daq that much, so don't really have any ideas as to what could cause this problem :(

Sign in to comment.

Accepted Answer

Friedrich
Friedrich on 21 May 2013
Edited: Friedrich on 21 May 2013
Hi,
I tried your code with a simulated NI USB-6259 and it is working fine for me in 12a. Could it be that you are using the 12a prerelease? I have seen that kind of error there but not in the actual release version.
The release version has as version number:
>> version
ans =
7.14.0.739 (R2012a)
  5 Comments
Friedrich
Friedrich on 22 May 2013
So far it looks fine for me. I can see that you have some custom paths added, maybe something is shadowing some Data Acquisition Toolbox file?
We could figure that out by starting MATLAB, running a
clear functions
After that a
inmem
to see which m files are “loaded” by MATLAB (should be one or two files).
Now run the code and wait until the error occurs. Finally run:
celldisp(inmem('-completenames'))
To see which M files were touched. You can post the output here.
Simon Thomsen
Simon Thomsen on 22 May 2013
Ran what you posted and got this output:
>> clear functions
>> inmem
ans =
Empty cell array: 0-by-1
>> celldisp(inmem('-completenames'))
ans{1} =
C:\Program Files\MATLAB\R2012a\toolbox\matlab\iofun\filesep.m
ans{2} =
C:\Program Files\MATLAB\R2012a\toolbox\matlab\codetools\workspacefunc.m
ans{3} =
C:\Program Files\MATLAB\R2012a\toolbox\matlab\codetools\functionhintsfunc.m
You´re right, I've added a few files myself, tried to remove them from the pathtool (can always add them again when i need them) and the warning/error was gone! When i added the spm8 files (some statistical mapping used in medical imaging) again, the problem reoccurred, so there must be some kind of overlap in function calls that aren't handled so well.
Thanks a bunch for your help Friedrich! Much appreciated!
Kind regards, Simon

Sign in to comment.

More Answers (0)

Categories

Find more on Hardware-in-the-Loop Simulation with Simulink Real-Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!