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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Moderator
Moderator
1,451 Views
Registered: ‎11-09-2015

Video Series 20: Starting with SDK and configuring the ADV7511

 

Introduction

 

This Video Series 20 shows how to start with SDK and how to configure the ADV7511 on the ZC702 to be able to use the on-board HDMI.

 

1.png

 


Summary

 

1. Tutorial – Starting with SDK and Configuring the ADV7511

2. What Next?

 


 

Tutorial – Starting with SDK and Configuring the ADV7511

Create the Xilinx SDK workspace

  1. Download the tutorial files and unzip the folder

  2. Open Xilinx SDK 2018.1

  3. When asked for the workspace directory, select the folder sdk_workspace from the extracted folder

    2.png

     

First, we need to create the Hardware Platform, which will describe our Hardware, using the hdf file we have exported from Vivado in the previous Video Series 19. Note that this step is done automatically by the tool if you launch SDK from Vivado (after exporting the hdf file)

 

  1. Click on File > New > Others…, then select Hardware Platform Specification under Xilinx and click Next

 3.png

 

  1.  Select the hdf file in XVES_0020/sdk_export and click Finish

 

4.png

 

Run the first application

The first thing I do when starting a SDK project is to start by testing the board with a simple hello world program

  1. Click on File > New > Application Project. Enter hello_world as project name and click next

 5.png

 

  1.  Select the Hello World template and click Finish

 6.png

  1.  On your computer, install a UART tool as tera term

  2. Connect the micro USB cable from the host PC to the USB JTAG connector (U23) on the ZC702 and the mini USB cable from the host PC to the USB UART connector (J17).
  3. Set the boot mode jumpers to JTAG (SW16) by setting all switches to the OFF position

 

7.png

 

  1. Connect the power supply to the board and switch on the power to the board
  2. Open Tera Term and click Setup > Serial Port. Find the COM port corresponding to the ZC702 and configure it as follow:

 

8.png

 

  1. In SDK, in the project explorer, right click on the hello_world application and click Run As > Launch on Hardware (System Debugger)

Note: This step assumes your board is connected locally and not through a server

 

9.png

 

  1. SDK might tell you that the DONE pin of the FPGA is not high. This is because we haven’t program the bitstream. However, for this hello_world application, we only need to use the PS (as the UART is on the PS side), thus it is not needed to program the bitstream now. Click Yes

     10.png

 

  1. You should see the message “Hello World” displayed in the tera term console

    11.png

     

Configure the ADV7511

We have seen in the previous Video Serie that we can configure the ADV7511 (to do on-board HDMI) via the I2C controller from the Zynq processor (PS).

To simplify the code, I have created functions to handle the iic interface. We can just add the files into our application project

  1. Copy the files iic_utils.c and iic_utils.h from XVES_0020/src/sw_repo to XVES_0020/sdk_workspace/hello_world/src

The first step is to configure the PS I2C controller

  1. Add the following code to the helloworld.c file

 

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"

#include "iic_utils.h"

XIicPs IicPs_inst;

int main()
{
    init_platform();

    print("Hello World\n\r");

    //Configure the PS IIC Controller
ps_iic_init(XPAR_XIICPS_0_DEVICE_ID, &IicPs_inst); cleanup_platform(); return 0 }

 

To access the ADV7511 we need to go through a I2C switch at address 0x74. We need to use the Ch1 of this switch to access the ADV7511. This is done by setting bit 1 to 1 (send 0x2) in the IIC switch.

  1. Add the following function to set the iic mux to select the ADV7511 after the ps_iic_init function
// Set the iic mux to the ADV7511
set_iic_mux(&IicPs_inst, 0x2, 0x74);

 

The best way to check if we can access the ADV7511 is to check the Hot Plug Detect state to see if a monitor is connected. Note that the iic address of the ADV7511 is 0x39.

  1. Add the following code to check the state of the HPD signal
//Check the state of the HPD signal
u8 monitor_connected = 0; u8 temp = 2; while(1) { monitor_connected = check_hdmi_hpd_status(&IicPs_inst, 0x39); if(monitor_connected != temp) { temp = monitor_connected; if(monitor_connected) { xil_printf("HDMI Monitor connected\r\n"); } else { xil_printf("No HDMI Monitor connected / Monitor Disconnected\r\n"); } sleep(2); } }

 

  1. Launch the application on the board (right click on the hello_world application and click Run As > Launch on Hardware (System Debugger)). Note that again we do not need to have the bitstream programmed in the PL

  2. In the UART, we can see message reporting the status of the HPD which is changing when we plug or unplug the HDMI cable from the board (note that it takes ~2S before detecting a change)

 

12.png

 

According to the Quick Start Guide of the ADV7511 Programming Guide (link), there are some basic programming which need to be done when the HDP is high.

  1. Modify the code as follow to exit the while loop when a monitor is detected and to start configuring the ADV7511
while(!monitor_connected)
{
    monitor_connected = check_hdmi_hpd_status(&IicPs_inst, 0x39);

    if(monitor_connected != temp)
    {
    	temp = monitor_connected;
    	if(monitor_connected)
    	{
    		xil_printf("HDMI Monitor connected\r\n");
    	}
    	else
    	{
    		xil_printf("No HDMI Monitor connected / Monitor Disconnected\r\n");
    	}
    	sleep(2);
    }
} // ADV7511 Basic Configuration configure_adv7511(&IicPs_inst,0x39);

Finally, we need to configure the ADV7511 according to the Hardware connection of the ZC702. We need to follow the ADV7511 Hardware User Guide:

https://www.analog.com/media/en/technical-documentation/user-guides/ADV7511_Hardware_Users_Guide.pdf

According to the Table 7, we need to set register 0x15 (input ID) to 0x1 (YCbCr 4:2:2 with separate syncs), register 0x16 to 0x38 (8 bits (register bits [5:4] to ‘11’), style 1 bits (register bits [3:2] to ‘10’)) and register 0x48 to 0x8 (right justified (register bits [4:3] to ‘01’))

  1. Add the following code to set the ADV7511 to match the ZC702 HW configuration
// ADV7511 Input / Output Mode
//YCbCr 422 with Separated Syncs
iic_write2(&IicPs_inst, 0x39, 0x15, 0x1);
//YCbCr444 Output Format, Style 1, 8bpc
iic_write2(&IicPs_inst, 0x39, 0x16, 0x38);
//Video Input Justification: Right justified
iic_write2(&IicPs_inst, 0x39, 0x48, 0x08);

xil_printf("HDMI Setup Complete!\r\n");

 

In the next Video Series, we will start the Test Pattern Generator to check if we can get an output on the monitor.

 


What Next?

 

  • Do you have issues/questions following this Vivado Beginner Series?
    1. Search on the Xilinx forums for similar questions
    2. Create a new topic on the  Video Board for your issue/question with the title starting with [Video Beginner Series 20] and followed by a quick description of your issue/question

 

  • You liked this Video Series?
    • You can give Kudos using the Kudos button  kudos.PNG
    • Make sure you are following the Xilinx Video Series topic to be informed when an new topic is published (Go to the Xilinx Video Series topic > Options > Subscribe)

subscribe.PNG


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
Tags (2)