CN113489682A - Communication method and system of variable-length data protocol based on SpaceWire bus communication - Google Patents

Communication method and system of variable-length data protocol based on SpaceWire bus communication Download PDF

Info

Publication number
CN113489682A
CN113489682A CN202110638601.5A CN202110638601A CN113489682A CN 113489682 A CN113489682 A CN 113489682A CN 202110638601 A CN202110638601 A CN 202110638601A CN 113489682 A CN113489682 A CN 113489682A
Authority
CN
China
Prior art keywords
data
length
protocol
data block
frame
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
Application number
CN202110638601.5A
Other languages
Chinese (zh)
Other versions
CN113489682B (en
Inventor
李光旭
周中泽
王裙
吴培亚
姚蘅
曹志威
李乐尧
李建平
王青
贾涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Institute of Control Engineering
Original Assignee
Beijing Institute of Control Engineering
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Institute of Control Engineering filed Critical Beijing Institute of Control Engineering
Priority to CN202110638601.5A priority Critical patent/CN113489682B/en
Publication of CN113489682A publication Critical patent/CN113489682A/en
Application granted granted Critical
Publication of CN113489682B publication Critical patent/CN113489682B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A communication method and system of variable length data protocol based on SpaceWire bus communication, the protocol content includes frame head, frame count, total data length, data block number, each data block length, each data block content, check sum total 7 parts, wherein the frame head, frame count, total data length, data block number, check sum and the length occupied by 5 parts are fixed, all 2 bytes. The length of each data block is determined by the number of data blocks. The length of each block is determined by the length of each block. The protocol is simple to use, and the number of the data blocks and the length of the data blocks can be flexibly configured. The data flow is packed according to the protocol and unpacked according to the protocol, the software is simple to realize, modularization can be realized, and reusability is strong. The variable-length data protocol disclosed by the invention can flexibly realize the variable length of data, and realizes the correctness check of the data packet through the frame head, the frame counting, the total data length and the check sum, so that the flexibility is good, and the reliability is strong.

Description

Communication method and system of variable-length data protocol based on SpaceWire bus communication
Technical Field
The invention relates to a communication method and a communication system of a variable length data protocol based on SpaceWire bus communication, which are mainly used for the software design and realization of satellite SpaceWire bus transmission variable length data and belong to the field of spacecraft embedded software design.
Background
SpaceWire is a high-speed, full-duplex and serial data bus designed in the aerospace field, such as the European space Bureau. The data packet-based transmission method is used for transmission, the size of the data packet is not limited, and the transmission speed can be configured to be 2-400 Mbps.
And the two devices in a certain satellite are in remote control data and telemetering data communication through a high-speed SpaceWire bus. The telemetering data packets comprise operation state data packets, sensor data packets, actuator data packets, track data packets, electric push data packets, memory downloading data packets, instruction downloading data packets, newly researched stand-alone data packets, lower-position machine telemetering data packets and the like, and the maximum total number of telemetering data transmission is 1800 words. The instructions comprise a plurality of pipe instructions, conventional instructions and unconventional instructions, and the maximum total data transmission of the instructions is 800 words. The telemetering data and the remote control data transmitted between the two devices in each period have the characteristic of dynamic change of data length. The method carries single machine telemetering data, lower machine telemetering data, memory downloading data and the like, and has the characteristic of telemetering data transmission/non-transmission according to the use condition, namely, the telemetering data length of each period is different. Different remote control commands or no commands are sent according to specific use cases, namely, the command length in each period is also different.
The conventional protocol is designed to: 1) the data is transmitted according to the maximum fixed length of the data transmission, the data protocol is simple to set, and the defect is that more time performance indexes are consumed; 2) different data protocols are designed according to the combination situation of different data transmission, and the defect is that the data protocols are more and more complicated. Therefore, a simple and reliable variable-length data protocol needs to be designed so as to realize communication based on the SpaceWire bus.
Disclosure of Invention
The technical problem solved by the invention is as follows: the communication method and the communication system for the variable-length data protocol based on the SpaceWire bus communication overcome the defects in the prior art, and solve the problem of complex data protocol caused by dynamic changes of the number of data blocks transmitted between satellite-borne devices and the size of the data blocks.
The technical solution of the invention is as follows: a communication method of variable length data protocol based on SpaceWire bus communication comprises the following steps:
(1) determining a variable length data protocol framework of a data packet based on SpaceWire bus communication;
(2) setting the value of a corresponding field in a protocol frame according to the characteristics of transmission data;
(3) carrying out protocol packing, packing data to be sent, and sending the data out through a SpaceWire bus after packing;
(4) and unpacking the protocol, and unpacking the received data by the receiver through the SpaceWire bus to finish the communication of the variable-length data protocol based on the SpaceWire bus communication.
Further, the specific method of the step (1) is as follows:
the variable length data protocol framework of the data packet based on the SpaceWire bus communication is agreed as follows:
(11) the data protocol frame consists of 7 parts of a frame header, a frame count, a total data length, the number of data blocks, the length of each data block, the content of each data block and a checksum;
(12) frame header, frame count, total Data length, number of Data blocks, Data block Data1Length, Data block DataMLength, checksum each account for2 bytes;
(13) data block Data1The length occupied by the content is Data block Data1The value of the length, and so on, the Data block DataMThe length occupied by the content is Data block DataMA value of the length;
(14) the total data length Len can support [5, 65535 ];
(15) length of each data block LnCan support [0, 65535];
(16) The number of data blocks M may support [0, 65535 ];
(17) the data length satisfies: data block Data as the total Data length1Value of length + Data Block Data2Value of length + … + Data Block DataMThe value of length + M + 5;
(18) the frame header is about 0xEB 90;
(19) the frame counting convention is that 1 is added in each period;
(20) the checksum convention is to accumulate the sums from the header to the 16 bits of the last word of the content of each data block and then to invert.
Further, the specific method of the step (2) is as follows:
according to the characteristics of transmission data, the following protocols are set: the number of Data blocks is M, and the Data of the Data blocks1Length L1Data of Data block2Length L2Up to the Data block DatamLength Lm
Further, the specific method of the step (3) is as follows:
(31) packing frame header SpwTrata[0]Is 0xEB 90.
(32) Packed frame count SpwTrata[1]Starting from 0, 1 is added each time.
(33) Total length of packed data SpwTrata[2]Initially Len ═ 4+ M.
(34) Number of packed data blocks SpwTrata[3]Is M, where M can support [0, 65535]。
(35) Each data block length is packed, and n represents one data in [1, M ].
If M is equal to 0, jump to (37)
If M is>0,SpwTrata[3+n]=Ln
(36) Packing each Data block Data1~DataMN is [1, M ]]One Data packed Data innThen, first, L is judgednLength of (d).
If L isnIf 0, then the packed Data block Data is not neededn
If L isn>0, then from SpwTrata[Len]From the beginning, Data is packednL ofnData of one length, then updating Len ═ Len + Ln
(37) Computing checksum SpwTrata[0]To SpwTrata[Len-1]The 16 bits of the checksum are accumulated and then are inverted, the sum is recorded as sum, and the checksum SpwTrata is written[Len]=sum。
(38) The total update data length Len ═ Len + 1.
Further, the specific method of the step (4) is as follows:
(41) unpacking and judging frame header SpwRecData[0]If not, the frame header error count is increased by 1, and unpacking is finished; if yes, go to step (42).
(42) Unpacking frame count and judging frame count SpwRecData[1]If the frame is not updated, adding 1 to the frame counting error count, and ending unpacking; if the requirement is met, the step (43) is carried out.
(43) Judging whether the total data length and the sum of the length of each data block are satisfied, firstly unpacking the data block number M equal to SpwTrata[3]Then judging whether SpwRecData is satisfied[2]==SpwRecData[4]+SpwRecData[5]+…+SpwRecData[3+M]+ M +5, counting the length error by +1 if the length does not meet the requirement, and ending the unpacking; if the requirement is met, the step (44) is carried out.
(44) Computing the checksum SpwRecData[0]To SpwRecData[Len-1]The sum and the negation are recorded as sum, and whether SpwRecData is satisfied or not is judged[Len]If the sum is not satisfied, counting by +1, and unpacking; and if the requirement is met, the step (45) is carried out.
(45) Extract data block Data1~DataMN is [1, M ]]Let x be 4+ M.
If M is 0, the data block does not need to be extracted.
If M is>0, then extract the DatanThen, first, L is judgednSize of (D), Ln=SpwTraData[2+n]If L isnIf the content is less than or equal to 0, extraction is not needed;
if L isn>0, then extraction is needed, DatanIs initiated with SpwRecData[x]Length of extracted data is LnThen x is updated to x + LnAnd extracting the next data block.
Further, the present invention also provides a communication system implemented by the communication method of the variable length data protocol based on the SpaceWire bus communication, which comprises:
a protocol framework setting module: determining a variable length data protocol framework of a data packet based on SpaceWire bus communication;
an assignment module: setting the value of a corresponding field in a protocol frame according to the characteristics of transmission data;
a protocol packing and sending module: carrying out protocol packing, packing data to be sent, and sending the data out through a SpaceWire bus after packing;
the data receiving and unpacking module: and unpacking the protocol, and unpacking the received data by the receiver through the SpaceWire bus to finish the communication of the variable-length data protocol based on the SpaceWire bus communication.
Compared with the prior art, the invention has the advantages that:
(1) the data protocol content realized by the invention consists of 7 parts, namely a frame header, a frame count, a total data length, the number of data blocks, the length of each data block, the content of each data block and a checksum. The method can not only reliably verify the correctness of the data through the frame header, the frame count, the data length and the check sum, but also flexibly set the number of the data blocks and the length of the data blocks. The method avoids the complexity of a packaging and unpacking program caused by multi-protocol design and also avoids the time performance consumption caused by maximum data transmission.
(2) The packing and unpacking method has the advantages of simple software implementation of the corresponding packing program and the unpacking program, modularization and strong reusability. And the feasibility and the effectiveness of the method are verified through engineering implementation.
(3) The variable-length data protocol design method based on SpaceWire bus communication provided by the invention has the advantages that the data protocol is simple and reliable, the data length can be flexibly set, and the data transmission quantity and the time for analyzing the packing and unpacking protocol are reduced.
Drawings
FIG. 1 is a diagram of a data protocol framework based on SpaceWire bus communication according to the present invention;
FIG. 2 is a flow chart of data packing according to the present invention;
FIG. 3 is a flow chart of data unpacking according to the present invention.
Detailed Description
The invention provides a communication method of a variable-length data protocol based on SpaceWire bus communication, which is mainly oriented to but not limited to the dynamic change of the number of data blocks transmitted and the size of the data blocks between satellite-borne devices, and the content of the data protocol design is as follows:
firstly, determining a variable length data protocol framework of a data packet based on SpaceWire bus communication;
secondly, setting values of corresponding fields in a protocol frame according to the characteristics of the transmission data;
thirdly, carrying out protocol packing, packing the data to be sent, and sending the data out through a SpaceWire bus after packing;
and fourthly, unpacking the protocol, and unpacking the received data by the receiver through the SpaceWire bus to finish the communication of the variable-length data protocol based on the communication of the SpaceWire bus.
The method is further explained below with reference to the accompanying drawings.
(1) Data protocol frame diagram for appointing communication based on SpaceWire bus
Fig. 1 shows a data protocol framework diagram based on SpaceWire bus communication, where the data protocol content is composed of 7 parts, i.e., a frame header, a frame count, a total data length, a number of data blocks, a length of each data block, a content of each data block, and a checksum. The length and meaning of each field in the protocol, the value of the frame header, the plus 1 rule of the frame count, the data length rule, the accumulation sum rule.
The method specifically comprises the following steps:
frame header, frame count, total Data length, number of Data blocks M, Data block Data1Length, …, Data block DataMThe length and checksum each occupy 2 bytes;
data block Data1The length occupied by the content is Data block Data1The value of the length, and so on, the Data block DataMThe length occupied by the content is Data block DataMA value of the length;
the total data length Len supports [5, 65535 ];
length of each data block LnSupport [0, 65535];
The number M of data blocks supports [0, 65535 ];
the data length satisfies: data block Data as the total Data length1Value of length + Data Block Data2Value of length + … + Data Block DataMThe value of length + M + 5;
the frame header is about 0xEB 90;
the frame counting convention is that 1 is added in each period;
the checksum is defined as the 16-bit accumulated sum from the frame header to the last word of the contents of each data block, and then inverted.
(2) And setting the value of the corresponding field in the protocol frame according to the characteristics of the transmission data. Comprises M Data blocks1Length L1Data of Data block2Length L2Up to the Data block DataMLength LM. The steps (1) and (2) jointly complete and fix the data protocol.
(3) As shown in fig. 2, protocol packetization is performed to packetize data to be transmitted. The method comprises the following steps: packing the frame header into fixed 0xEB 90; frame counting and packaging are started from 0, and 1 is added each time; the initial value of the total length of data is Len-4 + M; the number of data blocks is M; packing each Data block length, Data block Data1Length L1Data of Data block2Length L2Up to the Data block DataMLength LM(ii) a And packaging the contents of each data block in sequence.
As shown in fig. 2, the specific packaging process is as follows:
(3.1) packing frame header SpwTrata[0]Is 0xEB 90;
(3.2) Packed frame count SpwTrata[1]Starting from 0, adding 1 each time;
(3.3) Total Length of packed data SpwTrata[2]Initially Len ═ 4+ M;
(3.4) number of packed data blocks SpwTrata[3]Is M, where M supports [0, 65535];
(3.5) packing the length of each data block, wherein n represents one data in [1, M ];
if M is equal to 0, jumping to step (3.7);
if M is>0, SpwTrata[3+n]=Ln
(3.6) packing Data of each Data block1~DataMN is [1, M ]]One of the data;
packed DatanThen, first, L is judgednLength of (d);
if L isnIf 0, then the packed Data block Data is not neededn
If L isn>0, then from SpwTrata[Len]From the beginning, Data is packednL ofnData of one length, then updating Len ═ Len + Ln
(3.7) calculating a checksum: computing SpwTrata[0]To SpwTrata[Len-1]The 16 bits of the checksum are accumulated and then are inverted, the sum is recorded as sum, and the checksum SpwTrata is written[Len]=sum;
And (3.8) updating the total data length Len to Len +1, and completing protocol packaging.
(4) As shown in fig. 3, the protocol is unpacked and the received data is unpacked.
The method comprises the following steps: unpacking the frame header and judging whether the frame header is 0xEB 90; unpacking the frame count and judging the frame count and adding 1 for updating; unpacking the number of data blocks; unpacking the total data length and the length of each data block, and judging whether the sum of the total data length and the length of each data block meets the following conditions: the total data length is the length of each data block + M + 5; calculating a checksum and judging whether the checksum is correct or not; if one item is not satisfied, ending the data unpacking; and after the verification is satisfied, extracting the M data blocks.
As shown in fig. 3, the specific steps of performing protocol unpacking include:
(4.1) unpacking and judging frame header SpwRecData[0]If not, the frame header error count is increased by 1, and unpacking is finished; if yes, performing the step (4.2);
(4.2) unpacking the frame count and judging the frame count SpwRecData[1]If the frame is not updated, adding 1 to the frame counting error count, and ending unpacking; if the requirement is met, the step (4.3) is carried out;
(4.3) judging whether the total data length and the sum of the lengths of the data blocks satisfy the following conditions: first unpack the data block number M SpwTrata[3]Then judge SpwRecData[2]Whether or not the value of (A) is equal to SpwRecData[4]+SpwRecData[5]+…+SpwRecData[3+M]+ M +5, if the length does not meet the requirement, adding 1 to the length error count, and ending unpacking; if the requirement is met, the step (4.4) is carried out;
(4.4) calculating a checksum: calculation of SpwRecData[0]To SpwRecData[Len-1]The sum and the negation are recorded as sum, and whether SpwRecData is satisfied or not is judged[Len]The sum is equal to the sum, if the sum is not equal to the sum, the error count of the check sum is increased by 1, and the unpacking is finished; if the requirement is met, the step (4.5) is carried out;
(4.5) extracting Data Block Data1~DataMN is [1, M ]]Let x be 4+ M;
if M is equal to 0, the data block does not need to be extracted;
if M is>0, then extract the DatanThen, first, L is judgednSize of (D), Ln=SpwTraData[2+n]If L isnIf the content is less than or equal to 0, extraction is not needed;
if L isn>0, then extraction is needed, DatanIs initiated with SpwRecData[x]Extracting data lengthIs LnThen x is updated to x + LnAnd extracting the next data block.
Example (b):
telemetering data transmission is carried out between the two satellite-borne devices through a SpaceWire bus, and a telemetering data transmission packet comprises a plurality of data blocks: the system comprises a fast-transmission telemetering data block, an attitude and orbit control telemetering data block, a lower computer telemetering data block, a memory downloading 1 data block, a memory downloading 2 data block and a command data block. While the data blocks transmitted each cycle are not fixed.
(1) A variable-length data protocol framework of a data packet based on SpaceWire bus communication is designed, and is shown in the following table.
Figure BDA0003106808740000081
Figure BDA0003106808740000091
Frame head, frame count, total data length, data block number, fast-transmission telemetry data block length, attitude and orbit control telemetry data block length, lower computer telemetry data block length, memory download 1 data block length, memory download 2 data block length, instruction data block length, checksum each occupy 2 bytes.
It should be noted that the ordering of the data block length and the ordering of the data block content in the data protocol must be consistent, for example, the order of the data blocks in the data block length is: the method comprises the following steps of fast transmitting telemetering data, attitude and orbit control telemetering data, lower computer telemetering data, memory downloading 1 data, memory downloading 2 data and instruction data blocks, wherein the sequence of the data blocks in the data block contents must be the same: the method comprises the following steps of fast-transmitting telemetering data, attitude and orbit control telemetering data, lower computer telemetering data, memory downloading 1 data, memory downloading 2 data and instruction data blocks.
(2) According to the characteristics of transmission data, the following protocols are set: the number of the data blocks is M-6, the length of the fast transmission telemetry data block is 160, the length of the attitude and orbit control telemetry data block is 200, the length of the lower computer telemetry data block is 400, the length of the memory download 1 data block is 120, the length of the memory download 2 data block is 160, and the length of the instruction data block is 200. And the total length of the data is dynamically calculated and determined in the packaging process. It should be noted that the number of data blocks and the length of each data block may be dynamically changed according to the characteristics of the data transmitted in each cycle. If the length of the data block downloaded from the memory 1 is 0, and the length of the data block downloaded from the memory 2 is 0 when the data block is not downloaded from the memory; when the length of the lower computer telemetry data block changes, the length of the updatable lower computer telemetry data block is equal to 100, 200. Thereby a dynamic adaptation to changes in the number of data blocks and to changes in the length of the data blocks is achieved.
(3) Packaging the telemetry data according to a protocol, and packaging a frame header into fixed 0xEB 90; frame counting and packaging are started from 0, and 1 is added each time; the initial value of the total data length is Len-4 + 6; the number of data blocks is 6; packaging the length of each data block, wherein the length of the fast-transmission telemetry data block is 160, the length of the attitude and orbit control telemetry data block is 200, the length of the lower computer telemetry data block is 400, the length of the memory download 1 data block is 120, the length of the memory download 2 data block is 160, and the length of the instruction data block is 200; and packaging the contents of each data block in sequence.
(4) Depacketizing telemetry data according to a protocol, comprising: unpacking the frame header and judging whether the frame header is 0xEB 90; unpacking the frame count and judging the frame count and adding 1 for updating; unpacking the number of data blocks; unpacking the total data length and the length of each data block, and judging whether the sum of the total data length and the length of each data block meets the following conditions: the total data length is the length of each data block + M + 5; calculating a checksum and judging whether the checksum is correct or not; if one item is not satisfied, ending the data unpacking; and after the verification is satisfied, extracting the data block of M.
According to the technical scheme, the data protocol design is carried out on telemetering data transmitted between devices through a variable-length data protocol design method based on SpaceWire bus communication, the protocol can adapt to the change of the number of data blocks and the change of the length of the data blocks, the protocol is flexible and reliable, software implementation of a packing and unpacking program is simple and correct, modularization can be achieved, and reusability is high. The data transmission quantity and the time for analyzing the packing and unpacking protocol are reduced.
Those skilled in the art will appreciate that the details of the invention not described in detail in this specification are well within the skill of those in the art.

