• 0
Pazzo

Digilent Analog Discovery 2: AnalogIn continous sampling

Question

Posted (edited)

Hi,

I'm trying to acquire at 1MSample/s using  WaveForms SDK (DWF Version: 3.10.9) I think that I should use acqmodeRecord mode with infinitum length so I use:

FDwfAnalogInRecordLengthSet(hdwf, 0.0);

But then in the while loop I'm a little puzzled due to the call

if(!FDwfAnalogInStatus(hdwf, true, &sts))....

Shouldn't be done only once to reach Running state? According to section "5  Analog In (Oscilloscope)" in SDK documentation the AD2 should remain in Running state...

So I change the example to do only once but I have always the same samples...any clue? Should I use other acquisition mode like ScanScreen? like reported in

 

Thank you for your help

pz

Edited by Pazzo

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
1 hour ago, Pazzo said:

Hi,

I'm trying to acquire at 1MSample/s using  WaveForms SDK (DWF Version: 3.10.9) I think that I should use acqmodeRecord mode with infinitum length so I use:

FDwfAnalogInRecordLengthSet(hdwf, 0.0);

But then in the while loop I'm a little puzzled due to the call

if(!FDwfAnalogInStatus(hdwf, true, &sts))....

Shouldn't be done only once to reach Running state? According to section "5  Analog In (Oscilloscope)" in SDK documentation the AD2 should remain in Running state...

So I change the example to do only once but I have always the same samples...any clue? Should I use other acquisition mode like ScanScreen? like reported in

 

Thank you for your help

pz

 

Sorry, for the noise. I found the answer in this note of FDwfAnalogInStatus(HDWF hdwf, BOOL fReadData, DwfState *psts) documentation

Note: To ensure consistency between device status and measured data, the following AnalogInStatus*functions
do not communicate with the device. These functions only return information and data from the last
FDwfAnalogInStatus call.

So it's needed to get all the information from device...
As result I test my acquisition example on a i7 using a direct usb3 connection and I can reach only 700KSample/s ..
Could anyone share an example of C code to get samples at 1MSample/s? Does anyone try to use rt patches?

Thanks!

pz

 

Share this post


Link to post
Share on other sites
  • 0

Hi @Pazzo,

I have moved your thread to the Scopes & Instruments section of the forum (rather than the WaveFormsLive which is designated for OpenScope MZ and OpenLogger), where the engineer much more familiar with WaveForms SDK will be able to see and respond to your question.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0

Hi @Pazzo

In case the data processing or saving in your loop function takes too much time it could lead to buffer overflow (samples lost/corrupt).
You could try opening the device with 2nd configuration to have more device buffer.
# 2nd configuration for Analog Disocovery with 16k analog-in buffer
#dwf.FDwfDeviceConfigOpen(c_int(-1), c_int(1), byref(hdwf)) 

 

Share this post


Link to post
Share on other sites
  • 0

Hi @attila!

Thank you for your help! I can sample at 500KHz using 2nd configuration (doing some changes on cpugovernor).

I would like to add that using the kernel with RT_PREEMPT I can get data at 1.25MSample/s (!!!)

pz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now