UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Adam Taylor’s MicroZed Chronicles, Part 122: Embedded vision Kit 7 Inch Touch Screen Software

by Xilinx Employee ‎03-14-2016 09:32 AM - edited ‎03-14-2016 10:34 AM (13,951 Views)

 

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.

 

 

Image1.jpg 

 

 

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:

 

 

 

 

Image2.jpg

 

 

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:

 

 

 

Image3.jpg

 

 

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:

 

 

 

Image4.jpg

 

 

 

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.

 

 

Image5.jpg

 

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.

 

 

Image6.jpg

 

 

 

 

 

 

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.

 

 

 MicroZed Chronicles hardcopy.jpg

 

 

 

  • Second Year E Book here
  • Second Year Hardback here

 

 

 

 MicroZed Chronicles Second Year.jpg

 

 

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

 

 

 

Labels
About the Author
  • Be sure to join the Xilinx LinkedIn group to get an update for every new Xcell Daily post! ******************** Steve Leibson is the Director of Strategic Marketing and Business Planning at Xilinx. He started as a system design engineer at HP in the early days of desktop computing, then switched to EDA at Cadnetix, and subsequently became a technical editor for EDN Magazine. He's served as Editor in Chief of EDN Magazine, Embedded Developers Journal, and Microprocessor Report. He has extensive experience in computing, microprocessors, microcontrollers, embedded systems design, design IP, EDA, and programmable logic.