Claims (10)

1. A communication method of variable length data protocol based on SpaceWire bus communication is characterized by comprising the following steps:
(1) determining a variable length data protocol framework of a data packet based on SpaceWire bus communication;
(2) setting the value of a corresponding field in a protocol frame according to the characteristics of transmission data;
(3) carrying out protocol packing, packing data to be sent, and sending the data out through a SpaceWire bus after packing;
(4) and unpacking the protocol, and unpacking the received data by the receiver through the SpaceWire bus to finish the communication of the variable-length data protocol based on the SpaceWire bus communication.
2. The communication method of the variable-length data protocol based on the SpaceWire bus communication as claimed in claim 1, wherein: the variable-length data protocol framework of the data packet based on the SpaceWire bus communication in the step (1) specifically comprises the following steps:
the data protocol frame comprises 7 parts of a frame header, a frame count, a total data length, the number of data blocks, the length of each data block, the content of each data block and a checksum;
frame header, frame count, total Data length, number of Data blocks M, Data block Data1Length, …, Data block DataMThe length and checksum each occupy 2 bytes;
data block Data1The length occupied by the content is Data block Data1The value of the length, and so on, the Data block DataMThe length occupied by the content is Data block DataMA value of the length;
the total data length Len supports [5, 65535 ];
length of each data block LnSupport [0, 65535];
The number M of data blocks supports [0, 65535 ];
the data length satisfies: data block Data as the total Data length1Value of length + Data Block Data2Value of length + … + Data Block DataMThe value of length + M + 5;
the frame header is about 0xEB 90;
the frame counting convention is that 1 is added in each period;
the checksum is defined as the 16-bit accumulated sum from the frame header to the last word of the contents of each data block, and then inverted.
3. The communication method of the variable-length data protocol based on the SpaceWire bus communication as claimed in claim 2, wherein: and (2) setting the value of the corresponding field in the protocol frame according to the characteristics of the transmission data, specifically: according to the characteristics of transmission Data, the number of Data blocks in the protocol is set to be M, and the Data of the Data blocks1Length L1Data of Data block2Length L2Up to the Data block DataMLength LM
4. The communication method of the variable-length data protocol based on the SpaceWire bus communication as claimed in claim 3, wherein: the specific method for carrying out protocol packing in the step (3) is as follows:
(3.1) packing frame header SpwTrata[0]Is 0xEB 90;
(3.2) Packed frame count SpwTrata[1]Starting from 0, adding 1 each time;
(3.3) Total Length of packed data SpwTrata[2]Initially Len ═ 4+ M;
(3.4) number of packed data blocks SpwTrata[3]Is M, where M supports [0, 65535];
(3.5) packing the length of each data block, wherein n represents one data in [1, M ];
if M is equal to 0, jumping to step (3.7);
if M is>0, SpwTrata[3+n]=Ln
(3.6) packing Data of each Data block1~DataMN is [1, M ]]One of the data;
packed DatanThen, first, L is judgednLength of (d);
if L isnIf 0, then the packed Data block Data is not neededn
If L isn>0, then from SpwTrata[Len]From the beginning, Data is packednL ofnData of one length, then updating Len ═ Len + Ln
(3.7) calculating a checksum: computing SpwTrata[0]To SpwTrata[Len-1]The 16 bits of the checksum are accumulated and then are inverted, the sum is recorded as sum, and the checksum SpwTrata is written[Len]=sum;
And (3.8) updating the total data length Len to Len +1, and completing protocol packaging.
5. The communication method of the variable-length data protocol based on the SpaceWire bus communication as claimed in claim 4, wherein: the specific method for performing protocol unpacking in the step (4) is as follows:
(4.1) unpacking and judging frame header SpwRecData[0]If not, the frame header error count is increased by 1, and unpacking is finished; if yes, performing the step (4.2);
(4.2) unpacking the frame count and judging the frame count SpwRecData[1]If the frame is not updated, adding 1 to the frame counting error count, and ending unpacking; if the requirement is met, the step (4.3) is carried out;
(4.3) judging whether the total data length and the sum of the lengths of the data blocks satisfy the following conditions: first unpack the data block number M SpwTrata[3]Then judge SpwRecData[2]Whether or not the value of (A) is equal to SpwRecData[4]+SpwRecData[5]+…+SpwRecData[3+M]+ M +5, if the length does not meet the requirement, adding 1 to the length error count, and ending unpacking; if the requirement is met, the step (4.4) is carried out;
(4.4) calculating a checksum: calculation of SpwRecData[0]To SpwRecData[Len-1]The sum and the negation are recorded as sum, and whether SpwRecData is satisfied or not is judged[Len]The sum is equal to the sum, if the sum is not equal to the sum, the error count of the check sum is increased by 1, and the unpacking is finished; if the requirement is met, the step (4.5) is carried out;
(4.5) extracting Data Block Data1~DataMN is [1, M ]]Let x be 4+ M;
if M is equal to 0, the data block does not need to be extracted;
if M is>0, then extract the DatanThen, first, L is judgednSize of (D), Ln=SpwTraData[2+n]If L isnIf the content is less than or equal to 0, extraction is not needed;
if L isn>0, then extraction is needed, DatanIs initiated with SpwRecData[x]Length of extracted data is LnThen x is updated to x + LnAnd extracting the next data block.
6. A communication system implemented by the communication method of the variable-length data protocol based on the SpaceWire bus communication as claimed in claim 1, comprising:
a protocol framework setting module: determining a variable length data protocol framework of a data packet based on SpaceWire bus communication;
an assignment module: setting the value of a corresponding field in a protocol frame according to the characteristics of transmission data;
a protocol packing and sending module: carrying out protocol packing, packing data to be sent, and sending the data out through a SpaceWire bus after packing;
the data receiving and unpacking module: and unpacking the protocol, and unpacking the received data by the receiver through the SpaceWire bus to finish the communication of the variable-length data protocol based on the SpaceWire bus communication.
7. The communication system of claim 6, wherein: the variable-length data protocol framework of the data packet based on the SpaceWire bus communication specifically comprises the following steps:
the data protocol frame comprises 7 parts of a frame header, a frame count, a total data length, the number of data blocks, the length of each data block, the content of each data block and a checksum;
frame header, frame count, total Data length, number of Data blocks M, Data block Data1Length, …, Data block DataMThe length and checksum each occupy 2 bytes;
data block Data1The length occupied by the content is Data block Data1The value of the length, and so on, the Data block DataMThe length occupied by the content is Data block DataMA value of the length;
the total data length Len supports [5, 65535 ];
length of each data block LnSupport [0, 65535];
The number M of data blocks supports [0, 65535 ];
the data length satisfies: data block Data as the total Data length1Value of length + Data Block Data2Value of length + … + Data Block DataMThe value of length + M + 5;
the frame header is about 0xEB 90;
the frame counting convention is that 1 is added in each period;
the checksum is defined as the 16-bit accumulated sum from the frame header to the last word of the contents of each data block, and then inverted.
8. The communication system of claim 7, wherein: according to the characteristics of transmission data, setting the values of corresponding fields in a protocol frame, specifically: according to the characteristics of transmission Data, the number of Data blocks in the protocol is set to be M, and the Data of the Data blocks1Length L1Data of Data block2Length L2Up to the Data block DataMLength LM
9. The communication system of claim 8, wherein: the specific method for carrying out protocol packing is as follows:
(9.1) packing frame header SpwTrata[0]Is 0xEB 90;
(9.2) Packed frame count SpwTrata[1]Starting from 0, adding 1 each time;
(9.3) Total Length of packed data SpwTrata[2]Initially Len ═ 4+ M;
(9.4) number of packed data blocks SpwTrata[3]Is M, where M supports [0, 65535];
(9.5) packing each data block length, wherein n represents one data in [1, M ];
if M is equal to 0, jumping to step (9.7);
if M is>0, SpwTrata[3+n]=Ln
(9.6) packing Each Data Block Data1~DataMN is [1, M ]]One of the data;
packed DatanThen, first, L is judgednLength of (d);
if L isnIf 0, then the packed Data block Data is not neededn
If L isn>0, then from SpwTrata[Len]From the beginning, Data is packednL ofnData of one length, then updating Len ═ Len + Ln
(97) And calculating a checksum: computing SpwTrata[0]To SpwTrata[Len-1]The 16 bits of the checksum are accumulated and then are inverted, the sum is recorded as sum, and the checksum SpwTrata is written[Len]=sum;
(9.8) updating the total data length Len ═ Len +1, and completing protocol packaging.
10. The communication system of claim 9, wherein: the specific method for unpacking the protocol comprises the following steps:
(10.1) unpacking and judging the frame header SpwRecData[0]If not, the frame header error count is increased by 1, and unpacking is finished; if yes, performing the step (10.2);
(10.2) unpacking the frame count and determining the frame count SpwRecData[1]If the frame is not updated, adding 1 to the frame counting error count, and ending unpacking; if the requirement is met, the step (10.3) is carried out;
(10.3) judging whether the total data length and the sum of the lengths of the data blocks satisfy: first unpack the data block number M SpwTrata[3]Then judge SpwRecData[2]Whether or not the value of (A) is equal to SpwRecData[4]+SpwRecData[5]+…+SpwRecData[3+M]+ M +5, if the length does not meet the requirement, adding 1 to the length error count, and ending unpacking; if the requirements are met, the steps are carried out(10.4);
(10.4) calculating a checksum: calculation of SpwRecData[0]To SpwRecData[Len-1]The sum and the negation are recorded as sum, and whether SpwRecData is satisfied or not is judged[Len]The sum is equal to the sum, if the sum is not equal to the sum, the error count of the check sum is increased by 1, and the unpacking is finished; if the requirement is met, the step (10.5) is carried out;
(10.5) extracting Data Block Data1~DataMN is [1, M ]]Let x be 4+ M;
if M is equal to 0, the data block does not need to be extracted;
if M is>0, then extract the DatanThen, first, L is judgednSize of (D), Ln=SpwTraData[2+n]
If L isnIf the content is less than or equal to 0, extraction is not needed;
if L isn>0, then extraction is needed, DatanIs initiated with SpwRecData[x]Length of extracted data is LnThen x is updated to x + LnAnd extracting the next data block.
CN202110638601.5A 2021-06-08 2021-06-08 Communication method and system of variable-length data protocol based on SpaceWire bus communication Active CN113489682B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110638601.5A CN113489682B (en) 2021-06-08 2021-06-08 Communication method and system of variable-length data protocol based on SpaceWire bus communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110638601.5A CN113489682B (en) 2021-06-08 2021-06-08 Communication method and system of variable-length data protocol based on SpaceWire bus communication

