Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
In an embodiment of the present invention, as shown in fig. 1, a data transmission system using a special coding scheme includes: at least two pairs of data buses, wherein all the data buses transmit by taking a data frame as a unit; the arbitration buses transmit by taking arbitration frames as units, the transmission time of the arbitration frames is the same as that of the data frames, each arbitration frame comprises at least two arbitration time periods, and each arbitration time period arbitrates a winner communication node of the time period; and the communication nodes are respectively connected in parallel and hung on the data buses and the arbitration bus.
Specifically, an arbitration frame and a data frame on the CAN bus are multiplexed on the same bus in a time-sharing manner, and the arbitration frame limits the transmission rate of the data frame. In order to increase the transmission rate of the data bus, the arbitration bus is separated from the data bus in the present invention. Arbitration information is sent on an arbitration bus, data information is sent on a data bus, the data bus can adopt a completely different high-speed channel coding transmission scheme from the arbitration bus, the data bus has a higher symbol modulation rate to meet the high-speed transmission requirement, and the arbitration bus has a lower symbol modulation rate to ensure the arbitration reliability.
The bus structure shown in fig. 1 includes two pairs of data buses and one pair of arbitration buses, where the data bus 1 is formed by one pair of conductors, the data bus 2 is formed by the other pair of conductors, and the arbitration bus is formed by one pair of conductors. Fig. 1 is only an example of a bus structure, and the bus structure according to the present invention may also include three or more pairs of data buses, and increasing the number of data buses may improve the bus transmission rate and efficiency, and reduce the transmission delay due to collision; however, too many pairs of data buses increase the manufacturing cost, and in practical applications, a compromise between transmission efficiency and manufacturing cost is required.
The arbitration bus is transmitted according to arbitration frames, one arbitration frame comprises a plurality of arbitration time periods, each arbitration time period is the identifier sending time of each communication node, the communication nodes are arbitrated according to the priority of the identifiers when colliding, the arbitration bus arbitrates the identifiers of the communication nodes participating in data sending right competition in the arbitration time period, only the identifiers with high priority are presented on the arbitration bus, and the communication node corresponding to the identifier with high priority is the winner communication node of the arbitration time period.
The data bus is transmitted according to data frames, the transmission time of one data frame is the same as that of one arbitration frame, but the data volume transmitted in the same time is different, and the data volume of the data frame is larger than that of the arbitration frame, so that the transmission rate of the data bus is high. The arbitration frame with the same frame number may have the same start time as the data frame, or may have a fixed time offset, for example, the frame header of the data frame is delayed by a fixed time offset relative to the frame header of the arbitration frame with the same frame number.
Since there are at least 2 pairs of data buses, an arbitration frame contains at least 2 arbitration time periods for at least the 2-bit winning communication node to decide on data transmission for the next data frame. The number of arbitration periods contained in each arbitration frame is not less than the number of data buses, and may be equal to or greater than, if less than, the data buses are easily wasted.
During each arbitration period of each arbitration frame, the winning communication node will obtain the transmission right of the next data frame for transmitting one frame of data. The data frame comprises an identifier of the receiving equipment, so that the receiving equipment can identify whether the data is sent to the receiving equipment, and if so, the data is received; otherwise, the process is abandoned.
Each communication node includes:
the arbitration interface module 100 is configured to send an identifier composed of a plurality of symbols to the arbitration bus to participate in data transmission right competition of the data bus, where when the sent symbol is not the first symbol and is the same as the previous symbol, a coding result generated by a coding method different from that of the previous symbol is used for sending;
a data sending module 300, configured to send data of itself to a target data bus;
the control module 200 is used for controlling the arbitration interface module to send the identifier of the arbitration interface module to the arbitration bus in the current arbitration time period of the current arbitration frame when the data sending requirement of the arbitration interface module is detected; when detecting that the identifier is successfully sent, the communication node is a winning communication node in the time period, and controls the data sending module to send own data to a target data bus in the next data frame, and meanwhile, the identifier is not sent in the current arbitration frame; when the identifier transmission failure is detected and the current arbitration time period is not the last arbitration time period of the current arbitration frame, controlling the arbitration interface module to retransmit the identifier to the arbitration bus in the next arbitration time period of the current arbitration frame until the identifier transmission is successful or the last arbitration time period of the current arbitration frame is reached.
Specifically, each communication node has a unique identifier for identifying itself, and the identifier is composed of a plurality of symbols. Before sending data, each communication node must first send its own identifier on the arbitration bus, and after the own identifier is successfully sent on the arbitration bus, the communication node obtains the use authority of the target data bus, and then can send data on the next frame of the target data bus. The arbitration bus is transmitted according to arbitration frames, one arbitration frame at least comprises 2 arbitration time periods, and the arbitration time periods are used for the communication nodes to send identifiers. During each arbitration period, a communication node having a data transmission requirement can transmit each symbol of its own identifier onto the arbitration bus in bits before not obtaining the data transmission right.
For example, for a twisted pair with a bus voltage fluctuating between 0V and 7V, a level 0 is defined as below 0.5V, a level 1 is defined as between 0.5V and 1.5V, a level 2 is defined as between 1.5V and 2.5V, a level 3 is defined as between 2.5V and 3.5V, a level 4 is defined as between 3.5V and 4.5V, a level 5 is defined as between 4.5V and 5.5V, a level 6 is defined as between 5.5V and 6.5V, and a level 7 is defined as above 6.5V, and the pair of driving voltages (1,2) indicates that the driving voltage on the arbitration line 1 is level 1 and the driving voltage on the arbitration line 2 is level 2.
Each symbol of the identifier is a logical number, and each symbol is encoded to result in a corresponding drive voltage pair on the arbitration bus. Assuming that the voltage pair corresponding to the symbol 1 is (1,2), when the communication node transmits the symbol 1, the symbol 1 is encoded, the corresponding driving voltage pair (1,2) is found according to the mapping table of the symbol-driving voltage pair, and then the driving voltage pair is converted into corresponding driving voltages, such as (1v, 2v), through the arbitration interface module, the driving voltages are amplified respectively, and under the condition that the interface is turned on, the amplified voltages are conducted onto two arbitration lines, that is, the symbol 1 is successfully transmitted onto the arbitration bus. When judging whether the symbol is successfully sent to the arbitration bus, the communication node inquires actual voltages on two arbitration lines of the arbitration bus, removes a fixed amplification factor to obtain a driving voltage pair, and decodes the driving voltage pair to obtain a corresponding symbol, for example, a symbol 1 is obtained according to the driving voltage pair (1, 2).
In general, only one encoding method is used to convert symbols into driving voltage pairs, each symbol corresponds to a driving voltage pair, and different symbols correspond to different driving voltage pairs. When the same symbol is continuously transmitted, a symbol voltmeter different from the symbol voltmeter in which the previous symbol selects the driving voltage is selected, and the driving voltage is selected.
The coding mode is adopted to ensure that the voltage on at least one arbitration line has large fluctuation, the end of the transmission of an old symbol and the start of the transmission of a new symbol can be easily identified according to the fluctuation, and the functions of clock recovery and clock positioning can be realized according to the symbol jump. If only one coding mode is adopted, when the same symbols are continuously transmitted, because the coding results transmitted before and after are the same, the voltage on the corresponding arbitration line is not changed, when each communication node receives the symbols on the arbitration bus, the communication node cannot easily distinguish whether the communication node corresponds to one symbol or two same symbols, and the judgment error of the communication node is easily caused, and the competition of the data transmission right is influenced. The foregoing problems can be avoided and optimized by using two encoding schemes.
After the communication node sends a bit symbol of the identifier, monitoring the symbol on the arbitration bus; when the symbol on the arbitration bus is different from the symbol sent by the communication node, the sending of the identifier is considered to be failed, and the sending of the subsequent symbol of the identifier is stopped; when the symbol on the arbitration bus is the same as the symbol sent by the communication node, indicating that the communication node successfully sends the one-bit symbol of the identifier; if there are more symbols to send, continuing to send the next symbol of the identifier; when the communication node successfully transmits all symbols of the identifier, the transmission of the identifier is considered successful.
When a plurality of communication nodes send identifiers simultaneously, the communication nodes which can correctly send the identifiers to the arbitration bus obtain the wins of the arbitration at this time, become the wining communication nodes, obtain the use right of the next data frame of the target data bus, and stop sending own identifiers in the arbitration frame.
If the identifier transmission failure is detected and the current arbitration time period is not the last arbitration time period of the current arbitration frame, the communication node can continue to participate in subsequent arbitration, and continues to transmit the identifier to participate in data transmission right election of the data bus when the next arbitration time period of the current arbitration frame comes, namely continues to transmit the identifier to strive for obtaining the use right of the target data bus when the next arbitration time period becomes the current arbitration time period.
Example (c): the bus structure comprises 1 pair of arbitration buses and 3 pairs of data buses, each arbitration frame comprises 3 arbitration time periods, the winning communication node of each arbitration time period obtains the data transmission right of the target data bus corresponding to the arbitration time period, for example, the target data bus of the 1 st arbitration time period is the 1 st pair of data bus, the target data bus of the 2 nd arbitration time period is the 2 nd pair of data bus, the target data bus of the 3 rd arbitration time period is the 3 rd pair of data bus, the winning communication node of the 1 st arbitration period of the current arbitration frame obtains the transmission of the 1 st data frame to the data bus, the winning communication node of the 2 nd arbitration period obtains the transmission of the 2 nd data frame to the data bus, and the winning communication node of the 3 rd arbitration period obtains the transmission of the 3 rd data frame to the data bus.
If the communication node obtains arbitration success in the 1 st arbitration time period of the current arbitration frame, the communication node is the winning communication node of the arbitration time period, and obtains data transmission of the next data frame of the data bus in the 1 st arbitration time period, and meanwhile, the communication node stops continuously transmitting the identifier of the communication node in the current arbitration frame, namely, the communication node does not participate in arbitration of the 2 nd and 3 rd arbitration time periods of the current arbitration frame. In the arbitration frame, the communication node obtains the data sending opportunity and does not participate in the subsequent competition of the data bus, so that the opportunity can be given to other equipment, the fairness is increased, the utilization rate of the data line is increased, and the flexibility of the system is increased.
If the communication node does not obtain arbitration wins in the 1 st arbitration period of the current arbitration frame, the communication node can continue to participate in the 2 nd arbitration of the current arbitration frame, and resend its own identifier in the 2 nd arbitration period. If the 2 nd arbitration fails, the 3 rd arbitration of the current arbitration frame can also be participated. If the 2 nd arbitration is successful, the communication node obtains to send data in the 2 nd data frame of the data bus while not participating in the 3 rd arbitration.
Devices that do not contend successfully have multiple arbitration opportunities in one arbitration frame and can continue to transmit identifiers, and once contention succeeds, no identifiers are transmitted in the current arbitration frame for the purpose of giving other devices opportunities. At the next arbitration frame, all devices are again participating in arbitration.
Due to the fact that multiple pairs of data buses exist, multiple communication nodes can compete out to obtain the use right of the data buses in each arbitration frame, and therefore the transmission rate of the data buses is improved.
In another embodiment of the present invention, as shown in fig. 1, a data transmission system using a special coding scheme includes:
on the basis of the previous embodiment, the function of the arbitration interface module is added as follows:
the arbitration interface module 100 is further configured to, in the process of sending the identifier to the arbitration bus, send a coding result generated by a coding mode different from that of a previous symbol when the sent symbol is not the first symbol and the sum of the sent symbol and the previous symbol is an even number; and when the transmitted symbol is not the first symbol and the sum of the transmitted symbol and the previous symbol is an odd number, the transmitted symbol is transmitted by adopting the coding result generated by the same coding mode as the previous symbol.
The coding results of the same symbol in different coding modes are reflected on the arbitration bus, and the voltage difference of at least one arbitration line reaches a preset threshold value.
Specifically, for example, assuming that the driving voltages have 8 levels, each corresponding to a level 0 to 7, as shown in table 1 (arbitration line driving voltage encoding table), a preferred encoding method is to select two groups of 16 voltage combinations from 64 voltage combinations, each corresponding to 16 symbols. The symbol transmission rule is as follows: if the sum of the current symbol and the previous symbol is an even number, the corresponding voltage in a group different from the previous symbol is output, namely if the last code uses the voltage value in the first group, the current code uses the corresponding voltage in the second group instead. If the sum of the current symbol and the previous symbol is odd, the corresponding voltage in the same group as the previous symbol is used, that is, if the last code uses the voltage value in the first group, the current code continues to use the corresponding voltage in the first group. Assuming that the previous symbol is 5, the first encoding method shown in table 1 is used, and the corresponding driving voltage pairs are (4,4), the driving voltage pairs corresponding to the current symbols sequentially 0 to 15 according to the symbol transmission rule of the present embodiment are shown in table 2.
By adopting the symbol sending rule in the embodiment, continuous sending of any two symbols corresponds to obvious voltage fluctuation on the arbitration bus, so that clock signals can be recovered in an asynchronous mode of each communication node, the symbols on the arbitration bus can be correctly identified, the decoding complexity is reduced, the decoding success rate is improved, and the anti-interference capability of a system is enhanced. The symbol sending rule is realized in a software mode on the conventional arbitration interface, and the cost is reduced compared with a hardware realization mode.
In an embodiment of the present invention, as shown in fig. 2, a data transmission method using a special coding scheme, the method is based on the data transmission system using a special coding scheme described in any of the foregoing embodiments, and includes:
step S100, in the current arbitration period of the current arbitration frame, a communication node having a data transmission requirement sends an identifier composed of a plurality of symbols to the arbitration bus to participate in data transmission right election of the data bus, wherein when the sent symbol is not the first symbol and is the same as the previous symbol, a coding result generated by a coding mode different from the previous symbol is used for sending.
Specifically, each communication node has a unique identifier for identifying itself, and the identifier is composed of one or more symbols. Before sending data, each communication node must first send its own identifier on the arbitration bus, and after the own identifier is successfully sent on the arbitration bus, the communication node obtains the use authority of the target data bus, and then can send data on the next frame of the target data bus. The arbitration bus is transmitted according to arbitration frames, one arbitration frame at least comprises 2 arbitration time periods, and the arbitration time periods are used for the communication nodes to send identifiers. During each arbitration period, the communication node having a data transmission request can transmit its identifier to the arbitration bus in bits before the communication node does not obtain the data transmission right.
For example, for a twisted pair with a bus voltage fluctuating between 0V and 7V, a level 0 is defined as below 0.5V, a level 1 is defined as between 0.5V and 1.5V, a level 2 is defined as between 1.5V and 2.5V, a level 3 is defined as between 2.5V and 3.5V, a level 4 is defined as between 3.5V and 4.5V, a level 5 is defined as between 4.5V and 5.5V, a level 6 is defined as between 5.5V and 6.5V, and a level 7 is defined as above 6.5V, and the pair of driving voltages (1,2) indicates that the driving voltage on the arbitration line 1 is level 1 and the driving voltage on the arbitration line 2 is level 2.
Each symbol of the identifier is a logical number, and each symbol is encoded to result in a corresponding drive voltage pair on the arbitration bus. Assuming that the voltage pair corresponding to the symbol 1 is (1,2), when the communication node transmits the symbol 1, the symbol 1 is encoded, the corresponding driving voltage pair (1,2) is found according to the mapping table of the symbol-driving voltage pair, and then the driving voltage pair is converted into corresponding driving voltages, such as (1v, 2v), through the arbitration interface module, the driving voltages are amplified respectively, and under the condition that the interface is turned on, the amplified voltages are conducted onto two arbitration lines, that is, the symbol 1 is successfully transmitted onto the arbitration bus. When judging whether the symbol is successfully sent to the arbitration bus, the communication node inquires actual voltages on two arbitration lines of the arbitration bus, removes a fixed amplification factor to obtain a driving voltage pair, and decodes the driving voltage pair to obtain a corresponding symbol, for example, a symbol 1 is obtained according to the driving voltage pair (1, 2).
In general, only one coding mode in the system converts symbols into driving voltage pairs, each symbol corresponds to a driving voltage pair one by one, and different symbols correspond to different driving voltage pairs. If only one coding mode is adopted, when the same symbols are continuously transmitted, because the coding results transmitted before and after are the same, the voltage on the corresponding arbitration line is not changed, when each communication node receives the symbols on the arbitration bus, the communication node cannot easily distinguish whether the communication node corresponds to one symbol or two same symbols, and the judgment error of the communication node is easily caused, and the competition of the data transmission right is influenced. The foregoing problems can be avoided by using two encoding schemes.
Step S200, the communication node detects whether the identifier of the communication node is successfully transmitted.
Specifically, after the communication node sends a bit symbol of the identifier, the communication node monitors the symbol on the arbitration bus; when the symbol on the arbitration bus is different from the symbol sent by the communication node, the sending of the identifier is considered to be failed, and the sending of the subsequent symbol of the identifier is stopped; when the symbol on the arbitration bus is the same as the symbol sent by the communication node, indicating that the communication node successfully sends the one-bit symbol of the identifier; if there are more symbols to send, continuing to send the next symbol of the identifier; when the communication node successfully transmits all symbols of the identifier, the transmission of the identifier is considered successful.
Step S300, when detecting that the identifier is successfully transmitted, the communication node is the winning communication node in the time period, and transmits its own data to the target data bus in the next data frame, while no longer transmitting the identifier in the current arbitration frame.
Step S400, when the identifier is detected to be failed to be sent, judging whether the current arbitration time period is the last arbitration time period of the current arbitration frame;
step S500 waits for the next arbitration period of the current arbitration frame to arrive when the current arbitration period is not the last arbitration period of the current arbitration frame, and then goes to step S100 until the identifier is successfully transmitted or the current arbitration period is the last arbitration period of the current arbitration frame.
Specifically, when a plurality of communication nodes simultaneously transmit identifiers, the communication node capable of correctly transmitting the identifiers to the arbitration bus obtains arbitration wins of the current arbitration time period, becomes a wining communication node, obtains the use right of the next data frame of the target data bus, and stops transmitting the identifier of the communication node in the arbitration frame.
If the identifier transmission failure is detected and the current arbitration time period is not the last arbitration time period of the current arbitration frame, the communication node can continue to participate in subsequent arbitration, and continues to transmit the identifier to participate in data transmission right election of the data bus when the next arbitration time period of the current arbitration frame comes, namely continues to transmit the identifier to strive for obtaining the use right of the target data bus when the next arbitration time period becomes the current arbitration time period.
Example (c): the bus structure comprises 1 pair of arbitration buses and 3 pairs of data buses, each arbitration frame comprises 3 arbitration time periods, the winning communication node of each arbitration time period obtains the data transmission right of the target data bus corresponding to the arbitration time period, for example, the target data bus of the 1 st arbitration time period is the 1 st pair of data bus, the target data bus of the 2 nd arbitration time period is the 2 nd pair of data bus, the target data bus of the 3 rd arbitration time period is the 3 rd pair of data bus, the winning communication node of the 1 st arbitration period of the current arbitration frame obtains the transmission of the 1 st data frame to the data bus, the winning communication node of the 2 nd arbitration period obtains the transmission of the 2 nd data frame to the data bus, and the winning communication node of the 3 rd arbitration period obtains the transmission of the 3 rd data frame to the data bus.
If the communication node obtains arbitration success in the 1 st arbitration time period of the current arbitration frame, the communication node is the winning communication node of the arbitration time period, and obtains data transmission of the next data frame of the data bus in the 1 st arbitration time period, and meanwhile, the communication node stops continuously transmitting the identifier of the communication node in the current arbitration frame, namely, the communication node does not participate in arbitration of the 2 nd and 3 rd arbitration time periods of the current arbitration frame. In the arbitration frame, the communication node obtains the data sending opportunity and does not participate in the subsequent competition of the data bus, so that the opportunity can be given to other equipment, and the fairness is increased.
If the communication node does not obtain arbitration wins in the 1 st arbitration period of the current arbitration frame, the communication node can continue to participate in the 2 nd arbitration of the current arbitration frame, and resend its own identifier in the 2 nd arbitration period. If the 2 nd arbitration fails, the 3 rd arbitration of the current arbitration frame can also be participated. If the 2 nd arbitration is successful, the communication node obtains to send data in the 2 nd data frame of the data bus while not participating in the 3 rd arbitration.
Devices that do not contend successfully have multiple arbitration opportunities in one arbitration frame and can continue to transmit identifiers, and once contention succeeds, no identifiers are transmitted in the current arbitration frame for the purpose of giving other devices opportunities. At the next arbitration frame, all devices are again participating in arbitration.
Due to the fact that multiple pairs of data buses exist, multiple communication nodes can compete out to obtain the use right of the data buses in each arbitration frame, and therefore the transmission rate of the data buses is improved.
In another embodiment of the present invention, as shown in fig. 3, a data transmission method using a special coding scheme includes:
on the basis of the previous embodiment, step S100 is replaced by steps S110, S120.
Step S110, in the current arbitration time period of the current arbitration frame, when the sent symbol is not the first symbol and the sum of the sent symbol and the previous symbol is an even number, the communication node with the data sending requirement sends the coding result generated by a coding mode different from the previous symbol;
step S120 is to transmit the coding result generated by the communication node having the data transmission requirement by using the same coding method as the previous symbol when the transmitted symbol is not the first symbol and the sum of the transmitted symbol and the previous symbol is an odd number.
The coding results of the same symbol in different coding modes are reflected on the arbitration bus, and the voltage difference of at least one arbitration line reaches a preset threshold value.
Specifically, for example, assuming that the driving voltages have 8 levels, which correspond to levels 0 to 7, two encoding methods are preferred as shown in table 1 (arbitration line driving voltage encoding table), and two groups of 16 voltage combinations are selected from 64 voltage combinations, and correspond to 16 symbols. The symbol transmission rule is as follows: if the sum of the current symbol and the previous symbol is an even number, the corresponding voltage in a group different from the previous symbol is output, namely if the last code uses the voltage value in the first group, the current code uses the corresponding voltage in the second group instead. If the sum of the current symbol and the previous symbol is odd, the corresponding voltage in the same group as the previous symbol is used, that is, if the last code uses the voltage value in the first group, the current code continues to use the corresponding voltage in the first group. Assuming that the previous symbol is 5, the first encoding method shown in table 1 is used, and the corresponding driving voltage pairs are (4,4), the driving voltage pairs corresponding to the current symbols sequentially 0 to 15 according to the symbol transmission rule of the present embodiment are shown in table 2.
By adopting the symbol sending rule in the embodiment, continuous sending of any two symbols corresponds to obvious voltage fluctuation on the arbitration bus, so that clock signals can be recovered in an asynchronous mode of each communication node, the symbols on the arbitration bus can be correctly identified, the decoding complexity is reduced, the decoding success rate is improved, and the anti-interference capability of a system is enhanced. The symbol sending rule is realized in a software mode on the conventional arbitration interface, and the cost is reduced compared with a hardware realization mode.
TABLE 1
TABLE 2
| Previous symbol | Current symbol | Driving voltage pair | Previous symbol | Current symbol | Driving voltage pair |
| 5 | 0 | (0,0) | 5 | 8 | (2,0) |
| 5 | 1 | (7,1) | 5 | 9 | (5,3) |
| 5 | 2 | (0,2) | 5 | 10 | (2,2) |
| 5 | 3 | (7,3) | 5 | 11 | (5,5) |
| 5 | 4 | (0,4) | 5 | 12 | (2,4) |
| 5 | 5 | (7,5) | 5 | 13 | (5,7) |
| 5 | 6 | (0,6) | 5 | 14 | (2,6) |
| 5 | 7 | (7,7) | 5 | 15 | (5,1) |
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.