-
Posts
6,668 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Posts posted by attila
-
-
Hi @maling
I run the following code with 10 device for more than 10minutes several times without any problem.
multi.py similar to your GetSpectra()I only got error when disconnecting the USB cable:
At which function it fails for you?
For the error message use print(szerr.value) or cast the C string.from ctypes import * import sys import time from dwfconstants import * if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("libdwf.so") szerr = create_string_buffer(512) def FDwf(fun, args): if fun(*args) == 0: dwf.FDwfGetLastErrorMsg(szerr) print(szerr.value) raise #dwf.FDwfParamSet(DwfParamOnClose, c_int(1)) # 0 = run, 1 = stop, 2 = shutdown cDevice = c_int() dwf.FDwfEnum(c_int(0), byref(cDevice)) print("Devices: "+str(cDevice.value)) hdwfs = [] for k in range(cDevice.value): hdwf = c_int() FDwf(dwf.FDwfDeviceOpen, [c_int(k), byref(hdwf)]) hdwfs.append(hdwf) for k in range(len(hdwfs)): FDwf(dwf.FDwfAnalogImpedanceReset, [hdwfs[k]]) FDwf(dwf.FDwfAnalogImpedanceModeSet, [hdwfs[k], c_int(8)]) # 0 = W1-C1-DUT-C2-R-GND, 1 = W1-C1-R-C2-DUT-GND, 8 = AD IA adapter FDwf(dwf.FDwfAnalogImpedanceReferenceSet, [hdwfs[k], c_double(1e3)]) # reference resistor value in Ohms FDwf(dwf.FDwfAnalogImpedanceFrequencySet, [hdwfs[k], c_double(1e3)]) # frequency in Hertz FDwf(dwf.FDwfAnalogImpedanceAmplitudeSet, [hdwfs[k], c_double(1)]) # 1V amplitude = 2V peak2peak signal FDwf(dwf.FDwfAnalogImpedanceConfigure, [hdwfs[k], c_int(1)]) # start tstart = time.time() sts = c_byte() for j in range(100): # repeat for i in range(100): # steps for k in range(len(hdwfs)): # device print("repeat: "+str(j)+" step: "+str(i)+" dev: "+str(k)) FDwf(dwf.FDwfAnalogImpedanceFrequencySet, [hdwfs[k], c_double(1e3+99e3*i/99)]) # frequency in Hertz # Once you set a value, it will start its measurement routine automatically time.sleep(0.01) for k in range(len(hdwfs)): FDwf(dwf.FDwfAnalogImpedanceStatus, [hdwfs[k], None]) # ignore last capture since we changed the frequency # Read the result from each of the devices, once they complete. for k in range(len(hdwfs)): hdwf = hdwfs[k] while True: FDwf(dwf.FDwfAnalogImpedanceStatus, [hdwf, byref(sts)]) if sts.value == 2: break # Compute the resistance and reactance from the harvested values resistance = c_double() reactance = c_double() FDwf(dwf.FDwfAnalogImpedanceStatusMeasure, [hdwf, DwfAnalogImpedanceResistance, byref(resistance)]) FDwf(dwf.FDwfAnalogImpedanceStatusMeasure, [hdwf, DwfAnalogImpedanceReactance, byref(reactance)]) print("Done with "+str(len(hdwfs))+" devices in "+str(time.time()-tstart)+"s") dwf.FDwfDeviceCloseAll()
-
Hi @Limitha
It is possible to configure it up to 50MHz or the set system frequency / 2.
The FDwfDigitalOutDividerSet specifies the prescaler from 100MHz and FDwfDigitalOutCounterSet the low and high counts.
See the WF SDK manual and the samples/ py/ DigitalOut_Clock.py DigitalOut_Duty.py ... examples -
Hi @davorin
It requires digilent.adept.runtime >= 2.26
https://digilent.com/reference/software/adept/start -
Hi @ca_michelle
The next version will show REJ for rejected broadcast messages.
Thank you for the observation.
-
Hi @CoreZ86
The oscilloscope in a device is one instrument. The scope channels are controlled together, one trigger, same rate... but you can use them for different purpose. The FDwfAnalogInStatus->FDwfAnalogInStatusSample returns the current ADC readings regardless of the capture state.
The wavegen channels are independent instruments.See the following posts:
-
Hi @TheoMaria
As it is in the second example:
If you are using the DAQ do not call FDwfDeviceOpen since the device can be opened only once at a time.
The DAQ will open the device the hdwf will get value 1 and use this in the FDwf functions.I've modified your example: Waveform_Generation2.m
... %% Power Supply % Load library, "hfile" is a variable that points to the location of the library % dummy read to open device data = read(dq, seconds(1)); if ~libisloaded('dwf') loadlibrary('dwf', 'C:/Program Files (x86)/Digilent/WaveFormsSDK/inc/dwf.h'); end if calllib('dwf','FDwfAnalogIOStatus', 1) == 0 % see if device is connected disp('No opened device') return else disp('Enable PS') calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 0, 0, 1.0); % V+ enable calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 0, 1, 5.0); % V+ 5V calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 1, 0, 1.0); % V- enable calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 1, 1, -5.0); % V- -5V calllib('dwf','FDwfAnalogIOEnableSet', 1, 1); % master enable pause(1) % wait to settle end unloadlibrary('dwf') %% Generate a Periodic Waveform and Record Input ...
-
-
Hi @TheoMaria
Probably you are using an old version of WF runtime 3.7.2 which is currently required by the DAQ AD support package.
If you are using the support package this will open the device then the other functions can be called, like this
function DWFtest2(); % make sure daq opens device daqlist("digilent") dq = daq("digilent") ch_in = addinput(dq, "AD1", "1", "Voltage"); [singleReading, startTime] = read(dq) % 32 bit system %hfile = 'C:/Program Files/Digilent/WaveFormsSDK/inc/dwf.h'; %64 bit system hfile = 'C:/Program Files (x86)/Digilent/WaveFormsSDK/inc/dwf.h'; if ~libisloaded('dwf') loadlibrary('dwf', hfile); end if calllib('dwf','FDwfAnalogIOStatus', 1) == 0 % see if device is connected disp('No opened device') else disp('Enable PS') calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 0, 0, 1.0); % V+ enable calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 0, 1, 5.0); % V+ 5V calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 1, 0, 1.0); % V- enable calllib('dwf','FDwfAnalogIOChannelNodeSet', 1, 1, 1, -5.0); % V- -5V calllib('dwf','FDwfAnalogIOEnableSet', 1, 1); % master enable end unloadlibrary('dwf') end
-
Hi @Zeyu
If you don't want to post publicly you could sent a photo with the setup to me in private message, .
Yes, see the DigitalOut_Phase.py example and the parameters can be like this:
-
The TM devices use USB HS (2.0) and the maximum streaming rate is around 1-2MSps.
The ADP3450/3250 has 1G Ethernet providing 1-4MSps. This device can also be used in embedded Linux mode with much higher transfer rate and lower latency.
For embedded/FPGA development system see the Eclypse Z7 with Zmod. -
Hi @TheoMaria
See the following:DWFtest.zip
The server does not allow me to add m code or m file, here you have a picture:calllib('dwf','FDwfParamSet', 4, 0); % DwfParamOnClose continue on Run calllib('dwf','FDwfDeviceAutoConfigureSet', phdwf.Value, 0); calllib('dwf','FDwfAnalogIOChannelNodeSet', phdwf.Value, 0, 0, 1.0); % V+ enable calllib('dwf','FDwfAnalogIOChannelNodeSet', phdwf.Value, 0, 1, 5.0); % V+ 5V calllib('dwf','FDwfAnalogIOChannelNodeSet', phdwf.Value, 1, 0, 1.0); % V- enable calllib('dwf','FDwfAnalogIOChannelNodeSet', phdwf.Value, 1, 1, -5.0); % V- -5V calllib('dwf','FDwfAnalogIOEnableSet', phdwf.Value, 1); % master enable calllib('dwf','FDwfAnalogIOConfigure', phdwf.Value); % configure device
-
Hi @Malcolm
It should be able to measure the phase. The NA can use FFT mag/phase averaging and in the latest beta version added coherent average mode for testing.
See a related post:
-
Hi @Zeyu
The RPI GPIOs are 0/3.3V signals so these won't reach the specified 3.5V trigger level, reduce this to 1.5V.
You could also generate the square signal with the other Wavegen channel or with any DIO 0/3.3V clock/pulse signal. -
Hi @LiamP
What do you mean by "DC offset to trigger" ?
For each instrument it can be specified the trigger slope, like rising, falling or either edge of external trigger, or wavegen rise when this starts and fall when stops.
FDwfAnalogInTriggerConditionSet, FDwfAnalogOutTriggerSlopeSet, FDwfDigitalInTriggerSlopeSet, FDwfDigitalOutTriggerSlopeSet -
Duten tag @Fonso!
Yes, the Ethernet phy provides isolation as well a WiFi dongle.
For USB external isolator can be used. The cheaper ones, based on ADUM4160 are USB FS and will reduce the transfer rate. This will be mostly noticeable when streaming data, when using Scope/Logic record and Wavegen play modes.Isolation is recommended for safety when using multiple socket powered instrument and to reduce ground loops that could cause ringing, oscillation... in measurements.
A self/battery powered tool is isolated so it is safe to use. -
Hi @maling
It would be great if you could provide a description or code/script to reproduce the issue.
The timeout failure should set some error message "API lock timeout", "Device lock timeout",...
-
Hi @reddish
The bitPerSample specifies the sample size, the number of DIO channel to control. Like 1: will output on DIO-0 the given bit array, 2: groups of 2 bits on DIO-0-1, ...
-
Hi @Zeyu
I've set to trigger and capture the same channel 2 to verify the trigger correctness.
You can get the data from the channel 1 as well:
dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), byref(rgSamples1, sizeof(c_int16)*iSample), c_int(iBuffer), c_int(cSamples)) # get channel 1 data
dwf.FDwfAnalogInStatusData16(hdwf, c_int(1), byref(rgSamples2, sizeof(c_int16)*iSample), c_int(iBuffer), c_int(cSamples)) # get channel 2 data
-
-
Hi @LiamP
Similar as it is done in the Device_Synchronization.py example, first configure each input and output channels (or the needed ones) in each device, and arm them, wait each to finish and get the data.
for iDevice in range(cDevice.value): # open and configure dwf.FDwfDeviceOpen(c_int(iDevice), byref(hdwf)) ... rghdwf.append(hdwf.value) dwf.FDwfAnalogIn... # configure range, offset... for channels, frequency, trigger position... dwf.FDwfAnalogInTriggerSourceSet(rghdwf[iDevice], trigsrcExternal1) dwf.FDwfAnalogInConfigure(rghdwf[iDevice], c_bool(False), c_bool(True)) # arm inputs dwf.FDwfAnalogOutCount(hdwf, byref(cChannel)) for iChannel in range(cChannel.value): dwf.FDwfAnalogOut... # configure signal, amplitude, offset... run length... dwf.FDwfAnalogOutTriggerSourceSet(rghdwf[iDevice], c_int(iChannel), trigsrcExternal1) dwf.FDwfAnalogOutConfigure(rghdwf[iDevice], c_int(iChannel), c_bool(True)) # arm outputs while True: # wait for each device capture fDone = True for iDevice in range(len(rghdwf)): dwf.FDwfAnalogInStatus(rghdwf[iDevice], c_int(0), byref(sts)) if sts.value != dwfstateDone fDone = False break if fDone: break for iDevice in range(len(rghdwf)): # fetch and get data dwf.FDwfAnalogInStatus(rghdwf[iDevice], c_int(1), None) dwf.FDwfAnalogInChannelCount(rghdwf[iDevice], byref(cChannel)) for iChannel in range(cChannel.value): dwf.FDwfAnalogInStatusData(rghdwf[iDevice], c_int(iChannel), ... dwf.FDwfDeviceCloseAll()
-
Hi @ca_michelle
1. Could it be the "Start interpreter form here" was set to T0 ?
Try right click and "Reset starts"2. You could use Record mode to capture up to 100M samples in Logic Analyzer.
The Protocol/CEC is on the to-do list. -
Hi @tmk2z
Each device is calibrated during the factory testing process. This should provide suffice precision but if you want you can recalibrate it with the WF app.
-
-
Hi @bitstre@m
In the next software version workspaces/projects will remember the expanded/collapsed state of groups (Bus, SPI...)
Thank you for the observation.
Analog Discovery 2 on Raspberry Pi 4 with Windows 11 (ARM64)
in Test and Measurement
Posted
Szia @Andras
The software is not available natively for Windows ARM64, only for Windows 32/64bit, Linux 32/64 bit intel/arm (x86, amd64, armhf, arm64) and MacOS 32/64.
It is also working with MacOS M1/ARM seamlessly with emulation.
As I read, Windows ARM also provides intel emulation:
https://blogs.windows.com/windows-insider/2020/12/10/introducing-x64-emulation-in-preview-for-windows-10-on-arm-pcs-to-the-windows-insider-program/
The error is complaining about "Visual C++ Redistributable for Visual Studio 2015".
This is included in the WF installer but WinARM may need a different variant. Please try installing it manually:
https://www.microsoft.com/en-us/download/details.aspx?id=48145
https://answers.microsoft.com/en-us/windows/forum/all/unable-to-install-programs-due-to-vcruntime140dll/3a9cba87-6dfd-4591-94d6-08c347e2db39