top of page
Writer's pictureAdam Taylor

MicroZed Chronicles: Debugging with Analog Discovery & Python

One of the things I want to take a look at over the next few blogs is how we can use test equipment and ILAs in more advanced use cases to help debug and commission our FPGA developments. Over the next few weeks, we’ll be looking at how to generate and capture waveforms from FPGAs using the Digilent Analog Discovery range of devices and how we can capture and post process ILA information using Vivado.

The objective is as follows:

 

  1. Generate waveforms using Python via Analog Discovery

  2. Capture waveforms using the ILA and post process the data so it can be injected it into test benches

  3. Capture signals using the Analog Discovery and post process them using Python so the signals can be applied to a test bench

 

First, I am going use the Digilent Analog Discovery 3 (AD3) but instead of using it via its normal interface, we are going to use it via its Python interface. We are able to generate and receive signals using this interface.

 

I am going to create Jupyter Notebooks for these examples to demonstrate how simple the process is. If you don’t have Jupyter installed on your machine, you’ll need to first install it using the following command.

 

pip install jupterlab

 

We can then open JupyterLab using the command jupyter lab in a command terminal.


Everything we needed to get started working with Analog Discovery in Python is installed when we install waveforms. This includes the interface we will be using called waveforms SDK, the libraries, and many examples.

 

Using Jupyter enables me to document the application which drives the Analog Discovery instrument in step-by-step detail. You will find the notebook here.

 

To get started using Python and Jupyter, we first need to copy the file dwfconstants from the wavefromsSDK samples directory into your project working directory.

Once this has been copied in, we are able to start working with Python and the Analog Discovery 3. The process is pretty simple and the first thing we need to do is load in the libraries we want to use. Many of the interactions with the commands to control the Analog Discovery use ctypes. These are the types commonly used in C and can include integer and double among others. This ensure that the values are in the correct format and size.

 

The next step is to load in the library from the installation directory depending on the operating system we are using. We can then connect to the device and configure the digital output as desired. In this example, we are going to generate a clock signal and a simple bus of data which counts. The exact steps and commands are documented within the Jupyter Notebook.

 

Once the notebook was completed, I first checked the output using a scope. You can loop back on the AD3 but I wanted to be sure the signals left the device.

The next step was to design a simple hardware design for the PYNQ-Z2. I selected this board because it has the RPI header so I could easily connect the AD3 to the device. The implemented design was very simple and uses a GPIO to receive the signals. I have two GPIOs; one for the counter bus and another for the clock input. I have connected an ILA with two inputs to both GPIOs which enables me to trigger on the rising edge of the clock edge and capture the count on the bus.


The ILA waveforms can be seen below which shows the full count being captured as inserted by the Analog Discovery.



This shows how we can use the AD3 to stimulate waveforms into our FPGA designs. We can use this Jupyter notebook to create a more complex interactions now and also leverage Python to generate the data.


Workshops and Webinars


If you enjoyed the blog why not take a look at the free webinars, workshops and training courses we have created over the years. Highlights include



Embedded System Book   


Do you want to know more about designing embedded systems from scratch? Check out our book on creating embedded systems. This book will walk you through all the stages of requirements, architecture, component selection, schematics, layout, and FPGA / software design. We designed and manufactured the board at the heart of the book! The schematics and layout are available in Altium here   Learn more about the board (see previous blogs on Bring up, DDR validation, USB, Sensors) and view the schematics here.



Sponsored by AMD








0 comments

Recent Posts

See All

コメント


bottom of page