Post Go back to editing

ADALM2000 digital trigger

Category: Software
Product Number: ADALM

I'm using ADALM2000 with libm2k and I want to use digital trigger TI instead of analog.

Example code is like following:

#ifdef TRIGGERING
    // setup analog trigger
    trig->setAnalogSource(CHANNEL_1);
    trig->setAnalogCondition(0,RISING_EDGE_ANALOG);
    trig->setAnalogLevel(0, 0.25);
    trig->setAnalogDelay(0);
    trig->setAnalogMode(0,ANALOG);
#endif

I have replaced it with

trig->setDigitalSource(SRC_TRIGGER_IN);

It does not work like I hoped. How to setup Digital trigger (TI) with c++/libm2k?

Parents
  • trig->setAnalogMode(0,EXTERNAL);

    trig->setAnalogSource(SRC_DIGITAL_IN);

    I think this works.

    -Adrian

  • For some reason trigger does not work like I hope. I'm using second analog output to generate trigger pulse. First analog output is transmitting my signal. I'm trying to capture signals using analog inputs. I have connected TI to second analog output. Currently, I'm getting trigger, but I think the source is not TI, since position on my trigger pulse is not fixed and there is some delay in received signal.

    My code is following:

    	M2kAnalogIn *ain = ctx->getAnalogIn();
    	M2kAnalogOut *aout = ctx->getAnalogOut();
    #ifdef TRIGGERING
    	M2kHardwareTrigger *trig = ain->getTrigger();
    #endif
    
    	// Prevent bad initial config
    	ain->reset();
    	aout->reset();
    
    	ctx->calibrateADC();
    	ctx->calibrateDAC();
    
    	// Setup analog in
    	ain->enableChannel(0, true);
    	ain->enableChannel(1, true);
    	ain->setSampleRate(10000000);
    
    	ain->setRange((ANALOG_IN_CHANNEL)0,PLUS_MINUS_2_5V);
    	ain->setRange((ANALOG_IN_CHANNEL)1,PLUS_MINUS_25V);
    
    
    #ifdef TRIGGERING
    
    	
    	
    	trig->setAnalogMode(0,EXTERNAL);
    	trig->setAnalogSource(SRC_DIGITAL_IN);
    
    #endif
    
    	// setup analog output
    	aout->setOversamplingRatio(0,15);
    	aout->setOversamplingRatio(1,15);
    	aout->setSampleRate(0,75000000);
    	aout->setSampleRate(1,75000000);
    	
    	
    	aout->enableChannel(0, true);
    	aout->enableChannel(1, true);
    
    	aout->setCyclic(false);
    	
            ain->startAcquisition(samples);
    	aout->push({tx_data,tr_data});
    	auto rx_data = ain->getSamples(samples);
            ain->stopAcquisition();

    Output looks like this (blue first channel, orange second channel(TI)):

  • Hello,

    To correctly configure the TI pin as a trigger source for the analog input you need the following:

    #ifdef TRIGGERING
    	// setup analog trigger
    	trig->setAnalogSource(SRC_DIGITAL_IN ); //  trigger events on the DigitalIn interface trigger the AnalogIn interface
    	trig->setAnalogMode(0, EXTERNAL); // Trigger condition at channel 0 is specified only by external trigger (TI)
    	trig->setAnalogMode(1, EXTERNAL); // Trigger condition at channel 1 is specified only by external trigger (TI)
    	trig->setDigitalExternalCondition(RISING_EDGE_DIGITAL); // Trigger condition for TI pin
    #endif

    You were missing the trigger condition for the TI pin.

Reply Children
No Data