FPGA XDMA interrupt mode realizes PCIE3.0 HDMI video capture card provides 2 sets of project source code and QT host computer source code

1 Introduction

PCIE (PCI Express) adopts the current popular point-to-point serial connection in the industry. Compared with the shared parallel architecture of PCI and earlier computer buses, each device has its own dedicated connection, does not need to request bandwidth from the entire bus, and can increase the data transmission rate to a very high frequency, reaching the high bandwidth that PCI cannot provide. It is the preferred direction of high-speed interfaces in various industries at present, and has high practical value and learning value;

This design uses Xilinx's official XDMA solution to build a PCIE3.0 communication platform based on Xilinx series FPGAs, and uses XDMA's interrupt mode to communicate with the QT host computer, that is, the QT host computer implements data interaction with the FPGA through software interrupts; a laptop is used to simulate an HDMI camera, and the HDMI video is input to the ADV7611 decoding chip onboard the FPGA development board to decode the HDMI video into RGB video, and then write the video to DDR through the FDMA video three-frame buffer architecture, and XDMA reads the video from DDR3 Come out, and send it to the host computer through the PCIE bus. The host computer runs QT host computer software, and the QT software receives the image data sent by PCIE through on-off mode and displays the image in real time;

The key to this design is that we have written an XDMA interrupt module of xdma_inter.v. This module is used to cooperate with the driver to handle interrupts. xdma_inter.v provides an AXI-LITE interface. The host computer reads and writes the registers of xdma_inter.v by accessing the user space address. The module registers the interrupt bit number in the interrupt bit input by user_irq_req_i, and outputs it to XDMA IP. When the driver of the upper computer responds to the interrupt, write the xdma_inter.v register in the interrupt to clear the processed interrupt.

This solution is only applicable to Xilinx series FPGAs. It also provides XDMA installation drivers and QT host computer source codes, which saves the cumbersome driver search using XDMA and the confusion of host computer software development, and builds a vivado project. It saves the embarrassment of not knowing how to use XDMA, making the use of PCIE easy to use, and you don’t need to care about its complicated PCIE protocol; since my development board only supports PCIE X8, the code provided is PCIE X8 architecture. If you need PCIE X1, Friends of X2, X8, X16, and X32 can modify this project by themselves, or follow me, and I will release new projects in real time.
This project implements PCIE communication for advanced applications, and conducts video transmission tests with QT host computer. This article describes in detail the design scheme of building a PCIE communication platform based on XDMA. The engineering code can be comprehensively compiled and debugged on the board, and can be
insert image description here
directly ported to the project. It is suitable for project development by students and graduate students, as well as for on-the-job engineers .

2. My existing PCIE solution

There is a PCIE communication column on my homepage, which implements data interaction with QT host computer based on XDMA polling mode. There are both PCIE solutions based on RIFFA and PCIE solutions based on XDMA. There are simple data interaction, speed measurement, and application-level image acquisition and transmission. : Click to go
directly to

3. PCIE theory

For this part, you can learn theoretical knowledge from Baidu or csdn or Zhihu. In fact, XDMA is used, and there is no need for complex protocols and theories until PCIE. . .

4. Overall design idea and scheme

The overall design idea and scheme are as follows:
insert image description here

Video Capture and Buffering

用笔记本电脑模拟HDMI摄像头,HDMI视频输入到FPGA开发板板载的ADV7611解码芯片,将HDMI视频解码为RGB视频;
纯verilog实现的i2c协议实现对ADV7611解码芯片内部寄存器的配置,本设计配置为1920x1080@60Hz的分辨率;
FDMA图像缓存:
FDMA图像三帧缓存,经常看我文章的兄弟都知道,这是我惯用的图像缓存套路,它由FDMA控制器和FDMA构成,作用是将输入的视频缓存到DDR3里做三帧缓存后再读出来,目的是使得图像数据的输入输出跨时钟域读写,输出图像平稳无撕裂等现象;关于FDMA的详细设计说明,请参考我之前的文章:点击直接前往

Introduction to XDMA

The DMASubsystem for PCIExpressIP provided by Xilinx is a high-performance, configurable SG mode DMA suitable for PCIE2.0 and PCIE3.0, providing user-selectable AXI4 interface or AXI4-Stream interface. Generally, it can be configured as AXI4 interface and can be added to the system bus interconnection, which is suitable for asynchronous transmission of large amounts of data. Usually, DDR is used, and AXI4-Stream interface is suitable for low-latency data stream transmission.
XDMA is SGDMA, not Block DMA. In SG mode, the host will form the data to be transmitted in the form of a linked list, and then send the first address of the linked list to XDMA through BAR. XDMA will complete the transmission tasks specified by the linked list in turn according to the first address of the linked list structure. The XDMA block diagram is as follows: AXI4, AXI4-Stream, one must be selected for data transmission AXI4-Lite Master is optional, used to implement PCIE BAR address to AXI4-lite Mapping of register addresses, which can be used to read and write user logic registers
insert image description here
.
AXI4-Lite Slave is optional and is used to open the XDMA internal registers to user logic. User logic can access XDMA internal registers through this interface and will not be mapped to BAR.
AXI4 Bypass interface, optional, used to implement PCIE pass-through user logic access, which can be used for low-latency data transmission.

XDMA interrupt mode

The key to this design is that we have written an XDMA interrupt module of xdma_inter.v. This module is used to cooperate with the driver to handle interrupts. xdma_inter.v provides an AXI-LITE interface. The host computer reads and writes the registers of xdma_inter.v by accessing the user space address. The module registers the interrupt bit number in the interrupt bit input by user_irq_req_i, and outputs it to XDMA IP. When the driver of the upper computer responds to the interrupt, write the xdma_inter.v register in the interrupt to clear the processed interrupt.
In addition, in this program, AXI-BRAM is used to demonstrate the read and write access test of the user space.

QT host computer and its source code

QT host computer This solution uses VS2015 + Qt 5.12.10 to complete the development software environment of the host computer. The QT program calls the official XDMA API to realize data interaction with the FPGA in interrupt mode. This routine implements reading and writing speed, and provides QT host computer software and its source code. The path is as follows: The screenshot of the QT source code part is as follows
insert image description here
:
insert image description here

5. Detailed explanation of vivado project

Development board FPGA model: Xilinx–xcku060-ffva1156-2-i;
development environment: Vivado2022.2;
input: HDMI with a resolution of 1920x1080@60Hz;
output: PCIE3.0 X8; application : QT host computer
video display test; The estimated resource consumption and power consumption of the FPGA after completion are as follows:

insert image description here

insert image description here
insert image description here

insert image description here

insert image description here

insert image description here

6. Board debugging and verification

Open the host computer test program for PCIe receiving video test, open the QT software, the experimental results are as follows:
insert image description here

7. Welfare: acquisition of engineering code

Benefits: Obtaining the engineering code
The code is too large to be sent by email, and it is sent by a certain degree network disk link. The
method of data acquisition: private, or the V business card at the end of the article.
The network disk information is as follows:
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_41667729/article/details/131776125