Publications (2)

Publication Number Publication Date
CN113489682A true CN113489682A (en) 2021-10-08
CN113489682B CN113489682B (en) 2023-05-12

Family

ID=77934878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110638601.5A Active CN113489682B (en) 2021-06-08 2021-06-08 Communication method and system of variable-length data protocol based on SpaceWire bus communication

Country Status (1)

Country Link
CN (1) CN113489682B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103957134A (en) * 2014-04-22 2014-07-30 航天恒星科技有限公司 Modular configurable telemetry parameter analyzing and processing system
CN105975424A (en) * 2016-04-28 2016-09-28 北京信息科技大学 Master-slave serial communication protocol
CN110430023A (en) * 2019-07-23 2019-11-08 北京控制工程研究所 A kind of data transmission method suitable for SpaceWire bus communication
CN110855582A (en) * 2019-12-02 2020-02-28 西安电子科技大学 Time-triggered Ethernet switching device compatible with SpaceWire bus
CN111200581A (en) * 2018-11-19 2020-05-26 北京华航无线电测量研究所 Data receiving and transmitting module based on LVDS bus
CN112468209A (en) * 2020-10-29 2021-03-09 西安空间无线电技术研究所 On-orbit high-speed injection system and method based on SpaceWire bus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103957134A (en) * 2014-04-22 2014-07-30 航天恒星科技有限公司 Modular configurable telemetry parameter analyzing and processing system
CN105975424A (en) * 2016-04-28 2016-09-28 北京信息科技大学 Master-slave serial communication protocol
CN111200581A (en) * 2018-11-19 2020-05-26 北京华航无线电测量研究所 Data receiving and transmitting module based on LVDS bus
CN110430023A (en) * 2019-07-23 2019-11-08 北京控制工程研究所 A kind of data transmission method suitable for SpaceWire bus communication
CN110855582A (en) * 2019-12-02 2020-02-28 西安电子科技大学 Time-triggered Ethernet switching device compatible with SpaceWire bus
CN112468209A (en) * 2020-10-29 2021-03-09 西安空间无线电技术研究所 On-orbit high-speed injection system and method based on SpaceWire bus

