Jump to content

AlanB

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

AlanB's Achievements

Member

Member (2/4)

3

Reputation

  1. Thanks for the suggestions. With the updated version of the SDK (3.18.50) and the change to param stop-on-close, I can see the expected output from the DigitalDiscovery_PlayRecord.py example as you've shown. I haven't had the same success with DigitalDiscovery_Play.py (yet). However, my original Python scripts appear to have started working again, outputting the expected patterns, so the latest SDK version is the one I'll carry on with.
  2. I can see the same graph when I run your script. I don't see any output on a logic analyzer on the IO lines. Can you confirm which lines (as labelled on the unit) should be being driven using that script?
  3. I have copied line 64 of DigitalDiscovery_Play.py and placed it after the Configure call, as follows: # set play data array of 16 bit samples dwf.FDwfDigitalOutPlayDataSet(hdwf, byref(rgwPlay), c_int(16), c_int(int(nPlay))) print("Starting Digital Out...") dwf.FDwfDigitalOutConfigure(hdwf, c_int(1)) dwf.FDwfDigitalOutPlayDataSet(hdwf, byref(rgwPlay), c_int(16), c_int(int(nPlay))) But I'm still not seeing any output on the output pins. Do I need to use different parameters for the two calls to DataSet?
  4. I've recently come back to my Digital Discovery after a few months away. I installed the latest version of WaveForms (3.18.49) and got started... I tried running my Python script (which I'm sure *used* to work) to load a signal and play it back with Play mode. While it appeared to run without error, I was getting inconsistent output on the pins - usually nothing at all, but I think I once had a garbled version of the output I was expecting. I've gone to try running the example applications to try to understand the problem, and I'm not getting what I expect there either. Running the file "DigitalDiscovery_Play.py" from the SDK examples doesn't appear to give any output at all on the pins (I have a logic analyser connected to most of the pins labelled 24-31). It does print out the following: DWF Version: b'3.18.49' Opening first device Configuring Digital Out... Samples:134217728 Rate:100000000.0Hz Period:1.34217728s Should I expect more than this? Is installing older versions of the SDK likely to be the best route forwards?
  5. @attila Thanks, I understand - I'll keep the rates down in future. My eventual use will likely require longer than the 32kiS limit of the normal mode, so I'm exploring the extents of the Play mode capability at the moment.
  6. As hinted at in: I am seeing an issue where a pattern that is sent to a Digital Discovery for use with Play mode occasionally ends up being corrupted, with a short section of it being repeated over and over. I think this only occurs when also capturing digital signals at higher sampling rates. The attached code is loosely based on DigitalDiscovery_PlayRecord.py, but reordered slightly and switched to use acqmodeSingle1. Viewing the output on an external logic analyser, I can see that it outputs the expected pattern. However, when I increase hzRecord to 400e6, I occasionally get the partial-repeat case - although the total length of the playback is the same as expected. Is anyone seen this before, and able to suggest what I might be doing wrong? test_play_2.py
  7. @attila Awesome, thanks! That was well timed :-)
  8. I have been trying to set up a pattern to play back using Play Mode, and am finding that occasionally (1 time in ~10) I see a corrupted pattern being output. This can manifest in one of a few ways. The first way uses code that I've modified from the DigitalDiscovery_Play.py example. I've shortened the pattern and used FDwfDigitalOutRunSet to ensure that it is only played a single time. The code is as follows: """ DWF Python Example Author: Digilent, Inc. Revision: 2021-09-10 Requires: Python 2.7, 3 """ from ctypes import * from dwfconstants import * import sys import time 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") hdwf = c_int() sts = c_ubyte() version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+str(version.value)) print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) if hdwf.value == 0: print("failed to open device") szerr = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) quit() # dwf.FDwfDeviceParamSet(hdwf, DwfParamOnClose, c_int(0)) # 0 = run, 1 = stop, 2 = shutdown # dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0))# 0 = the device will be configured only when calling FDwf###Configure print("Configuring Digital Out...") hzPlay = 10e6 # for infinite playback fill the entire 256MiByte memory, or 128Mi 16bits samples nPlay = 1*1024 rgwPlay = (c_uint16*int(nPlay))() for i in range(len(rgwPlay)): rgwPlay[i] = i print("Samples:"+str(nPlay)+" Rate:"+str(hzPlay)+"Hz "+" Period:"+str(nPlay/hzPlay)+"s") dwf.FDwfDigitalOutPlayRateSet(hdwf, c_double(hzPlay)) # play sample rate # enable play mode for the wanted signals for i in range(0, 16): dwf.FDwfDigitalOutEnableSet(hdwf, c_int(i), c_int(1)) # enable dwf.FDwfDigitalOutTypeSet(hdwf, c_int(i), c_int(5)) # DwfDigitalOutTypePlay dwf.FDwfDigitalOutIdleSet(hdwf, c_int(i), DwfDigitalOutIdleLow) # set play data array of 16 bit samples dwf.FDwfDigitalOutPlayDataSet(hdwf, byref(rgwPlay), c_int(16), c_int(int(nPlay))) dwf.FDwfDigitalOutRunSet( hdwf, c_double(nPlay / float(hzPlay)) ) print("Starting Digital Out...") dwf.FDwfDigitalOutConfigure(hdwf, c_int(1)) time.sleep(1) dwf.FDwfDeviceCloseAll() This usually gives me a 102.4us burst of output as I would expect. However it occasionally gives me a random-looking output for the first ~12us before becoming the pattern I expect for the remaining time. I can see this corruption using a separate logic analyser connected to the Discovery outputs. Changing the output sample rate changes the period of the corruption - whenever it happens, it appears to be 128 samples of garbage. I have also seen occasions when my pattern repeats - when I output at 10MS/s the repeat happens every 102.4us. At 5MS/s it repeats every 204.8us. This is when I have been generating longer patterns - and they appear slightly corrupted during the some of the repeat. I haven't managed to reproduce my program down to a simple example yet, but hoped it might be connected in some way to the issues from the first example.
  9. @attila ah - that's really interesting. So if I explicitly want to use the same rate for custom patterns for each of my (up-to-)16 outputs, I can have a far longer buffer using Play mode than if I use "normal" mode? In normal mode I can have 32KiS/wire, but in Play mode I can have 128MiS (where each sample contains the bits for all 16 outputs). And none of this depends on shuttling data to over USB mid-pattern? If that's the case, then that helps a lot. And to confirm - this can be used at the same time as using the logic analyser capture in the same way as when generating patterns in normal mode?
  10. Thanks for the references. I'd found them, but they didn't really help me to understand what's going on. The reference manual (https://digilent.com/reference/test-and-measurement/digital-discovery/reference-manual#multi-purpose_digital_io) talks about having 32kSamples/channel when used as a pattern generator. How is play mode different? Is the host streaming the samples? The demo (DigitalDiscovery_Play.py) seems to show the pattern carrying on after the application has closed, so does it have the entire 100M samples stored on the Discovery unit?
  11. I have a Digital Discovery, and can use the SDK to load a 32kSample pattern to be played back as described in the reference manual. The SDK also mentions using Play Mode, and the examples refer to what appear to be much longer buffer sizes. Is there any documentation about how Play Mode works, what sample rates can be achieved, etc? Can I get the full amount of digital capture at the same time? Does it depend on available USB bandwidth to the host? While I can find many references to it being available, I can't find a description of what its capabilities are.
  12. That may not be sufficient for my eventual needs, but it's more than I've got at the moment. Thanks for your help.
  13. I would like to use the digital pattern generator of an Analog Discovery 2 under control of a Python script. It would appear that there is a 1024 sample buffer when used with PP outputs in custom mode. Is there a way to extend this (such as by streaming data to the device from a PC, for example)?
×
×
  • Create New...