Jump to content
  • 0

Problems using the logic analyzer with Python


Bastien Lemaire

Question

Hello,

 

I have just begun to start using the Digital Discovery and I have been trying to pilot it using Python (I’m also not an expert in Python), but I can’t manage to use the basic function of recording of the logic analyzer.

First, I have used the GUI application WaveForms to check the functions, and the pattern generator and logic analyzer worked without problems.

 

Then, I tried to pilot the device with Python and test the pattern generator and logic analyzer, using the test script showed on the page “Getting Started with WaveForms SDK”, or the script “test_logic-pattern.py” included with the modules on the GitHub page.

 

The scripts worked perfectly, no errors appeared, but when I checked the list containing the sample I got from the function logic.record(), I only have 0.
The pattern.generate() function work normally (in pulse function), I checked the output with an oscilloscope, and I tried several different scenario to see if it would change the samples recovered, but they were always a list of 0 (I changed the pulse frequency, duty cycle, the sampling frequency, buffer size, I tried with one channel for the input and output, and with one channel for each, and tried several different pins).

 

For those tests I used the functions pattern.generate() and logic.record() of the modules contained on the GitHub page, but I also checked the python samples in the WaveFormsSDK directory and created a scritp based on “DigitalIn_Acquisition.py”, which use functions like dwf.FDwfDigitalInStatusData() directly.

This time once again, the device function without sending errors messages, the pulse is generated correctly, but the samples I got are only 0.

It seems like I am just missing a small piece, but I can’t manage to understand what I am missing.

Thank you for your help

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

HI @Bastien Lemaire,

I'm not familiar with the Github implementation (it hasn't been maintained or updated for awhile), but in terms of the built-in DigitalIn_Acquisition.py for the Digital Discovery, you'll need to make sure the correct physical pins are connected.

The DigitalOut and DigitalIO functions 15:0 index corresponding to pins 39:24. The DigitalIn functions correspond to 31:0. There is more specific details in Section 14.4 Digital Discovery (page 142) within WaveForms SDK Reference Manual (which you can quickly get to by clicking on the WaveForms SDK link in the upper right hand corner in the Welcome tab of the application).

image.png

If you're confident that the wires and correct signal names are called in your setup, feel free to attach your script to see if we can reproduce the problem.

Thanks,
JColvin

Link to comment
Share on other sites

  • 0

Hi @JColvin,

 

Thank you for your answer, since then, I have been able to use the FDwfDigitalIn functions to record a signal on the high-speed inputs pin, from 0 to 15 only. 

 

But for some reasons, the logic.record() function (from the test_logic_pattern.py script) still give me only 0, no matter the channel I use (in the script I joined, I used the channel 29, but I also tried to connect it to pin 0 and record channel 0, and I even tried a loop where I used the record function on every channel, but without succes).

 

Thank you for your help

Digital_discovery.py

Link to comment
Share on other sites

  • 0

Hi @Bastien Lemaire,

I'll mention again that the WaveForms SDK material on GitHub is not maintained at this time (that might change in the future if my boss notices that I'm working with the material), but looking at your supplied code the biggest issue (and likely the root of the problem) is that on line 23 in your logic.record function you specify the channel to record on is channel 29, which is incorrect. You actually want to be recording on channel 0 as pin 29 is the IO pin you are outputting your 1 Hz square wave on.

Similarly, the commented out logic.trigger function is also trying to trigger on channel 29 rather than the intended input of pin 0.

The test_logic-pattern.py example from the GitHub page looks like it defines the DIO_OUT pin as 0, which won't work as is because the pattern.generate function always subtracts 24 from the supplied channel number, and there is of course no "-24" pin to use as an output.

Let me know if you have any questions.

Thanks,
JColvin

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