Jump to content
  • 0

Problem with aquisition mode Record


Someone

Question

Hello, I have a Digital Discovery here with which I want to record some data.

First question: I tried to query the valid dividers and found that fractal frequencies are possible with the valid dividers being 1, 2, 4, 8 and up. Is that right?

Second question: The DwfState type in the SDK header has state 3 defined twice and state 6 missing. Is this a type or intentionally?

Now my issue: The following code works with a divider of 10 but not with 9 or lower. In the latter case the state stays at DwfStateWait and does not change. Maybe I'm handling the wait state wrong here? I found no sample code that handles this case.

#include <iostream>

using namespace std;

#include <dwf.h>

static const int bufferSize = 2 * 1024 * 1024;
static const unsigned int wantedDivider = 9;

// valid Dividers ok?
// DwfState 3 double and 6 missing?

int main() {
	HDWF hdwf;
	DwfState sts;
	uint8_t *buffer = new uint8_t[bufferSize];
	int availableBytes;
	int lostBytes;
	int corruptedBytes;

	// Open device

	FDwfDeviceOpen(-1, &hdwf);

	// Configure device
	FDwfDigitalInInputOrderSet(hdwf, false);
	FDwfDigitalInSampleFormatSet(hdwf, 8);
	FDwfDigitalInBufferSizeSet(hdwf, bufferSize);

	double hzSys; // Clock should be 800 MHz with 8bit sample format
	FDwfDigitalInInternalClockInfo(hdwf, &hzSys);

	// Valid dividers are: 1, 2, 4, 8-
	FDwfDigitalInDividerSet(hdwf, wantedDivider);

	FDwfDigitalInAcquisitionModeSet(hdwf, acqmodeRecord);

	// Start aquisition

	FDwfDigitalInConfigure(hdwf, false, true);

	// Wait for data

	do {
		FDwfDigitalInStatus(hdwf, 1, &sts);
	} while (sts == DwfStateWait);

	// Read data

	if (sts == DwfStateRunning) {
		FDwfDigitalInStatusRecord(hdwf, &availableBytes, &lostBytes, &corruptedBytes);

		int bytesToRead = min(bufferSize, availableBytes);
		FDwfDigitalInStatusData(hdwf, buffer, bytesToRead);
		cout << "read " << bytesToRead << " bytes." << endl;
	}

	// Stop aquisition

	FDwfDigitalInConfigure(hdwf, false, false);

	// Close device

	FDwfDeviceClose(hdwf);

	delete[] buffer;
	return 0;
}

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • When I do a loop using FDwfDigitalInDividerSet() and FDwfDigitalInDividerGet() I can see that dividers 1, 2, 4, 8 and up are accepted by the hardware (or your library).
  • When doing a measurement with divider 10 I get results which seem to be measured by 80 MHz.
  • But that's not the main point here. When I execute the above example with a wantedDivider of 16 it reads data. When I use a value of 8 FDwfDigitalInStatus() stays in DwfStateWait. That's the problem I need to be solved: Using the record feature with higher frequencies.
Link to comment
Share on other sites

  • 0

but all these examples are with the AD2 not the DD board, are there any c coded examples on the digital discovery board?

I am getting the following error:

Open automatically the first available device

Device open failed

Device not supported. No compatible configuration found. Update Digilent WaveForms.

FDwfDeviceOpenEx

 

when I try to open using "FDwfDeviceConfigOpen"

Edited by ssm
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...