Also Published As

Publication number Publication date
CN113489682B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN111010253B (en) HIMAC frame splitting system and method based on HINOC protocol
CN105975424B (en) A kind of principal and subordinate's serial communication protocol
US9635145B2 (en) System and method for modifying, in a processing pipeline, a length of a data packet in a data block without modifying a length of the data block
CN101237445B (en) Buffer management for wireless USB synchronization at end point
CN106155734B (en) Method and device for downloading software version
KR101001074B1 (en) Method for transmittng data on a bus
CN102664779A (en) CAN bus data transmitting method
US7664898B2 (en) Method and system for efficient framing on addressed buses
CN113489682A (en) Communication method and system of variable-length data protocol based on SpaceWire bus communication
CN110225061A (en) Heterogeneous protocol conversion method and device based on flow table driving
US7539204B2 (en) Data and context memory sharing
RU2677376C2 (en) Stack timing adjustment for serial communications
CN103838587A (en) Control system remote upgrading method and device based on GPRS
CN101047620B (en) Device and method for quickly processing message
JP4385247B2 (en) Integrated circuit and information processing apparatus
CN110838892A (en) High-reliability merging and forwarding method for multi-path full-duplex serial port
CN114362880A (en) Reconfigurable telemetering mining and editing universal protocol design method
CN108039936A (en) A kind of communication protocol data bag and communication system for unmanned operation equipment
US7607064B2 (en) Serial asynchronous interface with slip coding/decoding and CRC checking in the transmission and reception paths
CN105022712A (en) Data stream transmission based data packet extracting method
US11894946B2 (en) Vehicle heterogeneous communication system and communication method therefor
US7401134B2 (en) Packet processing architecture
CN101406005B (en) Method and device for data packet assembly
CN102693206B (en) WUSB (wireless universal serial bus) isochronous buffer management in endpoint
CN110865955B (en) High-reliability merging and forwarding system of multi-path full-duplex serial port

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant