Jump to content
  • 0

Question about Oversampling with Python Scripts


Caleb Messerly

Question

Hello Digilent Forums,

I am working a project using the WF SDK version 3.22.2 (manual linked here). I am in the process of writing a python script using the SDK for my ADP3450 (Analog Discovery Pro) to record an external signal on the device using the device oscilloscope. Additionally, I would also like to utilize the oversampling feature of the device.

To confirm my device was capable of oversampling, I opened the Waveforms GUI and opened the oscilloscope feature. I set the sample rate to 1Mhz, set the "Overs" setting to 1, and recorded via the "Single" play button, with a function generator providing the signal source. The exported results indicated that 32,768 samples were taken, consistent with the device configuration I was using. I then performed the same test with the Overs setting set to 2. Upon inspecting those results, the oscilloscope captured the same number of oscillations but had double the datapoints in the result. From this, I concluded that the device successfully oversampled the signal.

My error came with attempting to run the test using Python scripting. I opened the file AnalogIn_Acquisition.py, as it used acqmodeSingle and I figured I could simply change it to acqmodeOvers and observe and compare the results to the default from the file and learn from those. I set it on single mode and ran it on a signal from my function generation, seeing the signal correctly. I added a line I found the API referenced called dwf.FDwfAnalogInAcquisitionModeSet (page 26), used for setting the acquisition mode of the device. I set that to acqmodeOvers, and called dwf.AnalogInConfigure(...) to configure the scope. This appeared to work, as immediately calling dwf.FDwfAnalogInAcquisitionModeGet returned a 4, which matches the acqmodeOvers setting. 

However, the results I am getting appear to be identical to the results when acquisition mode is simply set to acqmodeSingle. I've tried pulling more values using dwf.FDwfAnalogInStatusData(), I've tried exporting the data in CSVs and examining for differences there, and other methods. Am I using the Oversampling feature in Python wrong? Is my device perhaps not enabled for oversampling when using the python scripting features? 

Attached below is the script that I am using. 

AnalogIn_Acquisition.py

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @Caleb Messerly

The oversampling and averaging, the overlaying of multiple captures is performed in the WaveForms application.
The oversampling capture mode only shifts consecutive captures (ADC samples) by 90*, 2.5ns @ 100MHz system frequency. This, to ensure the signals generated by the same device, even if are in phase with the capture can be oversampled at least by 4x.

image.png.

image.png

 

Link to comment
Share on other sites

  • 0
On 9/13/2024 at 3:40 PM, attila said:

The oversampling capture mode only shifts consecutive captures (ADC samples) by 90*, 2.5ns @ 100MHz system frequency. This, to ensure the signals generated by the same device, even if are in phase with the capture can be oversampled at least by 4x.

On 9/13/2024 at 3:40 PM, attila said:

The oversampling and averaging, the overlaying of multiple captures is performed in the WaveForms application.

 

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...