Jump to content
  • 0

Record mode polling


christian

Question

Hi,

We have an application here for the Analog Discovery where we repeatedly want to stream out a large dataset of the 16 digital channels, e.g. >= 10 s @ min. 1 MS/s (>= 5 MS/s would be best). That somewhat works now using the Record mode in the Windows SDK by polling the driver with the FDwfDigitalInStatus/FDwfDigitalInStatusData calls for flushing the device sample buffer over USB.

The issue here is that setting the device configuration to the 16 ksamples option for the logic, we have less than approx. 16 ms between driver calls @ 1 MS/s if we want to avoid overflowing the device sample buffer. That’s right down there where interruption from the Windows scheduler, and not USB bandwidth (assuming USB 2.0 Hi-Speed mode), begins to determine if the buffer overflows or not. We would welcome some option to have the driver keep stuffing USB packets down the line so the device has plenty of “slots” available to insert data, and then have the device notify back when it has transmitted all the data in the record, or timeout etc.

Apologies if this is already available and we’re just not using the SDK right. If not, it seems to us that it would greatly increase the value of the part if it wasn’t limited by the driver like this.

Thank you and best regards

Christian

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hi @christian

The polling is the only available solution. I think this is the only cross-platform and cross-programming language option. The callbacks would be harder to use and unsafe. For sophisticated applications the polling can be executed in a background thread.
The USB connection/endpoint is shared by multiple instruments so background transfer is not really possible.
I'm working on improving the digital recording with data compression. I hope to have a beta release with this in a few days.

Link to comment
Share on other sites

Hi @attila,

I've tried the new beta, and I can now use the Record mode at 10 MS/s in the WaveForms app. without issues, nice job!

With regards to using the SDK: in the latest stable release, the sum of the number of available samples returned by FDwfDigitalInStatusRecord would match what I set using FDwfDigitalInTriggerPositionSet. In the latest beta, the samples just seem to keep coming. Is the correct procedure to just ignore excess samples?

Edit: I'm having trouble replicating the results from the WaveForms app. using the SDK. Is there anything I need to do to enable compression?

Thanks,

Christian

Link to comment
Share on other sites

Hi @christian

The following function enables compression and looks for transitions on the selected lines:
DWFAPI BOOL FDwfDigitalInSampleSensibleSet(HDWF hdwf, unsigned int fs);

With this you should specify the used lines like:
dwf.FDwfDigitalInSampleSensibleSet(hdwf, c_int(0xFFFF)) // all 16 DIOs
dwf.FDwfDigitalInSampleSensibleSet(hdwf, c_int(0x0003)) // using only DIO-0 and 1

Here you have an example with data compression DigitalIn_Record_Compress.py

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...