打印
[Quartus]

使用ZYNQ 的HDMI接口(转)

[复制链接]
3542|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
gaochy1126|  楼主 | 2012-11-22 21:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ZYNQ最大的特点就是外部接口丰富,在ZEDBOARD上除了常用的UART,USB,VGA接口,网口外,最引人注目的就是HDMI接口了。图中很清楚了给出了ZEDBOARD上的各种接口。


从图中可以看出HDMI接口是与ZYNQ的PL逻辑部分相连的。所以,如果要让HDMI接口工作的话,我们必须对PL逻辑部分进行配置。下面我们开始来看看如何使用zedboard的HDMI接口。

首先,在PlanAhead中建立工程,所有选项和建立HELLOWORLD工程一样。建立完PlanAhead工程后,选择ADD SOURCES->Add or Create Embedded Sources打开XPS工具。这时候会弹出一个对话框问我们是否使用BSB向导来完成工程,



一般情况下,我们使用默认选项就可以了,但在这里,我为了省事,直接选用XILINX做好了的HDMI库(在WWW.ZEDBOARD.org网站上就有),于是我们就在Peripheral Repository Search path 这一栏里选择HDMI库的路径。一路NEXT直到Base System Builder窗口,如下图所示




在这步列出了默认情况下系统支持的硬件及IO接口,在我们这个项目中由于不需要SW和LED,所以我们需要把右边的东西全部删除。

在建立完项目之后,紧接着就是配置系统的PS外设了,由于我们需要使用IIC对外部进行配置,所以在这里我们选择打开IIC0,完成后结果如下图所示:




到此,基本完成了对于PS部分外围端口的配置了。下面就是对PL部分配置,XILINX给我们提供了很多可以使用的IP核。在这个例子中我们需要使用的IP核为AXI IIC Interface和fmc_imageon_hdmi_in。在XPS的IP CATALOG中分别双击这两个IP核导入到工程中。此时可以看到BUS INTERFACE栏下有4个项,其中两个就是我们刚才添加的AXI IIC Interface和fmc_imageon_hdmi_in。



紧接着就是要对这几个新增加的IP核分配时钟和输入输出引脚了,内部连接如下图所示:



外部与具体IO连接主要有约束文件来完成。整个约束文件的内容如下图所示:

NET "fmc_imageon_iic_0_Reset_pin" LOC = "N20"; # I2C_MUX_RST# - FMC1-D9 (LA01_n_CC)

NET "fmc_imageon_iic_0_Sda_pin" LOC = "K21"; # I2C_MUX_SDA - FMC1-G19 (LA16_n)

NET "fmc_imageon_iic_0_Scl_pin" LOC = "J20"; # I2C_MUX_SCL - FMC1-G18 (LA16_p)




# HDMI input

NET "fmc_imageon_hdmi_in_0_io_hdmii_spdif_pin" LOC = "A19"; # HDMII_SPDIF - FMC1-H29 (LA24_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[0]" LOC = "A22"; # HDMII_CBCR0 - FMC1-H38 (LA32_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[1]" LOC = "A21"; # HDMII_CBCR1 - FMC1-H37 (LA32_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[2]" LOC = "B22"; # HDMII_CBCR2 - FMC1-G37 (LA33_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[3]" LOC = "B21"; # HDMII_CBCR3 - FMC1-G36 (LA33_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[4]" LOC = "B15"; # HDMII_CBCR4 - FMC1-H35 (LA30_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[5]" LOC = "C15"; # HDMII_CBCR5 - FMC1-H34 (LA30_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[6]" LOC = "B17"; # HDMII_CBCR6 - FMC1-G34 (LA31_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[7]" LOC = "B16"; # HDMII_CBCR7 - FMC1-G33 (LA31_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[8]" LOC = "A17"; # HDMII_Y0 - FMC1-H32 (LA28_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[9]" LOC = "A16"; # HDMII_Y1 - FMC1-H31 (LA28_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[10]" LOC = "C18"; # HDMII_Y2 - FMC1-G31 (LA29_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[11]" LOC = "D21"; # HDMII_Y3 - FMC1-C27 (LA27_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[12]" LOC = "E18"; # HDMII_Y4 - FMC1-D27 (LA26_n)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[13]" LOC = "C17"; # HDMII_Y5 - FMC1-G30 (LA29_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[14]" LOC = "E21"; # HDMII_Y6 - FMC1-C26 (LA27_p)

