Disclosure of Invention
In order to overcome the problems in the prior art, the invention aims to provide a debugging device based on a high-speed serial port of a thermal power plant and a using method thereof.
In order to achieve the purpose, the invention adopts the following technical scheme:
a debugging device based on a high-speed serial port of a thermal power plant comprises an embedded central processing unit, a memory, a network card, a memory, an FPGA and the high-speed serial port, wherein the memory, the network card and the memory are all connected with the embedded central processing unit, and the embedded central processing unit and the high-speed serial port are all connected with the FPGA; the network card is connected with an upper computer; the high-speed serial port is connected with an IO branch of the controller to be monitored, and a plurality of IO clamping pieces are arranged on the IO branch.
The invention has the further improvement that the memory adopts a FLASH chip; the memory is connected with the embedded central processing unit through the SPI bus.
The invention has the further improvement that the high-speed serial port is connected with the IO branch of the controller to be monitored through the high-speed IO BUS.
The invention is further improved in that the memory and the FPGA are connected through a PCI-E bus.
According to the using method of the device, the high-speed serial port collects serial port data and transmits the serial port data to the FPGA, the FPGA writes the serial port data into a memory, the memory transmits the serial port data to the embedded central processing unit, and the embedded central processing unit writes the serial port data into a log in a storage; and the upper computer extracts the logs in the memory, screens the logs, obtains a data packet corresponding to the IO card and finishes debugging.
The invention has the further improvement that the memory comprises a plurality of sub-storage areas, each sub-storage area stores a plurality of pieces of serial port data, and the FPGA stores the serial port data into the sub-storage areas each time; the embedded central processing unit periodically judges the storage mark of the memory, and when the storage mark meets the batch reading standard, the embedded central processing unit reads the serial port data from the memory and writes the serial port data into the log in the memory.
The invention further improves that the logs in the memory are stored on the memory in a way that 20 logs are circularly stored; each log size is 20 MB.
The invention is further improved in that the upper computer extracts the log in the memory through the network card in an FTP mode.
The invention has the further improvement that the embedded central processing unit carries out the validity check on the serial port data and stores the serial port data passing the validity check into the memory according to the private serial port data packet format.
The invention has the further improvement that the private serial port data packet format comprises a slot number, a card type, a card version, an instruction code, a legal mark, a length and a packet body.
The invention has the further improvement that the serial ports at different rates can be debugged through configuration.
Compared with the prior art, the invention has the following beneficial effects: according to the invention, the embedded central processing unit and the high-speed serial port are arranged, and the high-speed serial port is connected with the controller to be monitored and the IO branch of the IO card, so that the communication data of the controller of the thermal power plant can be extracted in real time without reducing the communication rate of the serial port, the actual communication state is not influenced, the debugging and the packet grabbing of the high-speed serial port data between the controller to be monitored and the IO card in the field of thermal power control can be realized, the problem diagnosis efficiency of developers is effectively improved, and the problem positioning time is shortened.
Furthermore, by arranging the FPGA, the sampling rate of 5Mbps or above can be met, the acquisition rate is high, the reliability of an acquisition result is high, the problem that the RS232 baud rate is insufficient and cannot be debugged is solved, and the problems of portability and usability caused by the fact that the oscilloscope is adopted by a high-speed serial port are solved.
When the device is used, data collected by the high-speed serial port is transmitted to the FPGA, the FPGA transmits a received data packet to the embedded central processing unit, the embedded central processing unit receives the data packet and then transfers the data packet to the memory, the embedded central processing unit reads serial port data in the memory and writes the serial port data into a log in the memory, and the upper computer extracts and screens the serial port data to obtain a data packet of a debugging object to finish debugging work. The invention realizes the function of high-speed serial port data debugging and packet capturing between the controller and the IO card through the embedded central processing unit, and solves the problems that the serial port communication speed of the upper computer in the prior art cannot meet the requirement of directly checking a high-speed serial port and each data packet cannot be conveniently searched.
Detailed Description
The present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a debugging device based on a high-speed serial port of a thermal power plant comprises an embedded central processing unit 1, a memory 2, a network card 3, a storage 4, an FPGA5 and a high-speed serial port 6, wherein the memory 2 has an ECC check function, the memory 2, the network card 3 and the storage 4 are all connected with the embedded central processing unit 1, the embedded central processing unit 1 is connected with the FPGA5 through PCI-E, the FPGA5 is expanded to form the high-speed serial port 6, and the high-speed serial port 6 is connected with the FPGA 5; the network card 3 is connected with an upper computer; the embedded central processing unit 1 is connected with the memory 4 through an SPI bus; the preferred memory 4 adopts a FLASH chip with 500MB capacity, the memory 2 is 1GB, the network card 3 is a gigabit network card, the FPGA5 preferably selects domestic purple light, and the parameter of the domestic purple light FPGA5 is set to 5 Mbps.
The high-speed serial port 6 is connected with one of the IO branches under the thermal power plant controller, and a plurality of IO clamping pieces are arranged on the IO branch.
The principle of the invention is as follows: this device is linked to each other through the IO branch that adopts high-speed serial ports 6 that FPGA5 expanded to pass through high-speed IO BUS BUS and treat the monitoring control ware, and FPGA5 handles high-speed serial ports 6's data transmission and receipt according to 5 Mbps's rate, and high-speed serial ports 6 inserts high-speed IO BUS BUS and gain the serial ports data on the IO BUS BUS to transmit the serial ports data who gains for FPGA5, FPGA5 leaves serial ports data in memory 2 through the PCI-E BUS.
In order to solve the influences of shared memory overflow and access interlock, all collected serial port data are guaranteed to be written into logs in a memory 4, a memory 2 comprises a circular storage area, the circular storage area is divided into 1000 sub-storage areas, each sub-storage area can store 1000 pieces of serial port data, and the FPGA5 stores the obtained serial port data into one area of one sub-storage area in the circular storage area every time. The embedded central processing unit 1 periodically judges the storage mark of the memory 2, and when the storage mark meets the batch reading standard, the embedded central processing unit 1 reads the batch of serial data from the memory 2 and writes the batch of serial data into a log in the memory 4.
Due to the requirement on the storage capacity of the storage 4, 20 logs are stored in the storage 4 in a circulating storage mode, the next log is stored only after one log is full, the size of a single log is set to be 20MB, and the first log is overwritten and stored after all 20 logs are full, so that the total size does not exceed the requirement of 400 MB.
Finally, the upper computer extracts the log in the memory 4 through the network card 3 in an FTP mode; every log is loaded according to the data structure that defines to the application of host computer, can filter and show the data package through key data such as groove number, KKS, instruction code, including analytic module in the host computer, analytic module is analyzed the log of leading-in to the host computer, finally accomplishes the debugging.
The using method of the invention comprises the following steps:
after the device is powered on, the embedded central processing unit 1 initializes the memory 2, then initializes the FPGA5, simultaneously initializes the network card 3 and the memory 4, and initializes the high-speed serial port 6 in the initialization process of the FPGA5, so that the hardware of the device can work normally.
After the device is powered on, the embedded central processing unit 1 starts a serial port data acquisition thread and a data storage thread. The data acquisition thread is responsible for carrying out validity check on the serial port data acquired by the FPGA5 and storing the serial port data passing the validity check into a circular buffer area according to a private serial port data packet format. And the data storage thread judges the storage mark of each sub-storage area in the circular buffer area, if the current sub-storage area is marked as the state of newly acquired and not storing the file, the storage thread takes out all data of the sub-storage area and writes the log, the state of the sub-storage area in the circular buffer area which is just processed is set to be processed after the log is successfully written in, and when the log is circularly stored in the sub-storage area again, the memory of the sub-storage area can be used again to store new serial port data.
The IO branch of monitor of thermal power plant is connected through high-speed serial ports 6 by FPGA5, gain the signal through high-speed serial ports 6, high-speed serial ports 6 gather the single data package and transmit for FPGA5, FPGA5 carries out the broken pin with the serial ports data package according to the principle of 20ns low level and handles, the serial ports data package that obtains after handling the broken pin transmits embedded central processing unit 1 through the mode of shared memory, embedded central processing unit 1 begins to carry out the legitimacy check to the serial ports data package that FPGA5 forwarded: firstly, the embedded central processing unit 1 judges whether the serial port data is legal or not according to the CRC field in the private data packet, if so, the embedded central processing unit 1 splits the serial port data and fills a legal serial port message data record according to the storage format of the table 1, finally, the serial port message data record is stored in the memory 2, and all the processed legal serial port message data are stored in the memory 2 according to the circular buffer zone partition storage mode of the substorage zone. At the moment, the data acquisition thread judges the position partition stored last time, the acquisition thread puts the data into the corresponding circular buffer area, meanwhile, the data storage thread judges whether the sub-storage area taken out from the circular buffer area is full of 1000 data packets, if the sub-storage area is full of 1000 data packets, all the data in the sub-storage area can be extracted, whether the current log to be written into the memory 4 exceeds 20MB is judged, if the current log exceeds the newly-built log, the new log starts to be stored, and if the current log does not exceed the newly-built log, the data in the circular buffer area in the memory 2 is emptied finally.
Table 1 storage format
Groove number
|
Card type
|
Fastener version
|
Instruction code
|
Legal sign
|
Length of
|
Bag body |
Because the communication efficiency of the IO branch rate of 5Mbps is very high, and the file read-write of the 600Kbps memory 4 is very slow, in order to solve the data transmission under the two rates and ensure that each data packet can be recorded, the data storage thread in the embedded central processing unit 1 takes the serial data of each sub-partition from the circular buffer according to the sequence in a certain time frequency and batch mode by using the advantage of the continuous write-in speed of the memory 4, and then transmits and stores the serial data into the memory 4.
As shown in fig. 1, in the present invention, the network card 3 is connected to the upper computer through an ethernet cable, the upper computer accesses the log in the memory 4 through the network card 3 by using the FTP transmission protocol, and the upper computer can analyze the serial port message in the log after obtaining the log, thereby realizing the search and location of the serial port message problem. The device high-speed serial port 6 is connected with an IO branch of a thermal power plant controller to be monitored, serial port data are processed through the FPGA5 broken pin and then transmitted to a data acquisition thread, the data acquired by the FPGA5 are stored in the memory 2 by the data acquisition thread, and then the serial port data in the memory 2 are written into a log in the memory 4 by the data storage thread.
The host computer accessible operation "device data analysis of high-speed serial ports debugging" procedure carries out serial ports data screening through proprietary protocol, has realized more audio-visual show, refers to fig. 2, also provides more convenient the seeking simultaneously and filtering capability for the developer can fix a position the problem fast.
In the prior art, a controller is connected with IO through a serial port of 5Mbps, and in order to meet the data debugging requirement between the controller and the IO, the embedded central processing unit 1 realizes the function of high-speed serial port data debugging and packet capturing between the controller and the IO card, realizes the function of data capturing between the controller and the IO card in the field of thermal power control, effectively improves the problem diagnosis efficiency of developers, and shortens the problem positioning time.