Jump to content
  • 0

Issue configuring AD3 trigger in the Waveforms (C) SDK, and Crosstalk in the AD3


Sam S.

Question

Hi all,

I've been working on a Network Analyzer tool (similar to the one in waveforms) for the past few weeks. My tool uses the Wavegen to output a sine wave, and measures the stimulus and response signals on the two ADC channels. 

Even though I think I'm configuring the AD3 as described in the reference manual, the triggering doesn't seem to be configured properly (I configured the scope to trigger on channel 0, 0V threshold, rising edge, and I've included the output below). Is there something I'm doing wrong?

Also, it seems like there's internal crosstalk at ~-50-60 dB. Does the Waveforms Network Analyzer just subtract it off, or is there something else I'm missing?

	FDwfAnalogInReset(*pd); //Reset the Oscilloscope parameters (it won't trigger here)
    FDwfDeviceAutoConfigureSet(*pd, 0); //Disable AutoConfigure, meaning that we only communicate with the device once to configure it
    //Configure wavegen

	//*DEFAULT_WAVEGEN_CHANNEL is 0 for this example*
    FDwfAnalogOutConfigure(*pd, DEFAULT_WAVEGEN_CHANNEL, false);// stop signal generation
    FDwfAnalogOutNodeEnableSet(*pd, DEFAULT_WAVEGEN_CHANNEL, AnalogOutNodeCarrier, true);
    // set sine function
    FDwfAnalogOutNodeFunctionSet(*pd, DEFAULT_WAVEGEN_CHANNEL, AnalogOutNodeCarrier, funcSine);
    FDwfAnalogOutNodeFrequencySet(*pd, DEFAULT_WAVEGEN_CHANNEL, AnalogOutNodeCarrier, cF); //set frequency
    // Set RMS Amplitude
    FDwfAnalogOutNodeAmplitudeSet(*pd, DEFAULT_WAVEGEN_CHANNEL, AnalogOutNodeCarrier, ext->Wavegen_RMS);
    // Set offset
    FDwfAnalogOutNodeOffsetSet(*pd, DEFAULT_WAVEGEN_CHANNEL, AnalogOutNodeCarrier, ext->Wavegen_Offset);

    FDwfAnalogOutConfigure(*pd, DEFAULT_WAVEGEN_CHANNEL, true);// start signal generation


    //Configure Oscilloscope
    //set offset
    FDwfAnalogInChannelOffsetSet(*pd, ext->Feedback_Channel, ext->ADC_Offset[ext->Feedback_Channel]); //Both offsets are 0, p2p ranges are 5V 
    //set pk2pk input range
    FDwfAnalogInChannelRangeSet(*pd, ext->Feedback_Channel, ext->ADC_P2P_Range[ext->Feedback_Channel]);
    // set offset(2)
    FDwfAnalogInChannelOffsetSet(*pd, ext->DUT_Response_Channel, ext->ADC_Offset[ext->DUT_Response_Channel]);
    //set pk2pk input range
    FDwfAnalogInChannelRangeSet(*pd, ext->DUT_Response_Channel, ext->ADC_P2P_Range[ext->DUT_Response_Channel]);
    //Enable the two oscilloscope channels
    FDwfAnalogInChannelEnableSet(*pd, ext->Feedback_Channel, 1);//CH1
    FDwfAnalogInChannelEnableSet(*pd, ext->DUT_Response_Channel, 1);//CH0
    //Verify that the requested channels are valid
    if (ext->DUT_Response_Channel < 0 || ext->DUT_Response_Channel >= Channels){
#if MEX==1
        mexPrintf("Error in specified DUT_Response channel\n");
#else
        printf("Error in specified DUT_Response channel\n");
#endif
        exit(-1);
    }
    if (ext->Feedback_Channel < 0 || ext->Feedback_Channel >= Channels){
#if MEX==1
        mexPrintf("Error in specified DUT_Response channel\n");
#else
        printf("Error in specified DUT_Response channel\n");
#endif
        exit(-1);
    }

    //Configure the trigger for the device for the zero crossing (rising edge) of the feedback channel
    FDwfAnalogInTriggerSourceSet(*pd, trigsrcDetectorAnalogIn);
    FDwfAnalogInTriggerTypeSet(*pd, trigtypeEdge);
    FDwfAnalogInTriggerChannelSet(*pd, ext->Feedback_Channel);//CH1
    printf("SMS_DEBUGGING -- TRIGGERING ON CH %d\n",ext->Feedback_Channel);
    FDwfAnalogInTriggerLevelSet(*pd, 0.0);
    FDwfAnalogInTriggerConditionSet(*pd, trigcondRisingPositive);
    //FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0);
    //Set the ADC frequency
    if ((ext->Sample_Rate_Hz > minSampleFreqHz) && (ext->Sample_Rate_Hz < maxSampleFreqHz)) FDwfAnalogInFrequencySet(*pd, ext->Sample_Rate_Hz); //Set the Frequency
    else fprintf(stderr, "Requested Frequency outside device range \n");

    FDwfAnalogInBufferSizeSet(*pd, ext->Num_Samples); //Set the Frequency

    //dynamic acquisition mode 4 -- SAMPLE_AV_PERIOD
    if (useAveraging) {
        int fsfilter;
        FDwfAnalogInChannelFilterInfo(*pd, &fsfilter);
        if (IsBitSet(fsfilter, filterAverage)) {
            FDwfAnalogInChannelFilterSet(*pd, -1, filterAverage);
        }
        (void)fsfilter;
    }

    FDwfAnalogInConfigure(*pd, true, true); //Reconfigure the analogIn device
    FDwfAnalogInTriggerAutoTimeoutSet(*pd, 10.0); //Set the auto-timeout to a long time (Debugging: to show that it's not auto triggering)

    // wait "at least 2 seconds"(testing this) for the offset to stabilize, before the first reading after device open or offset/range change
    Wait_S(configTime);

 

Screenshot 2024-04-07 at 9.55.34 AM.png

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @Sam S.

For Network Analysis triggering is usually not important but your trigger settings seems to be ok.
For stability, to not to trigger on opposite edge due to noise, you can use FDwfAnalogInTriggerHysteresisSet.
Better use trigsrcAnalogOut1. The NA interface uses this for coherent averaging.

You could also apply to FDwfAnalogImpedance... functions which can be used for NA, see the example.

Crosstalk depends on the setup. Leaving the high impedance oscilloscope inputs open, specially with wires attached will catch more noise and crosstalk.
Use BNC cables or twist positive/negative inputs and signal wires with ground for better noise rejection and less crosstalk.

image.png 

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