NET "fmc_imageon_hdmi_in_0_io_hdmii_video_pin[15]" LOC = "F18"; # HDMII_Y7 - FMC1-D26 (LA26_p)

NET "fmc_imageon_hdmi_in_0_clk_pin" LOC = "D18"; # HDMII_LLC - FMC1-G2 (CLK1_M2C_p)




NET fmc_imageon_hdmi_in_0_clk_pin TNM_NET = hdmii_clk;

TIMESPEC TS_hdmii_clk = PERIOD hdmii_clk 148500 kHz;

相关帖子

沙发
gaochy1126|  楼主 | 2012-11-22 21:57 | 只看该作者
# HDMI output NET "fmc_imageon_hdmi_out_0_io_hdmio_spdif_pin" LOC = "A18"; # HDMIO_SPDIF - FMC1-H28 (LA24_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[0]" LOC = "G19"; # HDMIO_CBCR0 - FMC1-G24 (LA22_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[1]" LOC = "G16"; # HDMIO_CBCR1 - FMC1-H23 (LA19_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[2]" LOC = "D20"; # HDMIO_CBCR2 - FMC1-C22 (LA18_p_CC) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[3]" LOC = "B20"; # HDMIO_CBCR3 - FMC1-D21 (LA17_n_CC) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[4]" LOC = "G15"; # HDMIO_CBCR4 - FMC1-H22 (LA19_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[5]" LOC = "G21"; # HDMIO_CBCR5 - FMC1-G22 (LA20_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[6]" LOC = "B19"; # HDMIO_CBCR6 - FMC1-D20 (LA17_p_CC) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[7]" LOC = "G20"; # HDMIO_CBCR7 - FMC1-G21 (LA20_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[8]" LOC = "C22"; # HDMIO_Y0 - FMC1-G28 (LA25_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[9]" LOC = "D22"; # HDMIO_Y1 - FMC1-G27 (LA25_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[10]" LOC = "E20"; # HDMIO_Y2 - FMC1-H26 (LA21_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[11]" LOC = "D15"; # HDMIO_Y3 - FMC1-D24 (LA23_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[12]" LOC = "E19"; # HDMIO_Y4 - FMC1-H25 (LA21_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[13]" LOC = "F19"; # HDMIO_Y5 - FMC1-G25 (LA22_n) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[14]" LOC = "C20"; # HDMIO_Y6 - FMC1-C23 (LA18_n_CC) NET "fmc_imageon_hdmi_out_0_io_hdmio_video_pin[15]" LOC = "E15"; # HDMIO_Y7 - FMC1-D23 (LA23_p) NET "fmc_imageon_hdmi_out_0_io_hdmio_clk_pin" LOC = "C19"; # HDMIO_CLK - FMC1-G3 (CLK1_M2C_n) NET "fmc_imageon_*_pin" IOSTANDARD="LVCMOS25"; 到此,PL部分的配置全部完成,下面就可以在PlanAhead中生成BITSTREAM了。点击下图中的Generate Bitstram按钮,PlanAhead开始了漫长的综合过程。 完成后选择File > Export > Export Hardware for SDK,把刚才生成的二进制流文件和配置选项导出到SDK中,下面就开始HDMI软件的编写了。HDMI的软件比较复杂,为了省事我主要使用XILINX提供的示例(在后面提供下载),建立好HELLOWORLD工程,然后再HELLOWORLD.C文件中加入以下内容 #include"fmc_imageon_hdmi_passthrough.h" fmc_imageon_hdmi_passthrough_tdemo; 把下面的内容加入到MAIN函数中。 demo.uBaseAddr_IIC_FmcImageon= XPAR_FMC_IMAGEON_IIC_0_BASEADDR; fmc_imageon_hdmi_passthrough_init( &demo ); 点击编译即可。。不过需要主要的是在调试之前需要把上面生成的BIT文件通过工具烧录到zynq中,不然系统会报错。 Zedboard体验小结: 相比于纯FPGA或纯MCU的板子,ZYNQ确实有很大的优势,它既有FPGA的灵活和效率又有传统MCU的便利。而且开发起来也很容易上手。由于时间的关系,其它ZYNQ的功能暂时还无法测试,不过通过查看文档以及对几个基本实例的学下,ZYNQ的其它功能的实现应该也不会太难,在后续的项目中看看有没有机会用上ZYNQ的片子。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1051

主题

11300

帖子

26

粉丝