Introduction: Decoding VGA Signals With a Portable Logic Analyzer

Logic Analyzers are useful tools for viewing, understanding, and decoding digital logic signals. Many allow you to decode common communication protocols, and even communicate with these protocols via a protocol analyzer.

Logic analyzers also come in a variety of sizes, prices and speeds. With the release of the Digital Discovery from Digilent, you can now get a logic analyzer, with sample rates up to 800MS/s for around $250.

This opens up the use of logic analyzers to many more applications. With the Digital Discovery specifically, comes WaveForms 2015 the software that runs the device. With it you can do all the normal functionality of a logic analyzer, and write scripts to decode interfaces that are not automatically included.

In this instructable, I'll use the Digital Discovery + High Speed Adapter to decode a VGA signal into an image. This can be useful when working on a VGA project, to see what signals are being sent correctly or incorrectly, and how they affect the final image. In the logic analyzer window you'll be able to see the VGA signals, and the script will save the resulting image.

Step 1: What You'll Need

Here are all the items you'll need:

- Logic Analyzer with Scripting

In order to complete this project you'll need a portable logic analyzer with sample rates up to 400MS/s and scripting capabilities. I choose the Digital Discovery with the High Speed Adapter. This can reach sample rates up to 800MS/s which is more than enough. It also has a scripting interface that gives access to write scripts using the logic analyzer. Below are all the individual components:

- Digital Discovery

- High Speed Adapter and Cables

- Breadboard

- Associated software

- The Digital Discovery comes with WaveForms 2015 which is free to download. It also allowed me to save the configuration as a WaveForms project so all you have to do is download that and open it. Everything will be configured and the script will be loaded.

- VGA Project

You'll also need a VGA project where the VGA signals included HS, VS, and the 4 bits of all RGB signals are outputted to external pins. The script is currently written for 25MHz pixel frequency, and 480x640 resolution. I used a game of tic tac toe written by GitHub user verdoss, and modified it to output the VGA signals to the Pmod ports on the Nexys 4.

- An image viewer that can open ppm file types.

The script outputs a ppm file, so you'll need something that can open that. I used Ifranview.

You can see my setup with all of the components in the first step.

Step 2: Download the WaveForms 2015 Workspace

Once you get your VGA project up and running, the first thing you'll need to do is download the WaveForms 2015 workspace. This has the logic analyzer open with the correct acquisition settings for a standard VGA spec, the power supply interface set to interprate 3.3V as logic high, and the script editor open with the correct script.

Once it's downloaded, double click to open it.

Then you'll want to run the logic analyzer to capture your data. It will automatically load with my data. Make sure that the window captures on window of data, i.e. the data between to vertical sync windows.

Note: If you don't have the Digital Discovery, you can download WaveForms 2015 and open this interface in DDiscovery Demo mode.

Step 3: Plug the High Speed Adapter Into the Digital Discovery

Next you'll need to setup the hardware.

Plug the High Speed Adapter into the Digital Discovery, and connect 14 High Speed Logic Probes to DIO 0,1, and 4-15.

Step 4: Ground the High Speed Logic Probes

The High Speed Logic Probes reduce noise by grounding each signal, and including a terminating resistor.

Using the breadboard plug all of the black ends of the High Speed Logic Probes into the same node, and connect that same node to your projects ground. In my case I connected this node to the ground pin on one of the Pmod ports.

Step 5: Connect the High Speed Logic Probes to the VGA Signals

Connect the red side of the High Speed Logic Probes to the VGA signals of your project. For me that meant connecting them to the pins on the Pmod ports that I had sent the VGA signals to.

You can see which DIO pins correspond to which VGA pins in the image of the logic analyzer signals I've attached to this step.

Step 6: Double Check That Everything Is Connected Correctly

I always skip this step and I always regret it.

If you are using the same setup as me and you see noise in the horizontal sync or vertical sync signals, something isn't grounded properly, or you have a faulty breadboard wire. I had both of these problems I had to fix.

Step 7: Run the Script

Next go to the scripting interface and run the script. You can see a video of me running the script in this step. It will take a few moments to run, and will be done when the stop button turns back into the run button.

Step 8: Open the Resulting Image

Next you can open the resulting image. The script saves the image to the desktop as img.ppm. I converted this image to a type that instructables recognizes so it can be easily viewed.

You can see that the image that is saved is actually a negative of the original image. You can fix this if you want, but I thought it was pretty neat.

For more uses for the Logic Analyzer on the Digital Discovery, you can check out the tutorials and community projects on the resource center. And of course, follow the Digilent blog for more neat and useful projects.