Jump to content
  • 0

Unreliable data collection with AD2


Noah Faust

Question

I am using the example script AnalogIn_Record.py to test the limitations of the sampling rate.

I am finding that when I change the acquisition rate of the script from 100 kHz to 500 kHz I get inconsistent outcomes:

  • Sometimes the samples will be collected without issue. This happens about 50% of the time.
  • Sometimes the samples will be collected but I will get "Samples could be corrupted!", "Samples were lost!", or both as warnings. This happens maybe 20% of the time.
  • Sometimes the script will hang because the AD2 stops adding data to the buffer before reaching the 200,000 samples expected. In this case either 191,808 samples or 183,616 samples are collected but no samples are indicated to be corrupted or lost. Seems like one exactly one or two whole buffer's worth of data is vanishing. This happens around 30% of the time.

I attached a slightly modified version of the script to better evaluate the outcome and to prevent it from hanging in the last case.

What is the maximum rate I can reliably stream data continuously? Is there anything I can do to ensure higher sampling rates are more reliable?

analog_in_record_copy.py

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Hi @Noah Faust

Try using another USB port, on a root hub that is not shared with other devices.

The AD2 with 2nd configuration has twice the analog-in (Scope) device buffer/fifo.
# 2nd configuration for Analog Discovery with 16k analog-in buffer
dwf.FDwfDeviceConfigOpen(c_int(-1), c_int(1), byref(hdwf)) 

Depending on the system, the recording should work up to 1-2MHz.

image.png

image.png

Link to comment
Share on other sites

  • 0
8 hours ago, attila said:

# 2nd configuration for Analog Discovery with 16k analog-in buffer
dwf.FDwfDeviceConfigOpen(c_int(-1), c_int(1), byref(hdwf)) 

Thank you for the quick reply! This change substantially improves the maximum sampling rate I can achieve!


After further testing I am finding that the resources of the host computer and competition on the serial bus both impact reliability, as you suggested.

Link to comment
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
×
×
  • Create New...