CN104572574A - GigE (gigabit Ethernet) vision protocol-based Ethernet controller IP (Internet protocol) core and method - Google Patents
GigE (gigabit Ethernet) vision protocol-based Ethernet controller IP (Internet protocol) core and method Download PDFInfo
- Publication number
- CN104572574A CN104572574A CN201510014943.4A CN201510014943A CN104572574A CN 104572574 A CN104572574 A CN 104572574A CN 201510014943 A CN201510014943 A CN 201510014943A CN 104572574 A CN104572574 A CN 104572574A
- Authority
- CN
- China
- Prior art keywords
- module
- data
- packet
- control
- port ram
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Small-Scale Networks (AREA)
Abstract
本发明公开了一种基于千兆以太网视觉协议的以太网控制器IP核,由控制模块、PHY管理接口模块、发送控制模块、流控制模块、接收控制模块组成,采用FPGA实现,遵循Avalon?Memory-Mapped接口规范及GMII接口规范。本发明是根据GigE?Vision协议特点设计的专用IP核,能够实现GigE相机图像的接收和自动存储,在实现图像采集的同时,克服了传统以太网控制器资源占用量大、CPU使用率高、图像采集效率低等缺点,利用FPGA并行处理的特点,提高数据接收速度以及系统实时性。在同样的测试条件下,使用本专利实现图像采集,要比Altera公司的三速以太网IP核减少一半以上的FPGA资源消耗。
The invention discloses an Ethernet controller IP core based on a Gigabit Ethernet visual protocol, which is composed of a control module, a PHY management interface module, a sending control module, a flow control module, and a receiving control module, implemented by FPGA, and following Avalon? Memory-Mapped interface specification and GMII interface specification. The present invention is based on GigE? The dedicated IP core designed for the characteristics of the Vision protocol can realize the reception and automatic storage of GigE camera images. While realizing image acquisition, it overcomes the shortcomings of traditional Ethernet controllers such as large resource usage, high CPU usage, and low image acquisition efficiency. , using the characteristics of FPGA parallel processing to improve data receiving speed and system real-time performance. Under the same test conditions, using this patent to realize image acquisition will reduce FPGA resource consumption by more than half compared with Altera's triple-speed Ethernet IP core.
Description
技术领域technical field
本发明涉及一种图像采集系统,特别涉及一种基于千兆以太网视觉(GigEVision)协议的嵌入式图像采集系统中的千兆以太网控制单元。The invention relates to an image acquisition system, in particular to a gigabit ethernet control unit in an embedded image acquisition system based on gigabit ethernet vision (GigEVision) protocol.
背景技术Background technique
目前图像采集设备主要分为两个方向,一是基于个人计算机(PersonalComputer,PC)机的图像采集卡,二是基于嵌入式微处理器的图像采集系统。At present, the image acquisition equipment is mainly divided into two directions, one is an image acquisition card based on a personal computer (Personal Computer, PC), and the other is an image acquisition system based on an embedded microprocessor.
由于外部控制器接口(Peripheral Component Interconnect,PCI)总线接口带宽较低,并且采用共享式总线结构,因此基于PCI总线的图像采集卡产品已经基本被淘汰。虽然新一代PCI Express总线相比于传统的PCI总线的性能有了很大的提升,但是其仍然无法解决PC系统实时性差、稳定性不好以及成本高等问题,因此,基于PC的图像采集卡产品已经很难满足现代工业检测的需求。目前,主流的图像采集设备主要是基于嵌入式微处理器的图像采集系统。Due to the low bandwidth of the external controller interface (Peripheral Component Interconnect, PCI) bus interface and the use of a shared bus structure, the image acquisition card products based on the PCI bus have basically been eliminated. Although the performance of the new-generation PCI Express bus has been greatly improved compared with the traditional PCI bus, it still cannot solve the problems of poor real-time performance, poor stability and high cost of the PC system. Therefore, PC-based image acquisition card products It has been difficult to meet the needs of modern industrial testing. At present, the mainstream image acquisition devices are mainly image acquisition systems based on embedded microprocessors.
随着信息化发展速度的加快,人们对视频图像传输带宽的需求也日益增加。当前主流的相机接口标准Camera Link接口、IEEE1394接口、USB接口等已经不能满足人们对图像信息摄取速度的要求。不同的是,千兆以太网(GigE)接口以千兆以太网作为数据传输接口,在实现图像数据传输的同时,无需额外的采集设备,并且具有绝对的带宽优势。With the acceleration of information technology development, people's demand for video image transmission bandwidth is also increasing. The current mainstream camera interface standards such as Camera Link interface, IEEE1394 interface, and USB interface can no longer meet people's requirements for image information ingestion speed. The difference is that the Gigabit Ethernet (GigE) interface uses Gigabit Ethernet as the data transmission interface. While realizing image data transmission, it does not require additional acquisition equipment and has absolute bandwidth advantages.
但是,目前基于普通千兆以太网控制器的图像采集系统主要存在以下两个重要的问题:However, the current image acquisition system based on common Gigabit Ethernet controllers mainly has the following two important problems:
一是为了实现GigE Vision协议,设计必须使用通用的以太网控制器。这样面向通用功能而设计的以太网控制器,往往结构比较复杂,资源占用量大。二是CPU占用率过高。为了接收图像数据,必须使用软件对以太网协议(InternetProtocol,IP)、用户数据报协议(User Datagram Protocol,UDP)以及GigE Vision协议数据进行层层过滤,这必然会增加中央处理机(Central Processing Unit,CPU)的处理负担,提高CPU占用率。One is that in order to implement the GigE Vision protocol, the design must use a general-purpose Ethernet controller. Such an Ethernet controller designed for general functions often has a complex structure and consumes a large amount of resources. Second, the CPU usage is too high. In order to receive image data, software must be used to filter Ethernet protocol (Internet Protocol, IP), user datagram protocol (User Datagram Protocol, UDP) and GigE Vision protocol data layer by layer, which will inevitably increase the central processing unit (Central Processing Unit). , CPU) processing burden, increasing the CPU usage.
申请号为201010603189.5,发明专利名称为“一种基于FPGA和DSP的机器视觉系统”,该系统使用FPGA内部硬件电路实现图像的采集和预处理,使用DSP实现系统的逻辑控制和图像的高级处理。该系统的图像采集模块有以下几个缺陷:The application number is 201010603189.5, and the invention patent name is "A Machine Vision System Based on FPGA and DSP". The system uses FPGA internal hardware circuit to realize image acquisition and preprocessing, and uses DSP to realize system logic control and advanced image processing. The image acquisition module of the system has the following defects:
(1)以太网控制器使用10/100/1000M三速以太网介质访问控制器,虽然功能强大,但是其实现需要消耗4800多个逻辑单元、5300多个寄存器资源以及19000多字节的存储资源,资源消耗量巨大,增加了硬件开发的成本;(1) The Ethernet controller uses a 10/100/1000M triple-speed Ethernet media access controller. Although it is powerful, its implementation needs to consume more than 4,800 logic units, more than 5,300 register resources, and more than 19,000 bytes of storage resources. , resource consumption is huge, increasing the cost of hardware development;
(2)软件使用μC/OS系统进行任务调度,IP、UDP协议封包和解析使用系统提供的软件协议栈,软件复杂度高,系统负担大,实时性差;(2) The software uses the μC/OS system for task scheduling, and the software protocol stack provided by the system is used for IP and UDP protocol packets and analysis, which has high software complexity, heavy system burden, and poor real-time performance;
(3)GigE Vision协议的实现由软件完成,由于嵌入式系统实时性的限制,必然会影响丢包情况的判断,造成图像数据的缺失和损坏。(3) The implementation of the GigE Vision protocol is completed by software. Due to the real-time limitation of the embedded system, it will inevitably affect the judgment of packet loss, resulting in the loss and damage of image data.
申请号为201310328995.X,发明专利名称为“一种基于GigE接口的嵌入式并行多路数字图像采集系统”,该系统使用基于GigE接口的数字图像采集嵌入式设备对多路GigE相机图像进行采集,并根据上位机的命令向上位机传输图像数据,其重点在于对多路图像信号进行采集,并上传到PC机进行处理。该系统有以下几点缺陷:The application number is 201310328995.X, and the patent name of the invention is "an embedded parallel multi-channel digital image acquisition system based on GigE interface". , and transmit image data to the upper computer according to the command of the upper computer, the focus is on collecting multiple image signals and uploading them to the PC for processing. The system has the following drawbacks:
(1)其网络数据收发采用通用以太网控制器,IP、UDP等网络协议的实现仍需软件实现系统负担大,CPU占用率高;(1) Its network data transmission and reception adopts a general-purpose Ethernet controller, and the realization of IP, UDP and other network protocols still requires software implementation, which has a large system burden and high CPU usage;
(2)接收到的网络数据需要由系统仲裁模块进行实时搬运,才能被GigE协议解析模块读取,GigE协议解析模块解析得到的图像数据又必须由系统仲裁模块读取后,再存入相应的存储器。这种机制使得大量的数据在总线上来回传输,大大增加了总线占用率,提高系统仲裁模块的复杂度,影响系统的实时性;(2) The received network data needs to be transported in real time by the system arbitration module before it can be read by the GigE protocol analysis module. The image data analyzed by the GigE protocol analysis module must be read by the system arbitration module and then stored in the corresponding memory. This mechanism allows a large amount of data to be transmitted back and forth on the bus, which greatly increases the bus occupancy rate, increases the complexity of the system arbitration module, and affects the real-time performance of the system;
(3)该系统虽然使用硬件资源对GigE接口数据包进行解析,但是未针对GVSP协议进行硬件上的优化,数据包的重发机制仍需软件实现,很难达到较高的实时性,影响图像数据的完整性和图像接收的帧率。(3) Although the system uses hardware resources to analyze the GigE interface data packets, it has not optimized the hardware for the GVSP protocol, and the retransmission mechanism of the data packets still needs to be implemented by software. It is difficult to achieve high real-time performance and affect the image. Data integrity and frame rate of image reception.
发明内容Contents of the invention
发明目的:Purpose of the invention:
为了克服了传统以太网控制器资源占用量大、CPU使用率高、图像采集效率低等缺点,本发明对传统的以太网控制器进行优化,根据GigE Vision协议特点设计的专用IP核。本发明使用硬件逻辑实现IP、地址解析协议(AddressResolution Protocol,ARP)、UDP、千兆以太网视觉控制协议(GigE VisionControl Protocol,GVCP)的封包和解析。同时,本发明利用FPGA并行处理的特点,在无CPU协助的情况下,控制Avalon Memory-Mapped主接口,根据千兆以太网视觉流协议(GigE Vision Stream Protocol,GVSP)数据包的ID,自动将图像数据存入用户指定的内存空间中,提高数据接收速度以及系统实时性。In order to overcome the shortcomings of traditional Ethernet controllers such as large resource occupation, high CPU usage, and low image acquisition efficiency, the present invention optimizes traditional Ethernet controllers and designs a dedicated IP core according to the characteristics of the GigE Vision protocol. The present invention uses hardware logic to realize the encapsulation and analysis of IP, Address Resolution Protocol (Address Resolution Protocol, ARP), UDP, and Gigabit Ethernet Vision Control Protocol (GigE Vision Control Protocol, GVCP). Simultaneously, the present invention utilizes the characteristic of parallel processing of FPGA, under the situation that does not have CPU assistance, controls Avalon Memory-Mapped main interface, according to the ID of Gigabit Ethernet Vision Stream Protocol (GigE Vision Stream Protocol, GVSP) packet, automatically The image data is stored in the memory space specified by the user, which improves the data receiving speed and the real-time performance of the system.
技术方案:Technical solutions:
一种基于GigE Vision协议的以太网控制器IP核,为现场可编程门阵列(Field Programmable Gate Array,FPGA)中的一个知识产权核,具体由MAC控制模块、PHY管理接口模块、发送控制模块、流控制模块、接收控制模块组成,采用FPGA实现,通过Avalon内存映射型(Memory-Mapped)从接口与NIOS处理器连接,通过Avalon Memory-Mapped主接口与图像存储RAM连接,通过PHY管理接口及千兆介质专用接口(Gigabit Media Independent Interface,GMII)与物理层(PHY)连接。An Ethernet controller IP core based on the GigE Vision protocol is an intellectual property core in a Field Programmable Gate Array (Field Programmable Gate Array, FPGA), and is specifically composed of a MAC control module, a PHY management interface module, a transmission control module, It is composed of flow control module and receiving control module, implemented by FPGA, connected with NIOS processor through Avalon Memory-Mapped slave interface, connected with image storage RAM through Avalon Memory-Mapped master interface, and connected with PHY management interface and thousand Gigabit Media Independent Interface (GMII) is connected to the physical layer (PHY).
MAC控制模块包含寄存器单元、模块控制单元以及总线控制单元,接收NIOS处理器发送的总线信息,控制其他模块;The MAC control module includes a register unit, a module control unit and a bus control unit, receives bus information sent by the NIOS processor, and controls other modules;
PHY管理接口模块用于访问PHY寄存器,根据PHY访问控制信号及PHY管理接口时序规范,自动生成MDC时钟和MDIO数据,控制PHY管理接口,访问PHY寄存器,生成PHY访问反馈信号;The PHY management interface module is used to access PHY registers, automatically generate MDC clock and MDIO data according to PHY access control signals and PHY management interface timing specifications, control the PHY management interface, access PHY registers, and generate PHY access feedback signals;
发送控制模块包含第一双端口RAM、协议封包模块、第二双端口RAM以及GMII发送模块,根据发送控制信号、ARP发送控制信号以及丢包重发控制信号自动发送相应的以太网数据包,生成发送反馈信号;The sending control module includes a first dual-port RAM, a protocol packet module, a second dual-port RAM and a GMII sending module, and automatically sends corresponding Ethernet data packets according to sending control signals, ARP sending control signals and packet loss and resending control signals, and generates send a feedback signal;
流控制模块包含图像存储控制模块以及流检测模块,根据存储控制信号、流控制信号,通过GVSP数据读取总线读取GVSP数据,将图像数据写入图像存储RAM中,并生成存储反馈信号,同时检测丢包情况,控制丢包重发控制信号;The flow control module includes an image storage control module and a flow detection module. According to the storage control signal and the flow control signal, the GVSP data is read through the GVSP data read bus, the image data is written into the image storage RAM, and a storage feedback signal is generated. Detect packet loss, control packet loss and resend control signals;
接收控制模块包含第三双端口RAM、第四双端口RAM、第五双端口RAM、协议解析模块、异步FIFO以及GMII接收模块,接收以太网数据包,根据接收控制信号对其进行解析,生成接收反馈信号和流控制信号,并分别通过接收数据读取总线以及GVSP数据读取总线发送解析的数据。The receiving control module includes a third dual-port RAM, a fourth dual-port RAM, a fifth dual-port RAM, a protocol analysis module, an asynchronous FIFO and a GMII receiving module, receives Ethernet data packets, analyzes them according to the receiving control signal, and generates a receiving module. Feedback signal and flow control signal, and send parsed data through receiving data reading bus and GVSP data reading bus respectively.
优选地,寄存器单元用于存放控制信息、状态信息、本机网络地址信息以及相机网络地址信息;模块控制单元根据寄存器单元存放的信息及接收的反馈信息,生成PHY访问控制信号、发送控制信号、接收控制信号和存储控制信号;总线控制单元对来自Avalon Memory-Mapped从接口的地址和控制信号进行解析,实现CPU对IP核中不同的地址空间的访问,包括寄存器单元、第一双端口RAM、第三双端口RAM及第四双端口RAM。Preferably, the register unit is used to store control information, status information, local network address information and camera network address information; the module control unit generates PHY access control signals, sends control signals, Receive control signals and storage control signals; the bus control unit analyzes the address and control signals from the Avalon Memory-Mapped slave interface, and realizes the CPU's access to different address spaces in the IP core, including register units, the first dual-port RAM, The third dual-port RAM and the fourth dual-port RAM.
优选地,第一双端口RAM通过发送数据写入总线接收发送数据并缓存,将发送数据从系统所在时钟域转换到GMII发送模块所在时钟域;协议封包模块包含IP协议封包模块、UDP协议封包模块、GVCP协议封包模块以及ARP协议封包模块,根据发送控制信号,自动为发送数据封包网络协议,将包首数据存入第二双端口RAM;GMII发送模块包含CRC-32生成模块,将第一双端口RAM和第二双端口RAM的数据组合成为以太网帧并发送;CRC-32生成模块自动生成32位CRC校验码。Preferably, the first dual-port RAM receives and buffers the sending data by sending the data into the bus, and converts the sending data from the clock domain where the system is located to the clock domain where the GMII sending module is located; the protocol packet module includes an IP protocol packet module, a UDP protocol packet module , GVCP protocol packet module and ARP protocol packet module, according to the sending control signal, automatically send the data packet network protocol, and store the packet header data in the second dual-port RAM; the GMII sending module includes a CRC-32 generation module, which converts the first The data of the port RAM and the second dual-port RAM are combined into an Ethernet frame and sent; the CRC-32 generation module automatically generates a 32-bit CRC check code.
优选地,流检测模块读取第五双端口RAM,根据GVSP协议获取图像数据包ID号及图像数据,检测丢包情况,自动计算丢失数据包的ID号,生成丢包重发控制信号;图像存储控制模块根据图像数据包ID号以及存储控制信号,控制Avalon Memory-Mapped主接口,自动计算存储地址,将图像数据存储到图像存储RAM中。Preferably, the flow detection module reads the fifth dual-port RAM, obtains the image data packet ID number and image data according to the GVSP protocol, detects the packet loss situation, automatically calculates the ID number of the lost data packet, and generates a packet loss retransmission control signal; The storage control module controls the main interface of Avalon Memory-Mapped according to the ID number of the image data packet and the storage control signal, automatically calculates the storage address, and stores the image data in the image storage RAM.
优选地,GMII接收模块内嵌CRC-32检验模块,接收网络数据包,将其写入异步FIFO中,并对其进行校验;异步FIFO缓存接收的以太网数据,将数据从GMII接收时钟所在时钟域转换到协议解析模块所在时钟域;协议解析模块包含ARP协议解析模块、IP协议解析模块、UDP协议解析模块、GVCP协议解析模块以及GVSP协议解析模块,对接收数据进行解析,并将解析的数据分别存入不同的双端口RAM中;第三双端口RAM缓存接收的GVCP数据;第五双端口RAM缓存接收的GVSP数据;第四双端口RAM缓存接收的其他数据。Preferably, the GMII receiving module is embedded with a CRC-32 checking module, receives the network data packet, writes it in the asynchronous FIFO, and checks it; the asynchronous FIFO buffers the received Ethernet data, and receives the data from the GMII where the clock is located The clock domain is converted to the clock domain where the protocol analysis module is located; the protocol analysis module includes an ARP protocol analysis module, an IP protocol analysis module, a UDP protocol analysis module, a GVCP protocol analysis module, and a GVSP protocol analysis module. Data are respectively stored in different dual-port RAMs; the third dual-port RAM buffers received GVCP data; the fifth dual-port RAM buffers received GVSP data; and the fourth dual-port RAM buffers other data received.
本发明基于GigE Vision协议的以太网控制器IP核的图像数据传输方法为:The image data transmission method of the Ethernet controller IP core based on the GigE Vision protocol of the present invention is:
总线控制单元读取Avalon总线命令,并根据读写信号、地址信息控制寄存器单元、第一双端口RAM、第三双端口RAM以及第四双端口RAM的读写。The bus control unit reads the Avalon bus command, and controls the reading and writing of the register unit, the first dual-port RAM, the third dual-port RAM and the fourth dual-port RAM according to the read and write signals and address information.
发送以太网数据时,When sending Ethernet data,
[1]总线控制单元(1.3)根据总线地址,将发送数据写入第一双端口RAM(3.1)中,将控制命令写入寄存器单元(1.1)中;[1] The bus control unit (1.3) writes the sending data into the first dual-port RAM (3.1) according to the bus address, and writes the control command into the register unit (1.1);
[2]模块控制单元(1.2)实时检测寄存器单元(1.1),检测到发送命令后,生成相应的发送控制信号(8);[2] The module control unit (1.2) detects the register unit (1.1) in real time, and after detecting the sending command, generates a corresponding sending control signal (8);
[3]协议封包模块(3.2)读取发送控制信号(8),生成相应的协议包首,并将包首数据存入第二双端口RAM(3.3)中;[3] The protocol packet module (3.2) reads the sending control signal (8), generates the corresponding protocol packet header, and stores the packet header data in the second dual-port RAM (3.3);
[4]GMII发送模块(3.4)读取第一双端口RAM(3.1)和第二双端口RAM(3.3)中的数据,形成以太网帧进行发送;[4] GMII sending module (3.4) reads the data in the first dual-port RAM (3.1) and the second dual-port RAM (3.3), forms Ethernet frame and sends;
[5]在此同时,发送控制模块(3)产生发送反馈信号(10);[5] At the same time, the sending control module (3) generates a sending feedback signal (10);
[6]模块控制单元(1.2)实时检测发送反馈信号(10),并将反馈信息写入寄存器单元(1.1);[6] The module control unit (1.2) detects and sends the feedback signal (10) in real time, and writes the feedback information into the register unit (1.1);
整个IP核的以太网数据接收流程为:The Ethernet data receiving process of the entire IP core is:
(一)GMII接收模块(5.6)实时接收广播数据包或发送至本地MAC地址的数据包,并将数据写入异步FIFO(5.5);(1) The GMII receiving module (5.6) receives the broadcast data packet or the data packet sent to the local MAC address in real time, and writes the data into the asynchronous FIFO (5.5);
(二)协议解析模块(5.4)读取异步FIFO(5.5)中的数据,对数据包的协议进行解析;(2) The protocol analysis module (5.4) reads the data in the asynchronous FIFO (5.5), and analyzes the protocol of the data packet;
(三)如果数据包为ARP请求数据包,ARP协议解析模块(5.4.1)根据请求数据,产生ARP请求信号,请求发送控制模块(3)发送ARP应答数据包;(3) if the packet is an ARP request packet, the ARP protocol analysis module (5.4.1) generates an ARP request signal according to the request data, and the request sends the control module (3) to send the ARP response packet;
(四)如果数据包为IP数据包,IP协议解析模块(5.4.5)进一步对数据包的协议进行解析,判断该数据包是否为UDP数据包;(4) if the data packet is an IP data packet, the IP protocol analysis module (5.4.5) further analyzes the protocol of the data packet, and judges whether the data packet is a UDP data packet;
(五)如果数据包为UDP数据包,UDP协议解析模块(5.4.4)判断目的端口号,判断该数据包是否为GVCP数据包或者GVSP数据包;(5) if the data packet is a UDP data packet, the UDP protocol analysis module (5.4.4) judges the destination port number, and judges whether the data packet is a GVCP data packet or a GVSP data packet;
(六)如果数据包为GVCP数据包,GVCP解析模块(24)解析数据包,将GVCP数据写入第三双端口RAM(5.1),并产生相应的接收反馈信号(12);(6) If the data packet is a GVCP data packet, the GVCP analysis module (24) parses the data packet, writes the GVCP data into the third dual-port RAM (5.1), and generates a corresponding receiving feedback signal (12);
(七)如果数据包为GVSP数据包,GVSP解析模块(25)解析数据包,将GVSP数据写入第五双端口RAM(5.3),并产生流控制信号(19);(7) if the data packet is a GVSP data packet, the GVSP analysis module (25) parses the data packet, writes the GVSP data into the fifth dual-port RAM (5.3), and generates a flow control signal (19);
(八)协议解析模块(5.4)将其他数据包写入第四双端口RAM(5.2),并产生相应的接收反馈信号(12);(8) protocol analysis module (5.4) writes other data packets into the fourth dual-port RAM (5.2), and generates corresponding receiving feedback signals (12);
(九)流控制模块(4)接收到流控制信号(19)后,控制流检测模块(4.2)读取第五双端口RAM(5.3);(9) After the flow control module (4) receives the flow control signal (19), the control flow detection module (4.2) reads the fifth dual-port RAM (5.3);
(十)流检测模块(4.2)在读取的数据中获取GVSP数据包的Block ID、Packet ID以及图像数据,并根据Block ID和Packet ID对丢包情况进行判断,如果发现丢包,则产生丢包重发控制信号(15);(10) flow detection module (4.2) obtains Block ID, Packet ID and image data of GVSP packet in the data read, and according to Block ID and Packet ID, packet loss situation is judged, if find packet loss, then generate Packet loss retransmission control signal (15);
(十一)图像存储控制模块(4.1)从存储控制信号(14)中获取图像存储首地址,根据图像数据的Packet ID以及图像数据的长度计算出该数据包中图像数据的存储地址,并控制Avalon Memory-Mapped主接口将图像数据写入图像存储RAM;当写入一幅完整的图像数据后,图像存储控制模块(4.1)则产生存储反馈信号(13)。(11) image storage control module (4.1) obtains image storage first address from storage control signal (14), calculates the storage address of image data in this data packet according to the Packet ID of image data and the length of image data, and controls The Avalon Memory-Mapped main interface writes the image data into the image storage RAM; when a complete image data is written, the image storage control module (4.1) generates a storage feedback signal (13).
与现有技术相比,本发明具有以下优点:Compared with the prior art, the present invention has the following advantages:
1.本发明针对GigE Vision协议设计轻量级的以太网控制器,兼容GigEVision 1.0以GigE Vision 2.0协议,在硬件逻辑上实现协议过滤与解析,扁平化的设计大大减少以太网控制器的复杂度,减少硬件逻辑上的消耗,在提高图像传输速度的同时,降低系统的成本。1. The present invention designs a lightweight Ethernet controller for the GigE Vision protocol, compatible with GigE Vision 1.0 and GigE Vision 2.0 protocols, and implements protocol filtering and analysis on hardware logic, and the flat design greatly reduces the complexity of the Ethernet controller , reduce the consumption of hardware logic, and reduce the cost of the system while increasing the image transmission speed.
2.本发明利用硬件逻辑自动封包或解析基于GigE Vision协议的网络数据,使得网络数据的封包和过滤不需要软件的干预,从而大大降低了软件系统的负担。2. The present invention uses hardware logic to automatically package or analyze network data based on the GigE Vision protocol, so that the package and filtering of network data does not require software intervention, thereby greatly reducing the burden on the software system.
3.本发明自动拼接和存储图像数据,图像数据接收过程可以完全脱离CPU而独立运行,从最大程度减小CPU占用率。3. The present invention automatically stitches and stores image data, and the image data receiving process can be completely separated from the CPU and run independently, thereby reducing the CPU usage to the greatest extent.
4.使用本发明进行开发,使用者无须构建多任务的软件环境,也无须掌握以太网帧的组成方式、IP协议、UDP协议、GigE Vision协议的具体内容,更无需关心GVSP数据的处理方法,使用者只须在系统中加入本发明所述的IP核,对寄存器进行简单的配置,便可以实现GigE相机的访问和图像的采集,从而最大程度上降低了图像采集系统的开发难度,能够实现大范围的推广和应用。4. Using the present invention to develop, the user does not need to build a multi-tasking software environment, and does not need to grasp the specific content of the composition of the Ethernet frame, the IP protocol, the UDP protocol, and the GigE Vision protocol, and does not need to care about the processing method of the GVSP data. The user only needs to add the IP core of the present invention to the system, and simply configure the registers to realize the access of the GigE camera and the acquisition of images, thereby reducing the development difficulty of the image acquisition system to the greatest extent, and realizing Large-scale promotion and application.
附图说明Description of drawings
图1为本发明实施案例的硬件系统框图;Fig. 1 is the hardware system block diagram of the embodiment of the present invention;
图2为本发明实施案例的系统模块框图;Fig. 2 is the system block diagram of the embodiment of the present invention;
图3为本发明的接口示意图;Fig. 3 is the interface diagram of the present invention;
图4为本发明的结构框图;Fig. 4 is a structural block diagram of the present invention;
图5为本发明的处理流程图;Fig. 5 is the processing flowchart of the present invention;
图6为本发明实施案例的发送操作流程图;Fig. 6 is the flow chart of the sending operation of the embodiment of the present invention;
图7为本发明实施案例的接收操作流程图。Fig. 7 is a flow chart of the receiving operation of the embodiment of the present invention.
具体实施方式Detailed ways
参照图1,一种基于GigE Vision协议的以太网控制器IP核采用FPGA系统进行实现,实施所采用的主要硬件包括FPGA模块、EPCS管理模块、电源管理模块、SSRAM、PHY芯片及其模块以及GigE相机,使用的具体芯片为:Referring to Figure 1, an Ethernet controller IP core based on the GigE Vision protocol is implemented using an FPGA system. The main hardware used in the implementation includes FPGA modules, EPCS management modules, power management modules, SSRAM, PHY chips and their modules, and GigE Camera, the specific chip used is:
[1]所述实施系统采用的FPGA采用Altera公司的Stratix II系列的EP2S60F672C3N芯片;[1] The FPGA adopted by the implementation system adopts the EP2S60F672C3N chip of the Stratix II series of Altera Company;
[2]所述实施系统采用的SSRAM为Cypress公司的CY7C1380D芯片;[2] The SSRAM adopted by the implementation system is the CY7C1380D chip of Cypress Company;
[3]所述实施系统采用的PHY芯片为Marvell公司的88E1111芯片;[3] The PHY chip used in the implementation system is the 88E1111 chip of Marvell;
[4]所述实施系统采用的GigE相机为Basler公司的acA640-90gc相机。[4] The GigE camera used in the implementation system is the acA640-90gc camera of Basler Company.
参照图2,实施案例在FPGA上所采用的IP模块包括NIOS II微处理器、外部RAM模块接口、图像存储模块、本发明所述的基于GigE Vision协议的以太网控制器IP核以及其他模块。With reference to Fig. 2, the IP module that implementation case adopts on FPGA comprises NIOS II microprocessor, external RAM module interface, image storage module, Ethernet controller IP core and other modules based on GigE Vision protocol of the present invention.
参照图3,本实施案例中所实现的基于GigE Vision协议的以太网控制器IP核的接口包括Avalon Memory-Mapped主接口、Avalon Memory-Mapped从接口、PHY管理接口以及GMII接口。Referring to Figure 3, the interfaces of the Ethernet controller IP core based on the GigE Vision protocol implemented in this implementation case include Avalon Memory-Mapped master interface, Avalon Memory-Mapped slave interface, PHY management interface and GMII interface.
所述GVSP接收模块提供的Avalon Memory-Mapped主接口信号为片选信号、请求等待信号、写使能信号、读使能信号、32位地址信号、32位读数据信号以及32位写数据信号。The Avalon Memory-Mapped main interface signal provided by the GVSP receiving module is a chip select signal, a request waiting signal, a write enable signal, a read enable signal, a 32-bit address signal, a 32-bit read data signal and a 32-bit write data signal.
所述的Avalon Memory-Mapped从接口信号为系统时钟信号、125MHz GMII发送时钟、系统复位信号、片选信号、读使能信号、写使能信号、14位地址信号、32位写数据信号以及32位读数据信号。The Avalon Memory-Mapped slave interface signals are system clock signal, 125MHz GMII sending clock, system reset signal, chip select signal, read enable signal, write enable signal, 14-bit address signal, 32-bit write data signal and 32-bit bit read data signal.
所述的PHY管理接口信号为2MHz MDC信号以及MDIO信号。The PHY management interface signals are 2MHz MDC signals and MDIO signals.
所述的GMII发送接口信号为125MHz GMII发送时钟、发送使能信号、发送错误信号、发送数据信号、接收时钟、接收数据有效信号、接收错误信号、接收数据信号、载波侦听信号以及冲突检测信号。Described GMII sending interface signal is 125MHz GMII sending clock, sending enable signal, sending error signal, sending data signal, receiving clock, receiving data valid signal, receiving error signal, receiving data signal, carrier sense signal and conflict detection signal .
参照图4,本实施案例中所实现的基于GigE Vision协议的以太网控制器IP核包括控制模块1、PHY管理接口模块2、发送控制模块3、流控制模块4、接收控制模块5,通过Avalon Memory-Mapped从接口与CPU连接,通过AvalonMemory-Mapped主接口与图像存储RAM连接,通过PHY管理接口及GMII接口与PHY连接。Referring to Figure 4, the Ethernet controller IP core based on the GigE Vision protocol implemented in this implementation case includes a control module 1, a PHY management interface module 2, a sending control module 3, a flow control module 4, and a receiving control module 5. The Memory-Mapped slave interface is connected to the CPU, the AvalonMemory-Mapped master interface is connected to the image storage RAM, and the PHY management interface and GMII interface are connected to the PHY.
所述的控制模块1包含寄存器单元1.1、模块控制单元1.2以及总线控制单元1.3,接收NIOS处理器发送的总线信息,控制其他模块。寄存器单元1.1用于存放控制信息、状态信息、本机网络地址信息以及相机网络地址信息;模块控制单元1.2根据寄存器信息、PHY访问反馈信号7、发送反馈信号10、接受反馈信号12及存储反馈信号13生成PHY访问控制信号6、发送控制信号8、接收控制信号11以及存储控制信号14;总线控制单元1.3获取Avalon Memory-Mapped从接口信息,操作寄存器单元1.1、第一双端口RAM 3.1、第三双端口RAM 5.1或第四双端口RAM 5.2。The control module 1 includes a register unit 1.1, a module control unit 1.2 and a bus control unit 1.3, receives bus information sent by the NIOS processor, and controls other modules. Register unit 1.1 is used to store control information, status information, local network address information and camera network address information; module control unit 1.2 accesses feedback signal 7, sends feedback signal 10, receives feedback signal 12 and stores feedback signal according to register information and PHY 13 generate PHY access control signal 6, send control signal 8, receive control signal 11 and store control signal 14; bus control unit 1.3 obtains Avalon Memory-Mapped slave interface information, operates register unit 1.1, first dual-port RAM 3.1, third Dual-port RAM 5.1 or fourth dual-port RAM 5.2.
所述MAC控制模块1具有接收中断请求功能,模块控制单元1.2根据接收反馈信号12、存储反馈信号13产生中断信号,CPU通过读取接收状态寄存器判断中断类型。The MAC control module 1 has the function of receiving an interrupt request. The module control unit 1.2 generates an interrupt signal according to the received feedback signal 12 and the stored feedback signal 13. The CPU judges the interrupt type by reading the receiving status register.
所述的寄存器单元1.1包含MAC控制寄存器、MAC状态寄存器、中断控制寄存器、中断状态寄存器、PHY控制寄存器、PHY读数据寄存器、PHY写数据寄存器、发送控制寄存器、接收控制寄存器、流控制寄存器、本机MAC地址寄存器、本机IP地址寄存器、GVCP端口号寄存器、GVSP端口号寄存器、相机MAC地址寄存器以及相机IP地址寄存器。The register unit 1.1 includes MAC control register, MAC status register, interrupt control register, interrupt status register, PHY control register, PHY read data register, PHY write data register, send control register, receive control register, flow control register, this Machine MAC address register, local IP address register, GVCP port number register, GVSP port number register, camera MAC address register and camera IP address register.
所述的总线控制单元1.3对来自Avalon Memory-Mapped从接口的地址和控制信号进行解析,实现CPU对IP核中不同的地址空间进行访问,其中地址的分配如表1所示:Described bus control unit 1.3 resolves the address and the control signal from the Avalon Memory-Mapped slave interface, realizes that CPU accesses different address spaces in the IP core, wherein the distribution of addresses is as shown in Table 1:
表1总线控制单元(1.3)对IP核不同访问空间的地址分配Table 1 The address assignment of the bus control unit (1.3) to different access spaces of the IP core
所述的PHY访问控制信号6为PHY访问使能信号、5位PHY寄存器地址信号、32位PHY寄存器写数据信号以及32位PHY寄存器读数据信号。The PHY access control signal 6 is a PHY access enable signal, a 5-bit PHY register address signal, a 32-bit PHY register write data signal, and a 32-bit PHY register read data signal.
所述的PHY访问反馈信号7为PHY管理接口模块忙信号。The PHY access feedback signal 7 is a busy signal of the PHY management interface module.
所述的发送控制信号8为本机及相机48位MAC地址、本机及相机32位IP地址、本机16位GVCP端口号、发送使能信号、16位发送协议类型以及9位发送数据长度(单位:字节)。The sending control signal 8 is the 48-bit MAC address of the machine and the camera, the 32-bit IP address of the machine and the camera, the 16-bit GVCP port number of the machine, the sending enable signal, the 16-bit sending protocol type, and the 9-bit sending data length (unit: byte).
所述的发送反馈信号10为发送控制模块忙信号。The sending feedback signal 10 is a busy signal of the sending control module.
所述的接收控制信号11为本机及相机48位MAC地址、本机及相机32位IP地址、本机16位GVCP端口号以及本机16位GVSP端口号。The receiving control signal 11 is the 48-bit MAC address of the machine and the camera, the 32-bit IP address of the machine and the camera, the 16-bit GVCP port number of the machine and the 16-bit GVSP port number of the machine.
所述的接收反馈信号12为接收完成信号、16位接收协议类型、11位GVSP数据地址以及11位接收数据长度(单位:字节)。The receiving feedback signal 12 is a receiving completion signal, 16-bit receiving protocol type, 11-bit GVSP data address and 11-bit receiving data length (unit: byte).
所述的存储控制信号14为存储使能信号以及32位图像存储首地址。The storage control signal 14 is a storage enable signal and a 32-bit image storage first address.
所述的存储反馈信号13为图像存储完成信号。The storage feedback signal 13 is an image storage completion signal.
所述的PHY管理接口模块2用于访问PHY寄存器,根据PHY访问控制信号6及PHY管理接口时序规范,自动生成MDC时钟和MDIO数据,控制PHY管理接口,访问PHY寄存器,生成PHY访问反馈信号7。The PHY management interface module 2 is used to access the PHY registers, automatically generates the MDC clock and MDIO data according to the PHY access control signal 6 and the PHY management interface timing specification, controls the PHY management interface, accesses the PHY registers, and generates the PHY access feedback signal 7 .
发送控制模块3包含第一双端口RAM3.1、协议封包模块3.2、第二双端口RAM 3.3以及GMII发送模块3.4,根据发送控制信号8、ARP发送控制信号17以及丢包重发控制信号15自动发送相应的以太网数据包,生成发送反馈信号10;第一双端口RAM3.1通过发送数据写入总线9接收发送数据并缓存,将发送数据从系统所在时钟域转换到GMII发送模块3.4所在时钟域;协议封包模块3.2包含IP协议封包模块3.2.1、UDP协议封包模块3.2.2、GVCP协议封包模块3.2.3以及ARP协议封包模块3.2.4,根据发送控制信号8、ARP发送控制信号17以及丢包重发控制信号15,自动为发送数据封包网络协议,将包首数据存入第二双端口RAM 3.3;第二双端口RAM 3.3用于存储生成的包首数据;GMII发送模块3.4包含CRC-32生成模块3.4.1,将第一双端口RAM3.1和第二双端口RAM 3.3的数据组合成为以太网帧并发送;CRC-32生成模块3.4.1自动生成32位CRC校验码;Sending control module 3 includes first dual-port RAM 3.1, protocol packet module 3.2, second dual-port RAM 3.3 and GMII sending module 3.4, according to sending control signal 8, ARP sending control signal 17 and packet loss retransmission control signal 15 automatically Send the corresponding Ethernet data packet and generate the sending feedback signal 10; the first dual-port RAM 3.1 receives and buffers the sending data by writing the sending data into the bus 9, and converts the sending data from the clock domain where the system is located to the clock where the GMII sending module 3.4 is located Domain; Protocol packet module 3.2 comprises IP protocol packet module 3.2.1, UDP protocol packet module 3.2.2, GVCP protocol packet module 3.2.3 and ARP protocol packet module 3.2.4, sends control signal 17 according to sending control signal 8, ARP And packet loss retransmission control signal 15, for sending data packet network protocol automatically, the packet header data is stored in the second dual-port RAM 3.3; the second dual-port RAM 3.3 is used to store the generated packet header data; GMII sending module 3.4 includes CRC-32 generation module 3.4.1, combines the data of the first dual-port RAM3.1 and the second dual-port RAM 3.3 into an Ethernet frame and sends it; CRC-32 generation module 3.4.1 automatically generates a 32-bit CRC check code ;
所述的发送控制模块(3)具有ARP协议自动应答功能,能够根据ARP发送控制信号(17),自动发送ARP应答数据包,并将上位机的MAC地址及IP地址进行记录。The sending control module (3) has an ARP protocol automatic response function, and can automatically send an ARP response data packet according to the ARP sending control signal (17), and record the MAC address and IP address of the host computer.
所述的发送控制模块(3)具有GVSP数据包重发请求功能,能够丢包重发控制信号(15),自动生成数据包重发命令,请求相机重发相应的GVSP数据包。The sending control module (3) has a GVSP data packet resending request function, can resend the control signal (15) when the packet is lost, automatically generate a data packet resending command, and request the camera to resend the corresponding GVSP data packet.
所述的第一双端口RAM 9使用FPGA片上存储块实现,第一双端口RAM 9写端口使用系统时钟,数据位宽为32位,读端口使用GMII发送时钟,数据为宽为8位。Described first dual-port RAM 9 uses FPGA on-chip storage block to realize, and the first dual-port RAM 9 write port uses system clock, and data bit width is 32 bits, and read port uses GMII to send clock, and data is wide and is 8 bits.
所述的ARP发送控制信号17为ARP发送请求信号、48位主机MAC地址以及32位主机IP地址。The ARP transmission control signal 17 is an ARP transmission request signal, a 48-bit host MAC address and a 32-bit host IP address.
所述的丢包重发控制信号15为重发请求信号、16位GVSP端口号、24位重发数据包的最小ID和最大ID。The packet loss retransmission control signal 15 is a retransmission request signal, a 16-bit GVSP port number, and a 24-bit minimum ID and maximum ID of the retransmission data packet.
所述的流控制模块4包含图像存储控制模块4.1以及流检测模块4.2,通过GVSP数据读取总线18读取GVSP数据,将图像数据写入图像存储RAM中,生成存储反馈信号13,同时检测丢包情况,控制丢包重发控制信号15。流检测模块4.2读取第五双端口RAM 5.3,根据GVSP协议获取图像数据包ID号及图像数据,检测丢包情况,生成丢包重发控制信号15。图像存储控制模块4.1根据图像数据包ID号,控制Avalon Memory-Mapped主接口,将图像数据写入图像存储RAM中。Described flow control module 4 comprises image storage control module 4.1 and flow detection module 4.2, reads GVSP data by GVSP data reading bus 18, writes image data in the image storage RAM, generates storage feedback signal 13, detects missing Packet situation, control packet loss retransmission control signal 15. The flow detection module 4.2 reads the fifth dual-port RAM 5.3, obtains the image data packet ID number and image data according to the GVSP protocol, detects packet loss, and generates a packet loss retransmission control signal 15. The image storage control module 4.1 controls the Avalon Memory-Mapped main interface according to the image data packet ID number, and writes the image data in the image storage RAM.
所述的接收控制模块5包含第三双端口RAM 5.1、第四双端口RAM 5.2、第五双端口RAM 5.3、协议解析模块5.4、异步FIFO 5.5以及GMII接收模块5.6,接收以太网数据包,根据接收控制信号11对其进行解析,并生成接收反馈信号12和流控制信号19。GMII接收模块5.6内嵌CRC-32检验模块5.6.1,接收网络数据包,将其写入异步FIFO 5.5中,并对其进行校验;异步FIFO 5.5缓存接收的以太网数据,将数据从GMII接收时钟所在时钟域转换到协议解析模块所在时钟域;第三双端口RAM 5.1缓存接收的GVCP数据;第五双端口RAM 5.3缓存接收的GVSP数据;第四双端口RAM 5.2缓存接收的其他数据;协议解析模块5.4包含ARP协议解析模块5.4.1、IP协议解析模块5.4.5、UDP协议解析模块5.4.4、GVCP协议解析模块5.4.2以及GVSP协议解析模块5.4.3,根据接收控制信号11读取异步FIFO 5.5,对接收的数据进行解析,并将解析的数据分别存入不同的双端口RAM中,第三双端口RAM 5.1缓存接收的GVCP数据;第五双端口RAM 5.3缓存接收的GVSP数据;第四双端口RAM 5.2缓存接收的其他数据。第三双端口RAM 5.1、第四双端口RAM 5.2缓存的数据通过接收数据读取总线16发送至MAC控制模块1,第五双端口RAM 5.3缓存的数据通过GVSP数据读取总线18发送至流控制模块4。Described receiving control module 5 comprises the 3rd dual-port RAM 5.1, the 4th dual-port RAM 5.2, the 5th dual-port RAM 5.3, protocol analysis module 5.4, asynchronous FIFO 5.5 and GMII receiving module 5.6, receive Ethernet packet, according to The reception control signal 11 parses it and generates a reception feedback signal 12 and a flow control signal 19 . GMII receiving module 5.6 is embedded with CRC-32 checking module 5.6.1, receives network data packets, writes them into asynchronous FIFO 5.5, and checks them; asynchronous FIFO 5.5 caches received Ethernet data, and sends data from GMII The clock domain where the receiving clock is located is converted to the clock domain where the protocol analysis module is located; the third dual-port RAM 5.1 buffers the received GVCP data; the fifth dual-port RAM 5.3 buffers the received GVSP data; the fourth dual-port RAM 5.2 buffers other data received; Protocol analysis module 5.4 comprises ARP agreement analysis module 5.4.1, IP agreement analysis module 5.4.5, UDP agreement analysis module 5.4.4, GVCP agreement analysis module 5.4.2 and GVSP agreement analysis module 5.4.3, according to receiving control signal 11 Read the asynchronous FIFO 5.5, analyze the received data, and store the analyzed data in different dual-port RAMs, the third dual-port RAM 5.1 buffers the received GVCP data; the fifth dual-port RAM 5.3 buffers the received GVSP data; the fourth dual-port RAM 5.2 buffers other data received. The data buffered by the third dual-port RAM 5.1 and the fourth dual-port RAM 5.2 are sent to the MAC control module 1 through the receiving data read bus 16, and the data buffered by the fifth dual-port RAM 5.3 is sent to the flow control through the GVSP data read bus 18 Module 4.
所述的第三双端口RAM 5.1、第四双端口RAM 5.2和第五双端口RAM 5.3使用FPGA片上存储块实现,写端口使用GMII发送时钟,数据位宽为32位,读端口使用系统时钟,数据为宽为8位。The third dual-port RAM 5.1, the fourth dual-port RAM 5.2 and the fifth dual-port RAM 5.3 are implemented using FPGA on-chip storage blocks, the write port uses GMII to send the clock, the data bit width is 32 bits, and the read port uses the system clock. The data is 8 bits wide.
所述的异步FIFO 5.5使用FPGA片上存储块实现,写端口使用GMII接收时钟,数据位宽为32位,读端口使用GMII发送时钟,数据为宽为8位。The asynchronous FIFO 5.5 is implemented using FPGA on-chip storage blocks, the write port uses GMII receiving clock, the data bit width is 32 bits, and the read port uses GMII sending clock, and the data width is 8 bits.
参照图5,本实施案例中所实现的基于GigE Vision协议的以太网控制器IP核的工作流程为:Referring to Figure 5, the workflow of the Ethernet controller IP core based on the GigE Vision protocol implemented in this implementation case is:
Avalon Memory-Mapped从接口的解析:Avalon Memory-Mapped from the analysis of the interface:
[1]总线控制单元1.3实施监控Avalon Memory-Mapped从接口;检测片选信号、读/写信号以及地址信号;[1] Bus control unit 1.3 monitors Avalon Memory-Mapped slave interface; detects chip select signal, read/write signal and address signal;
[2]片选信号有效时,总线控制单元1.3根据读/写信号以及地址信号,判断CPU所需访问的资源,并对相应资源进行读/写使能,同时将地址解析,使得CPU对访问空间进行操作。[2] When the chip select signal is valid, the bus control unit 1.3 judges the resource that the CPU needs to access according to the read/write signal and the address signal, and enables the read/write of the corresponding resource, and analyzes the address at the same time, so that the CPU can access space to operate.
发送以太网数据:Send ethernet data:
[1]模块控制单元1.2实时检测发送反馈信号10,并将发送状态写入寄存器单元1.1中,供CPU读取;[1] The module control unit 1.2 detects the sending feedback signal 10 in real time, and writes the sending status into the register unit 1.1 for the CPU to read;
[2]模块控制单元1.2实时检测寄存器单元1.1,检测到发送命令后,生成相应的发送控制信号8;[2] The module control unit 1.2 detects the register unit 1.1 in real time, and generates a corresponding sending control signal 8 after detecting the sending command;
[3]协议封包模块3.2读取发送控制信号8,生成相应的协议包首,并将包首数据存入第二双端口RAM3.3中;[3] The protocol packet module 3.2 reads the sending control signal 8, generates a corresponding protocol packet header, and stores the packet header data in the second dual-port RAM3.3;
[4]GMII发送模块3.4读取第一双端口RAM3.1和第二双端口RAM3.3中的数据,形成以太网帧进行发送;[4] GMII sending module 3.4 reads the data in the first dual-port RAM3.1 and the second dual-port RAM3.3, forms Ethernet frame and sends;
[5]在此同时,发送控制模块3产生发送反馈信号10;。[5] At the same time, the sending control module 3 generates a sending feedback signal 10;.
接收以太网数据:Receive Ethernet data:
[1]GMII接收模块5.6实时接收广播数据包或发送至本地MAC地址的数据包,并将数据写入异步FIFO 5.5;[1] The GMII receiving module 5.6 receives the broadcast data packet or the data packet sent to the local MAC address in real time, and writes the data into the asynchronous FIFO 5.5;
[2]协议解析模块5.4读取异步FIFO 5.5中的数据,对数据包的协议进行解析;[2] The protocol analysis module 5.4 reads the data in the asynchronous FIFO 5.5, and analyzes the protocol of the data packet;
[3]如果数据包为ARP请求数据包,ARP协议解析模块5.4.1根据请求数据,产生ARP请求信号,请求发送控制模块3发送ARP应答数据包;[3] If the data packet is an ARP request packet, the ARP protocol analysis module 5.4.1 generates an ARP request signal according to the request data, and requests the sending control module 3 to send the ARP response packet;
[4]如果数据包为IP数据包,IP协议解析模块5.4.5进一步对数据包的协议进行解析,判断该数据包是否为UDP数据包;[4] If the data packet is an IP data packet, the IP protocol analysis module 5.4.5 further analyzes the protocol of the data packet, and judges whether the data packet is a UDP data packet;
[5]如果数据包为UDP数据包,UDP协议解析模块5.4.4判断目的端口号,判断该数据包是否为GVCP数据包或者GVSP数据包;[5] If the data packet is a UDP data packet, the UDP protocol analysis module 5.4.4 judges the destination port number, and judges whether the data packet is a GVCP data packet or a GVSP data packet;
[6]如果数据包为GVCP数据包,GVCP解析模块5.4.2解析数据包,将GVCP数据写入第三双端口RAM 5.1,并产生相应的接收反馈信号12;[6] If the data packet is a GVCP data packet, the GVCP parsing module 5.4.2 parses the data packet, writes the GVCP data into the third dual-port RAM 5.1, and generates a corresponding receiving feedback signal 12;
[7]如果数据包为GVSP数据包,GVSP解析模块5.4.3解析数据包,将GVSP数据写入第五双端口RAM 5.3,并产生流控制信号19;[7] If the data packet is a GVSP data packet, the GVSP analysis module 5.4.3 parses the data packet, writes the GVSP data into the fifth dual-port RAM 5.3, and generates a flow control signal 19;
[8]协议解析模块5.4将其他数据包写入第四双端口RAM 5.2,并产生相应的接收反馈信号12;[8] The protocol analysis module 5.4 writes other data packets into the fourth dual-port RAM 5.2, and generates a corresponding receiving feedback signal 12;
[9]流控制模块4接收到流控制信号19后,控制流检测模块4.2读取第五双端口RAM 5.3;[9] After the flow control module 4 receives the flow control signal 19, the control flow detection module 4.2 reads the fifth dual-port RAM 5.3;
[10]流检测模块4.2在读取的数据中获取GVSP数据包的Block ID、PacketID以及图像数据,并根据Block ID和Packet ID对丢包情况进行判断,如果发现丢包,则产生丢包重发控制信号15;[10] The flow detection module 4.2 obtains the Block ID, PacketID and image data of the GVSP packet in the read data, and judges the packet loss situation according to the Block ID and Packet ID. Send control signal 15;
[11]图像存储控制模块4.1从存储控制信号14中获取图像存储首地址,根据图像数据的Packet ID以及图像数据的长度计算出该数据包中图像数据的存储地址,并控制Avalon Memory-Mapped主接口将图像数据写入图像存储RAM;当写入一幅完整的图像数据后,图像存储控制模块4.1则产生存储反馈信号13。[11] The image storage control module 4.1 obtains the first address of the image storage from the storage control signal 14, calculates the storage address of the image data in the data packet according to the Packet ID of the image data and the length of the image data, and controls the Avalon Memory-Mapped master The interface writes the image data into the image storage RAM; when a complete image data is written, the image storage control module 4.1 generates a storage feedback signal 13 .
参照图6,CPU发送以太网数据所需的操作流程为:Referring to Figure 6, the operation flow required for the CPU to send Ethernet data is:
[1]读取发送状态寄存器,判断发送控制模块3是否处于发送状态,若发送控制模块3发送状态,则进行等待;[1] Read the sending status register to judge whether the sending control module 3 is in the sending state, if the sending control module 3 is in the sending state, then wait;
[2]如果等待时间过长,则返回发送错误提示,CPU需要对IP核进行重新配置;[2] If the waiting time is too long, an error message will be sent back, and the CPU needs to reconfigure the IP core;
[3]如果发送控制模块3处于闲置状态,CPU将发送数据写入第一双端口RAM 3.1所在的地址空间,将控制命令写入相应的寄存器空间;[3] If the sending control module 3 is in an idle state, the CPU writes the sending data into the address space where the first dual-port RAM 3.1 is located, and writes the control command into the corresponding register space;
[4]IP核接收到发送命令后,开始对发送数据封包,并进行发送。[4] After the IP core receives the send command, it starts to send the data packet and sends it.
参照图7,CPU接收以太网数据或图像数据所需的操作流程为:Referring to Fig. 7, the operation process required for the CPU to receive Ethernet data or image data is:
[1]CPU通过查询接收状态寄存器方式或者通过中断方式判断接收状态,并调用接收处理函数;[1] The CPU judges the receiving status by querying the receiving status register or interrupting, and calls the receiving processing function;
[2]CPU读取接收状态寄存器获取接收的数据类型,数据类型分为GVCP数据、单幅图像数据或者其他网络数据;[2] The CPU reads the receiving status register to obtain the received data type, and the data type is divided into GVCP data, single image data or other network data;
[3]若为GVCP数据,CPU根据需要读取GVCP数据,并进行相应操作;[3] If it is GVCP data, the CPU reads the GVCP data as needed and performs corresponding operations;
[4]若为图像数据,CPU根据实际需求,对图像进行处理,并执行相应操作;[4] If it is image data, the CPU processes the image according to actual needs and performs corresponding operations;
[5]若为其他数据,CPU根据需要读取数据,并进行相应操作。[5] If it is other data, the CPU reads the data as needed and performs corresponding operations.
在本实施案例中,基于GigE Vision协议的以太网控制器IP核大约消耗了2000多个逻辑单元、1500多个寄存器资源以及8000多字节的存储资源,在采集图像像素为640×480的灰度图像条件下,图像接收速率达到了90帧每秒,CPU占用率小于1%;在同样的测试条件下,使用Altera的三速以太网IP核实现此功能,消耗了4800多个逻辑单元、5300多个寄存器资源以及约19000字节的存储资源,此外,图像的接收需要额外加入DMA资源,GVSP数据包的解析需要使用者通过软件完成,开发成本高、资源占用量大。In this implementation case, the Ethernet controller IP core based on the GigE Vision protocol consumes more than 2000 logic units, more than 1500 register resources and more than 8000 bytes of storage resources. Under high-speed image conditions, the image receiving rate reached 90 frames per second, and the CPU usage rate was less than 1%. Under the same test conditions, using Altera's triple-speed Ethernet IP core to realize this function consumed more than 4800 logic units, More than 5,300 register resources and about 19,000 bytes of storage resources. In addition, image reception requires additional DMA resources, and the analysis of GVSP data packets needs to be completed by users through software, which leads to high development costs and large resource usage.
以上仅为本发明的一个具体实例,不构成对本发明的任何限制,因此,任何本领域的技术人员能思之的变化,都应落在本申请的保护范围内。The above is only a specific example of the present invention and does not constitute any limitation to the present invention. Therefore, any changes that those skilled in the art can conceive should fall within the protection scope of the present application.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510014943.4A CN104572574B (en) | 2015-01-12 | 2015-01-12 | Ethernet controller IP kernel and method based on gigabit Ethernet vision agreement |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510014943.4A CN104572574B (en) | 2015-01-12 | 2015-01-12 | Ethernet controller IP kernel and method based on gigabit Ethernet vision agreement |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN104572574A true CN104572574A (en) | 2015-04-29 |
| CN104572574B CN104572574B (en) | 2018-01-02 |
Family
ID=53088681
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510014943.4A Active CN104572574B (en) | 2015-01-12 | 2015-01-12 | Ethernet controller IP kernel and method based on gigabit Ethernet vision agreement |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN104572574B (en) |
Cited By (16)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105634957A (en) * | 2016-01-29 | 2016-06-01 | 广东顺德中山大学卡内基梅隆大学国际联合研究院 | Ethernet MAC (Media Access Control) sublayer controller and control method thereof |
| CN105681688A (en) * | 2016-03-18 | 2016-06-15 | 山西国惠光电科技有限公司 | Method for realizing infrared machine core of gige vision interface based on FPGA |
| CN106018910A (en) * | 2016-05-16 | 2016-10-12 | 中国电子科技集团公司第四十研究所 | Ethernet protocol analysis and trigger circuit and method in oscilloscope |
| CN106210483A (en) * | 2016-08-30 | 2016-12-07 | 合肥埃科光电科技有限公司 | A kind of ultrahigh speed industrial camera system |
| CN106656853A (en) * | 2016-12-27 | 2017-05-10 | 盛科网络(苏州)有限公司 | Method and apparatus for extracting data stream information from Ethernet chip in low delay mode |
| CN108206829A (en) * | 2017-12-28 | 2018-06-26 | 中国科学院西安光学精密机械研究所 | Method for realizing network communication by GigE Vision protocol based on FPGA |
| CN108933841A (en) * | 2017-05-27 | 2018-12-04 | 嘉兴鹏武电子科技有限公司 | A kind of control method and device of radio-frequency front-end equipment |
| CN109089029A (en) * | 2018-09-05 | 2018-12-25 | 暨南大学 | A kind of Gige Vision interface image Transmission system and method based on FPGA |
| CN109688066A (en) * | 2018-12-29 | 2019-04-26 | 合肥埃科光电科技有限公司 | A kind of network interface filtration drive method based on GigE Vision |
| CN110012025A (en) * | 2019-04-17 | 2019-07-12 | 浙江禾川科技股份有限公司 | Data transmission method, system and relevant apparatus in a kind of image acquisition process |
| CN114414590A (en) * | 2018-07-16 | 2022-04-29 | 同济大学 | Vehicular cluster vision detection device |
| CN115297187A (en) * | 2022-07-12 | 2022-11-04 | 重庆大学 | Conversion device and cluster system of network communication protocol and bus protocol |
| CN116320737A (en) * | 2023-05-10 | 2023-06-23 | 珠海星云智联科技有限公司 | Control method, equipment and medium for gigabit Ethernet standard industrial camera |
| CN117749912A (en) * | 2024-02-19 | 2024-03-22 | 浙江双元科技股份有限公司 | Data transmission control method and system based on FPGA module |
| CN118158487A (en) * | 2024-05-09 | 2024-06-07 | 深圳市深视智能科技有限公司 | Video data transmission system and method |
| EP4429229A4 (en) * | 2021-12-29 | 2025-02-26 | Hangzhou Hikrobot Co., Ltd. | IMAGE ACQUISITION CARD, IMAGE ACQUISITION METHOD AND IMAGE ACQUISITION SYSTEM |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101393010A (en) * | 2008-08-11 | 2009-03-25 | 张育民 | Embedded vision detecting system |
| CN102044063A (en) * | 2010-12-23 | 2011-05-04 | 中国科学院自动化研究所 | FPGA (Field Programmable Gate Array) and DSP (Digital Signal Processor) based machine vision system |
| US8219785B1 (en) * | 2006-09-25 | 2012-07-10 | Altera Corporation | Adapter allowing unaligned access to memory |
| CN103647925A (en) * | 2013-07-31 | 2014-03-19 | 中南大学 | Embedded parallel multi-channel digital image acquisition system based on GigE interface |
-
2015
- 2015-01-12 CN CN201510014943.4A patent/CN104572574B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8219785B1 (en) * | 2006-09-25 | 2012-07-10 | Altera Corporation | Adapter allowing unaligned access to memory |
| CN101393010A (en) * | 2008-08-11 | 2009-03-25 | 张育民 | Embedded vision detecting system |
| CN102044063A (en) * | 2010-12-23 | 2011-05-04 | 中国科学院自动化研究所 | FPGA (Field Programmable Gate Array) and DSP (Digital Signal Processor) based machine vision system |
| CN103647925A (en) * | 2013-07-31 | 2014-03-19 | 中南大学 | Embedded parallel multi-channel digital image acquisition system based on GigE interface |
Non-Patent Citations (1)
| Title |
|---|
| 李航: "基于FPGA和千兆以太网(GigE)的图像处理系统设计", 《中国优秀博硕士学位论文全文数据库》 * |
Cited By (26)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105634957A (en) * | 2016-01-29 | 2016-06-01 | 广东顺德中山大学卡内基梅隆大学国际联合研究院 | Ethernet MAC (Media Access Control) sublayer controller and control method thereof |
| CN105681688A (en) * | 2016-03-18 | 2016-06-15 | 山西国惠光电科技有限公司 | Method for realizing infrared machine core of gige vision interface based on FPGA |
| CN106018910A (en) * | 2016-05-16 | 2016-10-12 | 中国电子科技集团公司第四十研究所 | Ethernet protocol analysis and trigger circuit and method in oscilloscope |
| CN106018910B (en) * | 2016-05-16 | 2018-11-20 | 中国电子科技集团公司第四十一研究所 | Ethernet protocol analysis and trigger circuit and method in a kind of oscillograph |
| CN106210483A (en) * | 2016-08-30 | 2016-12-07 | 合肥埃科光电科技有限公司 | A kind of ultrahigh speed industrial camera system |
| CN106656853B (en) * | 2016-12-27 | 2019-08-16 | 盛科网络(苏州)有限公司 | The method and device of traffic flow information is extracted under Ethernet chip low-delay mode |
| CN106656853A (en) * | 2016-12-27 | 2017-05-10 | 盛科网络(苏州)有限公司 | Method and apparatus for extracting data stream information from Ethernet chip in low delay mode |
| CN108933841A (en) * | 2017-05-27 | 2018-12-04 | 嘉兴鹏武电子科技有限公司 | A kind of control method and device of radio-frequency front-end equipment |
| CN108206829B (en) * | 2017-12-28 | 2020-06-16 | 中国科学院西安光学精密机械研究所 | Method for realizing network communication by GigE Vision protocol based on FPGA |
| CN108206829A (en) * | 2017-12-28 | 2018-06-26 | 中国科学院西安光学精密机械研究所 | Method for realizing network communication by GigE Vision protocol based on FPGA |
| CN114414590A (en) * | 2018-07-16 | 2022-04-29 | 同济大学 | Vehicular cluster vision detection device |
| CN109089029A (en) * | 2018-09-05 | 2018-12-25 | 暨南大学 | A kind of Gige Vision interface image Transmission system and method based on FPGA |
| CN109089029B (en) * | 2018-09-05 | 2020-11-13 | 暨南大学 | An FPGA-based Gige Vision interface image transmission system and method |
| CN109688066B (en) * | 2018-12-29 | 2020-11-13 | 合肥埃科光电科技有限公司 | Gateway filtering driving method based on GigE Vision |
| CN109688066A (en) * | 2018-12-29 | 2019-04-26 | 合肥埃科光电科技有限公司 | A kind of network interface filtration drive method based on GigE Vision |
| CN110012025A (en) * | 2019-04-17 | 2019-07-12 | 浙江禾川科技股份有限公司 | Data transmission method, system and relevant apparatus in a kind of image acquisition process |
| CN110012025B (en) * | 2019-04-17 | 2020-10-30 | 浙江禾川科技股份有限公司 | Data transmission method, system and related device in image acquisition process |
| EP4429229A4 (en) * | 2021-12-29 | 2025-02-26 | Hangzhou Hikrobot Co., Ltd. | IMAGE ACQUISITION CARD, IMAGE ACQUISITION METHOD AND IMAGE ACQUISITION SYSTEM |
| CN115297187A (en) * | 2022-07-12 | 2022-11-04 | 重庆大学 | Conversion device and cluster system of network communication protocol and bus protocol |
| CN115297187B (en) * | 2022-07-12 | 2023-11-17 | 重庆大学 | Conversion device of network communication protocol and bus protocol and cluster system |
| CN116320737B (en) * | 2023-05-10 | 2023-08-18 | 珠海星云智联科技有限公司 | Control method, equipment and medium for gigabit Ethernet standard industrial camera |
| CN116320737A (en) * | 2023-05-10 | 2023-06-23 | 珠海星云智联科技有限公司 | Control method, equipment and medium for gigabit Ethernet standard industrial camera |
| CN117749912A (en) * | 2024-02-19 | 2024-03-22 | 浙江双元科技股份有限公司 | Data transmission control method and system based on FPGA module |
| CN117749912B (en) * | 2024-02-19 | 2024-05-10 | 浙江双元科技股份有限公司 | Data transmission control method and system based on FPGA module |
| CN118158487A (en) * | 2024-05-09 | 2024-06-07 | 深圳市深视智能科技有限公司 | Video data transmission system and method |
| CN118158487B (en) * | 2024-05-09 | 2024-08-06 | 深圳市深视智能科技有限公司 | Video data transmission system and method |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104572574B (en) | 2018-01-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104572574B (en) | Ethernet controller IP kernel and method based on gigabit Ethernet vision agreement | |
| CN102065569B (en) | Ethernet MAC sublayer controller suitable for WLAN | |
| CN109089029B (en) | An FPGA-based Gige Vision interface image transmission system and method | |
| CN103888293B (en) | Data channel scheduling method of multichannel FC network data simulation system | |
| CN103178872B (en) | Method and the device of USB system transfers distance is extended by Ethernet | |
| CN111177065B (en) | Multi-chip interconnection method and device | |
| CN101873337A (en) | A zero-copy data capture technology based on rt8169 gigabit network card and Linux operating system | |
| CN108243185A (en) | Scientific grade CCD Gigabit Ethernet communication system and method based on AX88180 | |
| CN103595598A (en) | Remote transparent transmission serial server based on fiber and control mode thereof | |
| CN105357147A (en) | High-speed and high-reliability network-on-chip adapter unit | |
| CN108206829B (en) | Method for realizing network communication by GigE Vision protocol based on FPGA | |
| CN116089331A (en) | A TTE network communication method based on RDMA | |
| CN104598430A (en) | Network interface interconnection design and control system of CPU interconnection expansion system | |
| CN106502951A (en) | PCIE interface data ferry-boat card and its method for ferry-boat data | |
| CN115550606A (en) | An image acquisition system and method based on a network protocol | |
| CN102123049B (en) | Cache synchronization method based on MAC (Multi-Access Computer) address transmission | |
| CN102790663B (en) | Full-hardware network interface applied to very long baseline interferometry (VLBI) hardware related processor | |
| CN104850518B (en) | method for remotely logging in computer | |
| CN104102550A (en) | Method for communicating among multiple host machine processes | |
| CN110311814B (en) | Programmable NoC 10 Gigabit Ethernet Resource Network Interface System | |
| CN104038569A (en) | Trunking communication model based on address mapping | |
| CN102438335B (en) | A medium and long-distance wireless sensor network networking system | |
| KR20120012354A (en) | Load-saving TOE network device | |
| Wang et al. | An optimized RDMA QP communication mechanism for hyperscale AI infrastructure | |
| CN203243361U (en) | IEEE1394-Ethernet protocol converter |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |