Summary of the invention
The purpose of the present invention is to propose to a kind of pin not used outside any clock, data, LVDS module can be good at again management and the message transmissions function of self simultaneously.
One LVDS interface communication means of the present invention, wherein, including: carry out the initialization at communication two ends;Carry out LVDS circuit training;Transmission flow comprises: S1, transmission BUSY code;S2, check self state, if state is full, then continue to send BUSY code, otherwise send FREE code;S3, receive opposite end BUSY code and then wait, otherwise proceed to S4;S4, do not have such as this locality message to proceed to S3, otherwise proceed to S5;S5, being packaged by this locality message and send, message proceeds to S2 after being sent completely;Reception flow process comprises: S6, receives opposite end BUSY code and then waits, otherwise proceeds to S7;S7, check opposite end data, receive opposite end FREE code and then proceed to S6, otherwise proceed to S8;S8, it is message such as what receive, then obtains message length according to encapsulation format, according to the packet storage that message length will receive, and update the state of self.
One embodiment of the LVDS interface communication means according to the present invention, wherein, the initialization carrying out communication two ends includes: select first handshake as two ends in LVDS data wire;First end sends square wave, and the second end sends complete 1, and both starts the detection to opposite end square wave simultaneously;Second end stops sending complete 1 after the square wave of the first end being detected, starts to send square wave, simultaneously detect that the first end sends complete 1;First end stops sending square wave after the square wave of the second end being detected, starts to send complete 1, simultaneously detect that the second end sends complete 1;Second end detect the first end complete 1 after stop send square wave, start to send complete 1, detect simultaneously first end send midamble code, the second end has been shaken hands;First end detect the second end complete 1 after stop send complete 1, the first end has been shaken hands.
One embodiment of the LVDS interface communication means according to the present invention, wherein, the training of LVDS circuit includes: before data wire training starts, all of data lines is output as complete 1;First end sends midamble code and detects the full 0 that the second end sends simultaneously, and the second end detection midamble code waits for training;Second termination receives midamble code and is trained, and exports full 0 after training, starts simultaneously at complete the 1 of detection the first end transmission;First end sends complete 1 after the full 0 that the second end sends being detected, and starts simultaneously at detection midamble code and waits for training;Second end detect first end send complete 1 after send midamble code, start simultaneously at detection first end send full 0;First end training sends full 0 after terminating, and starts simultaneously at the full 0 that detection the second end sends;Second end starts to send full 0 after the full 0 that the first end sends being detected, and continues to send the full 0 of multiple clock cycle;Between first end, the second end, circuit is trained from the first data lines, after having trained, enter the training of the second data lines, judging whether that all of data lines training is complete afterwards, as unfinished, the second end turns to next data lines to proceed training, the like, until all of data lines training is complete, as completed, then the second end enters message transmissions.
LVDS interface communication means of the present invention is by by ready, completing signal and use data wire to complete, save external terminal;By transmission message is packaged, it is achieved that transmission in control code band, namely saves the external terminal that full flow control signal takies, new control command can also be added flexibly simultaneously.
Detailed description of the invention
For making the purpose of the present invention, content and advantage clearly, below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.
The two ends of LVDS are designed as master slave system by the present invention, run and are divided into 3 stages, and the first stage is start handshake phase, and second stage is the circuit training stage, and the phase III is the message transmissions stage.
Fig. 1 is the first stage start handshake procedure figure of LVDS interface communication means of the present invention, as it is shown in figure 1, the start handshake procedure of LVDS comprises the following steps:
(1) in LVDS data wire first is selected as main side, from the handshake of end.
(2) main side sends square wave, sends complete 1 from end, and both starts the detection to opposite end square wave simultaneously.In order to ensure detection reliability, it can be 16 clock cycle that square-wave cycle is arranged.
(3) stop sending complete 1 the square wave of main side detected from end after, start to send square wave, simultaneously complete the 1 of detection main side transmission.
(4) main side detects and stops sending square wave after the square wave of end, starts to send complete 1, detects send from end complete 1 simultaneously.
(5) stop sending square wave complete the 1 of main side detected from end after, start to send complete 1, the midamble code that detection main side sends simultaneously, shaken hands from end, entered the training stage.
(6) main side detects and stops sending complete 1 behind complete the 1 of end, and having shaken hands in main side, enters the training stage.
Fig. 2 is the second stage circuit training flow chart of LVDS interface communication means of the present invention, as in figure 2 it is shown, LVDS circuit training flow process comprises the following steps:
(1) main side, from end between circuit train from the first data lines, after train, enter the training of the second data lines, the like, until all of data lines train complete.Before data wire training starts, all of data lines is output as complete 1.
(2) main side sends midamble code and detects the full 0 sent from end simultaneously, waits for training from end detection midamble code.
(3) receive midamble code from termination to be trained, after training, export full 0, start simultaneously at complete the 1 of the transmission of detection main side.
(4) main side detects and sends complete 1 after the full 0 that end sends, and starts simultaneously at detection midamble code and waits for training.
(5) from end detect that main side sends complete 1 after send midamble code, start simultaneously at the full 0 of detection main side transmission.
(6) main side training sends full 0 after terminating, and starts simultaneously at and detects the full 0 sent from end.
(7) start to send full 0 after detecting, from end, the full 0 that main side sends, persistently send the full 0 of 16 clock cycle, judge whether that all of data lines training is complete afterwards, no end, turn to next data lines from end, repeat step 2-7;Process, then entered the message transmissions stage from end.
(8) main side detects from the full 0 that end sends, and judges whether that all of data lines training is complete afterwards, and no end, main side turns to next data lines, repeats step 2-7;Processed, then main side enters the message transmissions stage.
Fig. 3 is the phase III message transmissions schematic flow sheet of LVDS interface communication means of the present invention, as it is shown on figure 3, message transmissions flow process is divided into 2 parts, transmission flow and reception flow process.
Before carrying out message transmissions, message transmissions is had following agreement
Definition control code, full 0 code is BUSY code, represents that transmitting terminal can not receive data;All-ones is FREE code, represents that transmitting terminal can receive data;
Definition message encapsulation format, message length+message content.
Transmission flow comprises the steps of
(1) BUSY code is sent when initially entering the transmission stage.
(2) checking BUF (being used for the receiving message) state receiving self, full continuation sends BUSY code, otherwise sends FREE code, proceeds to step 3 afterwards.
(3) receive opposite end BUSY code then to wait in this step, otherwise proceed to step 4.
(4) this locality does not have message to proceed to step 3, otherwise proceeds to step 5.
(5) being packaged by this locality message, namely add message length information before message, send the message after encapsulation, message proceeds to step 2 after being sent completely.
Comprise the steps of as it is shown on figure 3, receive flow process
(1) receive opposite end BUSY code then to wait in this step, otherwise proceed to step 2.
(2) check the data of opposite end, receive opposite end FREE code and then proceed to step 1, otherwise proceed to step 3.
(3) what receive is message, first obtains message length according to encapsulation format, according to message length by the packet storage received to receiving BUF.Message proceeds to step 1 after receiving.
While step 3 carries out message reception, check the full state of BUF sky that receives, full then arrange and receive BUF full scale will, it is otherwise provided as non-full.
LVDS interface communication means of the present invention is shaken hands by using the first data lines transmission square wave in LVDS interface to boot up, and namely improves successful vigorousness of shaking hands, because will not produce square wave in start-up phase by mistake, saves extra ready signal simultaneously;Use the data wire being trained to be trained the mutual of process in the training stage and then save signal;In the message transmissions stage by message is packaged, define BUSY code, FREE code, save full flow control signal, other control commands can also be added easily simultaneously.
Compared with prior art, LVDS interface communication means of the present invention is by by ready RDY, completing DONE signal and use data wire to complete, save external terminal;By transmission message is packaged, it is achieved that transmission in control code band, namely saves the external terminal that full FULL flow control signal takies, new control command can also be added flexibly simultaneously.
The above is only the preferred embodiment of the present invention; it should be pointed out that, for those skilled in the art, under the premise without departing from the technology of the present invention principle; can also making some improvement and deformation, these improve and deformation also should be regarded as protection scope of the present invention.