Jump to content
  • 0

Analog Discovery 3 Waveform Sync


diligent1

Question

Hello Digilent Forum!

We are experimenting with the Analog Discovery 3 board and trying to get multiple waveforms locked and synchronized together from a sync pulse however we are having jittering between the output pulses.

They look to be sequential?

Do you have any pointers/ common mistakes people make whilst doing this?

Many thanks!

 

waveforms1.jpg

waveforms2.jpg

Edited by diligent1
Link to comment
Share on other sites

Recommended Posts

  • 0
On 7/18/2024 at 8:39 PM, attila said:

Hi @diligent1

You could use custom waveform, like [1,0,1,0,0,1,0,0,1,...] set the frequency to 1kHz/steps which will generate [Amplitude+Offset for 1ms, O for 2ms, A+O for 1ms, O for 3ms...]
Or if you want finer delay between pulses [1,1,0,0,0,1,1,....] freq to 2kHz/steps [A+O 1ms, O 1.5ms,...] make sure the number of steps does not exceed the AWG device buffer size, 16k with first and 32k with 3rd configuration. Use funcCustomPattern for fixed sample period, funcCustom is for more precise waveform frequency.

Hi @attila. Is it possible to just set the amplitude for a channel in a loop and scale this way? Using amplitudeset and configure? When I do this - the waveforms don't turn on until the last iteration of the loop.

Link to comment
Share on other sites

  • 0

Hi @diligent1

Yes
dwf.FDwfDeviceAutoConfigureSet(hdwf, 0) # the device will only be configured when FDwf###Configure is called
...
dwf.FDwfAnalogOutConfigure(hdwf, channel, 1) # start
...
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(vAmplitude))
dwf.FDwfAnalogOutConfigure(hdwf, channel, 3) # apply new configuration without changing state

Link to comment
Share on other sites

  • 0
5 hours ago, attila said:

Hi @diligent1

Yes
dwf.FDwfDeviceAutoConfigureSet(hdwf, 0) # the device will only be configured when FDwf###Configure is called
...
dwf.FDwfAnalogOutConfigure(hdwf, channel, 1) # start
...
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(vAmplitude))
dwf.FDwfAnalogOutConfigure(hdwf, channel, 3) # apply new configuration without changing state

Thanks, @attila. When I try to configure 2 devices within the loop - I lose synchronization of the devices. So I am using:

for i in range x:

    dwf.FDwfAnalogOutNodeAmplitudeSet(1, -0, AnalogOutNodeCarrier, i)

    dwf.FDwfAnalogOutConfigure(1, -1, 1) (USING 1 instead of 3 because 3 doesn't seem to give me an output)

    dwf.FDwfAnalogOutConfigure(2, -1, 1)

I am having to address the devices directly rather than using the hdwf variable in the synchronization because it gets stuck on one hdwf value and doesn't update the other device but because I am doing this - there is jitter between the devices. Is there something I can do with the trigger to sync them again?

Thank you!

Link to comment
Share on other sites

  • 0

Hi @diligent1

Make sure to use the following scheme and not -1  which reconfigures all enabled analog-out channels of the device.

On 7/31/2024 at 11:38 AM, attila said:

dwf.FDwfDeviceAutoConfigureSet(hdwf, 0) # the device will only be configured when FDwf###Configure is called
...
dwf.FDwfAnalogOutConfigure(hdwf, channel, 1) # start
...
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, AnalogOutNodeCarrier, c_double(vAmplitude))
dwf.FDwfAnalogOutConfigure(hdwf, channel, 3) # apply new configuration without changing state

Also, I don't understand what timing do you expect from your loop.

Link to comment
Share on other sites

  • 0
5 hours ago, attila said:

Hi @diligent1

Make sure to use the following scheme and not -1  which reconfigures all enabled analog-out channels of the device.

Also, I don't understand what timing do you expect from your loop.

Thanks @attila. Sorry the "-" was a typo in my last post. I am only updating 1 of the analog out channels. 

