By Adam Taylor

When we last looked at this touch-screen project, we had the hardware up and running and we were driving the 7-inch display of the Avnet MicroZed Embedded Vision Kit. Now we just need to update our software so that we can display an image on the screen.

The first thing we need to do is configure the test pattern generator and VDMA for the new frame size. We do this using the XV_TPG.h and XAIVDMA.h files provided by the BSP we generated for the hardware build we are using.

First we set the test pattern generator to have a height and width of 800 by 480. We also need to set the color space to RGB and the background pattern to be the color bars.

With these parameters set, the next step is to enable the auto restart. Doing that will automatically regenerate frames. The final step is to enable the test pattern generator which starts frame generation.

We use the ILA attached to the AXI output stream from the test pattern generator in Vivado (when the test pattern was set to color bars) to monitor the activinty on chip. Starting the test pattern results in the following output waveform:

The next step is to set up the VDMA once again. We will use the VDMA API, making this task a simple case of setting the new size of the frame:

Then we must configure the video timing generator. Like any peripheral within the Xilinx embedded sphere, we must first look up the configuration of the VTC and initialize that instance using the functions provided within XVTC.h.

This header file also contains a number of function definitions and types that we use to interface and command the VTC. There are functions used for both the reception and generation of video timing. We will focus on generation, having already disabled reception.

The first thing we need to do is configure the horizontal and vertical timing parameters. This we achieve by using the XVtc_SetGenerator function. This function allows us the use a structure defined within XVTC.h called XVtc_timing to define the required parameters:

The timing parameters I am using for this build are as follows:

Horizontal Sync Polarity = 0

Horizontal Active Video = 800

Horizontal Front Porch = 40

Horizontal Sync Width = 128

Horizontal Back Porch = 88

Vertical Active = 480

Vertical Front Porch = 8

Vertical Sync Width = 2

Vertical Back Porch = 35

Before we can enter these parameters using the function provided, we must configure the source of the registers being either the generator or the detector. We can use the XVtc_SourceSelect structure to define that we are using the generator. Setting this value to 1 defines generator 0 detector.

We can now write our source selection to the VTC using the XVtc_SetSource() function.

Once we have completed this, all we need to do is enable the VTC and then examine the test pattern upon the screen.

The code is available on Github as always.

If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.

First Year E Book here

First Year Hardback here

Second Year E Book here

Second Year Hardback here

You also can find links to all the previous MicroZed Chronicles blogs on my own Web site, here.