12-05-2018 12:55 AM - edited 12-05-2018 01:24 AM
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.
Summary
1. Tutorial – Starting with SDK and Configuring the ADV7511
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)
Select the hdf file in XVES_0020/sdk_export and click Finish
The first thing I do when starting a SDK project is to start by testing the board with a simple hello world program
Select the Hello World template and click Finish
On your computer, install a UART tool as tera term
Note: This step assumes your board is connected locally and not through a server
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
The first step is to configure the PS I2C controller
#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.
// 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.
//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); } }
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.
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’))
// 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.