I am trying to output 4 independent waveforms from 2 analog discovery 3 devices. 

I want all 4 to be in sync but I also want to scale 1 of the outputs from 1 to -1. I've achieved this using your amazing advice using the AMnodeout however this doesn't give me control of the output in the loop. It is just like "pressing play" rather than stepping through a loop.

So I want to scale the amplitude of one of the outputs in a for loop and trigger all the outputs and read the outputs back into the inputs all simultaneously.  

So:

- output 4 waveforms from 2 devices synchronously

- scale one of the outputs from 1 to -1 

- synchronously read all the outputs back into the inputs and display the data. 

I have achieved all of these things independently but putting it all together is proving difficult 

Thanks for your continued support on this! 

Link to comment
Share on other sites

  • 0
5 hours ago, attila said:

Hi @diligent1

See the following: AnalogOut_Devices2.py

image.png

@attila this is absolutely perfect. Exactly what we wanted. Thank you. The outputs are all absolutely synced.

We tried to add in a piece for the input sync, too. However we are still experiencing some jitter. DO you have any advice to help? Here is the code:

"  for i in range(cSteps) :

     
        dwf.FDwfAnalogOutNodeAmplitudeSet(1, 0, AnalogOutNodeCarrier, c_double(-(1.0-2.0*i/(cSteps-1))))      
            
        for iDevice in range(len(rghdwf)):
            hdwf.value = rghdwf[iDevice]

            dwf.FDwfAnalogOutConfigure(hdwf, 0, 3)
            dwf.FDwfAnalogInConfigure(hdwf, -1, 3) 

            dwf.FDwfDeviceTriggerPC(1)           


            while True:
                dwf.FDwfAnalogInStatus(hdwf, c_int(-1), byref(sts))
            
                if sts.value == 2 : # DwfStateDone
                    break
            
            dwf.FDwfAnalogInChannelCount(hdwf, byref(cChannel))
            for iChannel in range(0, cChannel.value):
                dwf.FDwfAnalogInStatusData(hdwf, c_int(iChannel), rgdSamples, c_int(csamples)) # get channel 1 data
                
    
                plt.plot(np.fromiter(rgdSamples, dtype = float))
        
        plt.show()

 

"

 

Thanks again!
        
        
       

Link to comment
Share on other sites

  • 0

Hi @diligent1

See the following: AnalogOutIn_Devices.py

If the trigger is output for the 'master' device and input for the 'slaves' these will receive it with 1 clock cycle delay, 10ns @ 100MHz. This can be compensated with FDwfAnalogOutWaitSet FDwfAnalogInTriggerPositionSet(... x - 10e-9) 
The FDwfDeviceParamSet(... DwfParamFreqPhase x) adjust the clock phase. AD3 @ 100MHz provides 6 phases, 60deg, 1.666ns steps, which can be set with values of X*60*1000.
In the following setup 300* was the best option. The analog-in/out are mixed between devices: D1C1-D2W1, D1C2-D1W2, D2C1-D2W2, D2W2-D1W1

image.png

image.png

image.png

Link to comment
Share on other sites

  • 0
On 8/6/2024 at 10:46 AM, attila said:

Hi @diligent1

See the following: AnalogOutIn_Devices.py

If the trigger is output for the 'master' device and input for the 'slaves' these will receive it with 1 clock cycle delay, 10ns @ 100MHz. This can be compensated with FDwfAnalogOutWaitSet FDwfAnalogInTriggerPositionSet(... x - 10e-9) 
The FDwfDeviceParamSet(... DwfParamFreqPhase x) adjust the clock phase. AD3 @ 100MHz provides 6 phases, 60deg, 1.666ns steps, which can be set with values of X*60*1000.
In the following setup 300* was the best option. The analog-in/out are mixed between devices: D1C1-D2W1, D1C2-D1W2, D2C1-D2W2, D2W2-D1W1

image.png

image.png

image.png

@attila, thanks! This looks great. Much appreciated.

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