FPGA实现HDMI输出

FPGA实现HDMI输出

对应的视频讲解

FPGA实现HDMI输出

FPGA实现HDMI输出有两种方式

  • 采用专门的HDMI芯片
  • 使用RTL完成TMDS编码

受限于FPGA本身时钟频率的限制,使用RTL完成TMDS编码的方式是很难完成高帧率的HDMI输出的,比如1080P@60Hz的像素时钟为148.5MHz,那么进行TMDS编码的5倍像素时钟就是742.5MHz,这么高的时钟频率对FPGA来说是一个很大的挑战。此外对于2K,4K这样的分辨率来说对时钟频率的要求就更高了,所以说使用RTL完成TMDS编码直接输出HDMI信号的方式比较适用于低分辨率的场景。

使用专门芯片的方式就比较简单了,主要就是配置该芯片的各种寄存器接口,这个DEMO里面使用的是RIGUKE的7100开发板,他这个开发板上面板载了一个HDMI IN和HDMI OUT的接口,其中HDMI OUT接口采用ADV7511芯片,最高支持1080P@60Hz的输出。

要完成一个HDMI的输出,只需要首先配置adv7511这个芯片,我们就直接采用PS端的c代码来配置这个芯片,代码如下:

c 复制代码
void adv7511_init(XIicPs *IicInstance) ;

int main(void)
{

	i2c_init(&ps_i2c1, XPAR_PS7_I2C_1_DEVICE_ID,100000);

	adv7511_init(&ps_i2c1) ;

	while(1);

	return 0;
}
c 复制代码
u8 adv7511_init_data[][2] =
{
		{0x41, 0x00},
		{0x98, 0x03},
		{0x9a, 0xe0},
		{0x9c, 0x30},
		{0x9d, 0x61},
		{0xa2, 0xa4},
		{0xa3, 0xa4},
		{0xe0, 0xd0},
		{0x55, 0x12},
		{0xf9, 0x00},
		{0x15, 0x00},
		{0xd0, 0x3c},
		{0xaf, 0x04},
		{0x4c, 0x04},
		{0x40, 0x00},
		{0xd6, 0xc0},
		{0xff, 0xff}
};


void adv7511_init(XIicPs *IicInstance)
{
	for(int i=0;;i++)
	{
		if((adv7511_init_data[i][0] == 0xff) && (adv7511_init_data[i][1] == 0xff))
		{
			break;
		}
		i2c_reg8_write(IicInstance, 0x72>>1, (unsigned char)adv7511_init_data[i][0], (unsigned char)adv7511_init_data[i][1]);
	}
}

在PL端首先例化了一个ZYNQ核

产生了一个彩条和纯色的切换的例子

彩条的代码如下:

verilog 复制代码
//color_bar
always @(posedge clk ) begin
    if(rst == 1'b1)begin
        color_bar_cnt <= 9'd0;
    end
    else begin
        if(s_video_de == 1'b1)begin
            if(color_bar_cnt == 9'd319)begin
                color_bar_cnt <= 9'd0;
            end
            else begin
                color_bar_cnt <= color_bar_cnt + 9'd1;
            end
        end
    end
end

always @(posedge clk ) begin
    if(rst == 1'b1)begin
        color_bar <= {8'd255, 8'd0, 8'd0};
    end
    else begin
        if(s_video_de == 1'b1)begin
            if(color_bar_cnt == 9'd319)begin
                color_bar <= {color_bar[15:8], color_bar[7:0], color_bar[23:16]};
            end 
        end
    end
end

彩条和纯色的切换代码如下:

verilog 复制代码
always @(posedge clk ) begin
    if(rst == 1'b1)begin
        ss_video_data <= 24'd0;
    end
    else begin
        case (select)
            2'd0: begin
                ss_video_data <= {8'd255, 8'd0, 8'd0};
            end 
            2'd1: begin
                ss_video_data <= {8'd0, 8'd255, 8'd0};
            end 
            2'd2: begin
                ss_video_data <= {8'd0, 8'd0, 8'd255};
            end 
            2'd3: begin
                ss_video_data <= color_bar;
            end 
            default: begin
                ss_video_data <= 24'd0;
            end
        endcase
    end
end

最后实现的效果如下:

FPGA_HDMI

对应的视频讲解

FPGA实现HDMI输出

相关推荐
青山_FPGA11 小时前
AT24CM01芯片的时序是如何进行控制的?
嵌入式硬件·fpga开发·lattice
FPGA小迷弟12 小时前
FPGA工程师面试题汇总(二)
学习·fpga开发·verilog·fpga
unicrom_深圳市由你创科技15 小时前
如何根据项目需求选型FPGA器件?逻辑单元、BRAM、DSP切片怎么看?
fpga开发
Saniffer_SH16 小时前
【高清视频】实验室搭建PCIe 6.0测试环境需要的retimer卡介绍
服务器·驱动开发·测试工具·fpga开发·计算机外设·硬件架构·压力测试
GateWorld17 小时前
FPGA内部模块PFU配置: 6输入LUT如何实现32位移位寄存器
fpga开发
FPGA小迷弟1 天前
FPGA 时序约束基础:从时钟定义到输入输出延迟的完整设置
前端·学习·fpga开发·verilog·fpga
daxi1502 天前
Verilog入门实战——第3讲:流程控制语句(if-else / case / 循环结构)
fpga开发·fpga
biubiuibiu2 天前
工业机器人编程语言详解:多样化选择与应用
fpga开发·机器人
lf2824814312 天前
04 DDS信号发生器
fpga开发
szxinmai主板定制专家2 天前
基于 STM32 + FPGA 船舶电站控制器设计与实现
arm开发·人工智能·stm32·嵌入式硬件·fpga开发·架构