Jump to content
  • 0

Analog Discovery 2 Trigger Setup Limitation --> 15ms?


Daniel Rech

Question

Hi,

I wrote a small programm to test the speed limitations of triggering and I have a problem:

After collecting data the setup for the next trigger takes 15ms.

 

The application I'm building requires to capture 10ms of data with 100000 Hz, so I want to capture 1000 samples. After that I only have 10ms to setup the next trigger.

The programm collects all the triggers with not too many samples. But if I capture more than 500 samples (5ms) then I start missing triggers. What can I do to do this high speed data acquisition with the Analog Discovery 2?

 

This is the cpp-Code I use:

 

#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "sample.h"

int bufferSize = 500;
// int bufferSize = 600;
// int bufferSize = 1000;

int terminate = 0;
void my_handler(int s) {
    terminate = 1;
}

int main(int carg, char **szarg) {
    signal (SIGINT, my_handler);

    HDWF hdwf;
    STS sts;

    printf("Open automatically the first available device\n");
    if(!FDwfDeviceOpen(-1, &hdwf)) {
        printf("Device open failed");
        return 0;
    }

    FDwfAnalogInFrequencySet(hdwf, 100000.0);
    FDwfAnalogInBufferSizeSet(hdwf, bufferSize);

    FDwfAnalogInChannelEnableSet(hdwf, 0, true);
    FDwfAnalogInChannelRangeSet(hdwf, 0, 4.99);

    // disable auto trigger
    FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0);
    // one of the analog in channels
    FDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1);
    FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge);
    FDwfAnalogInTriggerChannelSet(hdwf, 1);
    FDwfAnalogInTriggerLevelSet(hdwf, 1.5);
    FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive);
    // wait for the offset to stabilize
    Wait(2);

    printf("Starting repeated acquisitions:\n");
    int iTrigger;
    for(iTrigger = 0; iTrigger < 200; iTrigger++){
        // begin acquisition
        FDwfAnalogInConfigure(hdwf, false, true);

        while(true){
            FDwfAnalogInStatus(hdwf, true, &sts);
            if(sts == DwfStateDone) {
                break;
            }
            if (terminate == 1) {
                break;
            }
        }
        if (terminate == 1) {
            break;
        }
    }
    printf("#%i\n", iTrigger+1);
    FDwfDeviceCloseAll();
}

 

Compile it with

gcc -ldwf trigger.c && ./a.out

 

It waits for triggers on external trigger source 1.

 

The only way I see to solve this is to not care about triggers and capture the whole signal but I would really like to solve it in a nice way.

Thank you for your replies :)

Daniel

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Hello,

Starting with the WaveForms version 3.3.x the single mode acquisitions are automatically rearmed after done status with data read option.
This way, without the need to re-configure you should gain a few millisecond sparing for repeated acquisitions.

printf("Starting repeated acquisitions:\n");
FDwfAnalogInConfigure(hdwf, false, true);

int iTrigger;
for(iTrigger = 0; iTrigger < 200; iTrigger++){

  while(true){
    FDwfAnalogInStatus(hdwf, true, &sts);
    if(sts == DwfStateDone) {
 	  // analog in is rearmed for next acquistion
      break;
    }
  }
  FDwfAnalogInStatusData(hdwf,...
  ...

 

On the other hand, at 100kHz you should be able to record a large number of samples for further processing.

Link to comment
Share on other sites

Hi Attila, 

How  can we expect the system to behave if it is configured with both: 

FDwfAnalogInConfigure(hwdf, c_bool(True), c_bool(True))

FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0)

This seems to be contradictory by enabling the auto-trigger in the ...Configure command, then disabling the auto-trigger in the ...TimeoutSet command.

Thanks!

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...