CN114024795A - Baud rate self-adaption method and device, computer equipment and storage medium - Google Patents

Baud rate self-adaption method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114024795A
CN114024795A CN202111306733.4A CN202111306733A CN114024795A CN 114024795 A CN114024795 A CN 114024795A CN 202111306733 A CN202111306733 A CN 202111306733A CN 114024795 A CN114024795 A CN 114024795A
Authority
CN
China
Prior art keywords
level width
baud rate
target
level
width
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
CN202111306733.4A
Other languages
Chinese (zh)
Other versions
CN114024795B (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.)
Shenzhen Xhorse Electronics Co Ltd
Original Assignee
Shenzhen Xhorse Electronics Co Ltd
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 Shenzhen Xhorse Electronics Co Ltd filed Critical Shenzhen Xhorse Electronics Co Ltd
Priority to CN202111306733.4A priority Critical patent/CN114024795B/en
Publication of CN114024795A publication Critical patent/CN114024795A/en
Application granted granted Critical
Publication of CN114024795B publication Critical patent/CN114024795B/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
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/4013Management of data rate on the bus
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The application relates to a baud rate self-adaption method, a baud rate self-adaption device, computer equipment and a storage medium. The method comprises the following steps: acquiring a first level width between adjacent jumping edges; acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different; iteratively making a difference between the first level width and the second level width to obtain a target level width set; determining a target baud rate of communication between devices according to the target level width set; and performing communication based on the target baud rate. By adopting the method, the baud rate self-adaption efficiency can be improved.

Description

Baud rate self-adaption method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a baud rate adaptive method, apparatus, computer device, and computer-readable storage medium.
Background
The baud rate is one of the most important parameters in serial communication, and the host and the slave have to keep the baud rate consistent to establish communication. Therefore, when the master machine sends data according to a specific baud rate, the slave machine needs to know the baud rate of the current communication by some methods so as to enable the slave machine to correctly receive and process the data. The application scenarios are mainly divided into two types: one is that the host computer and the slave computer can be controlled, and the communication protocol can be modified or fine-tuned; the other is that the host is completely a black box, which cannot require the host to perform special operations, and only extracts the wave characteristic rate information from the waveform sent by the host.
The common scheme is that the host sends appointed characters, and the slave can calculate the baud rate by detecting the width of the low-level signal. For example, if the host is appointed to send 0x55, the measured level of the slave obviously represents 1bit of time T(s), and the baud rate is (1/T). Return to zero codes may also be used so that each bit of data carries the baud rate information itself. Both methods are one hundred percent accurate and efficient in the case where both the master and the slave can be controlled, but both change the communication protocol to some extent.
For the case that the host is a black box, the host cannot send special characters even if only the communication protocol and the baud rate of the host are known, and the level width is usually used for judgment in such a scene. The conventional way measures continuously enough level pulse widths, the minimum must be the pulse width t(s) corresponding to 1 bit. In practical application, errors occur in a traditional mode under specific conditions, the situation that the errors cannot be judged is not few, and new level widths cannot be judged all the time. The traditional baud rate self-adaption method has the problem of low self-adaption efficiency.
Disclosure of Invention
In view of the above, it is necessary to provide a baud rate adaptation method, an apparatus, a computer device, and a storage medium capable of improving baud rate adaptation efficiency.
A baud rate adaptation method, the method comprising:
acquiring a first level width between adjacent jumping edges;
acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different;
iteratively making a difference between the first level width and the second level width to obtain a target level width set;
determining a target baud rate of communication between devices according to the target level width set;
and performing communication based on the target baud rate.
A baud rate adaptation apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a first level width between adjacent jumping edges;
the second acquisition module is used for acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different;
the iteration difference making module is used for performing iteration difference making on the first level width and the second level width to obtain a target level width set;
the baud rate determining module is used for determining a target baud rate of communication between the devices according to the target level width set;
and the communication module is used for carrying out communication based on the target baud rate.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of the embodiments when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of the embodiments.
According to the baud rate self-adaption method, the baud rate self-adaption device, the computer equipment and the storage medium, the first level width and the second level width are obtained, iteration difference making is carried out, the obtained level widths can be fully utilized to obtain a plurality of level widths, the baud rates do not need to be obtained continuously after new level width values appear, and the baud rates can be obtained rapidly through the plurality of level widths.
Drawings
FIG. 1 is a diagram of an exemplary implementation of baud rate adaptation;
FIG. 2 is a schematic flow chart of a baud rate adaptation method in one embodiment;
FIG. 3 is a diagram illustrating level widths in one embodiment;
FIG. 4 is a schematic flow chart of another exemplary baud rate adaptation method;
FIG. 5 is a block diagram of an exemplary baud rate adaptation device;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
It should be noted that all directional indicators (such as upper, lower, left, right, front and rear … …) in the embodiment of the present invention are only used to explain the relative position relationship between the components, the movement situation, etc. in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indicator is changed accordingly, and the connection may be a direct connection or an indirect connection.
In addition, the descriptions related to "first", "second", etc. in the present invention are only for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
In one embodiment, as shown in fig. 1, a diagram of an application environment for baud rate adaptation in one embodiment is shown. Including a vehicle diagnostic instrument 110 and a vehicle 120. Since the vehicle diagnostic apparatus is difficult to know the vehicle type of the vehicle and the baud rate of communication in advance, and only the communication protocol adopted by the communication between the devices is known, baud rate self-adaptation is required. In the scenario of fig. 1, the vehicle diagnostic apparatus 110 may be considered as a slave and the vehicle 120 as a master. In the case where the host is a black box, no matter what method is used to obtain the baud rate, the communication information carried by the waveform used to obtain the baud rate is necessarily lost. Before the baud rate is obtained, the slave machine cannot correctly receive and analyze, and the speed of obtaining the baud rate means the amount of lost information, so that the baud rate self-adaption efficiency is of great importance. It is understood that the embodiments of the present application can also be applied between two computer devices. In the following, the baud rate adaptive method is applied to a computer device, which is exemplified by a vehicle diagnostic apparatus.
In an embodiment, as shown in fig. 2, a schematic flow chart of a baud rate adaptation method in an embodiment includes:
at step 202, a first level width between adjacent transition edges is obtained.
Specifically, the first level width between adjacent transition edges refers to a level width conforming to a communication protocol. For a communication protocol with a limited baud rate, for example, when the communication protocol is a CAN (Controller Area Network) communication protocol, because the CAN communication protocol has a unique "full 5 insert 1" mechanism, when 5 consecutive identical levels appear on the CAN bus, 1 opposite level is inserted, and a jump edge for synchronization is generated. Therefore, the first level width between adjacent jumping edges in the CAN messages with the same baud rate is only corresponding to 5 conditions of 1bit, 2bit, 3bit, 4bit and 5 bit.
For a communication protocol with a baud rate that can be continuously changed, for example, when the communication protocol is UART (Universal Asynchronous Receiver/Transmitter), since the most commonly used UART format is idle + start bit + 8bit data + stop bit, it is obvious that there are 9 cases in total of 1bit, 2bit, 3bit, 4bit, 5bit, 6bit, 7bit, 8bit, and 9bit in the waveform with the uniform baud rate. The communication protocol with the baud rate capable of changing continuously means that the baud rate supported by the communication protocol is not a specific plurality of baud rates, but can be any baud rate. The vehicle sends signals with only one baud rate of the communication protocol, namely the baud rate adopted by the signals sent by the same vehicle is generally the same.
It is understood that the first level width may be a width of a high level, and may also be a width of a low level. Since the communication bus is normally high when idle, the first level width is preferably a low level width. The vehicle diagnostic instrument receives a signal sent by a vehicle, and acquires a first level width between adjacent jumping edges in the signal in real time through a counter. The signal is a non-return-to-zero code signal.
Step 204, acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different.
Wherein the second level width is a level width between adjacent transition edges after the first level width. And the value of the first level width and the value of the second level width are different. It is understood that the second level width may be a width of a high level, and may also be a width of a low level. Since the communication bus is normally high when idle, the second level width is preferably a low level width. The level type of the second level width may be the same as or different from the level type of the first level width.
Specifically, after acquiring the first level width, the vehicle diagnostic apparatus continues to acquire the level width, which is not retained when the acquired level width is the same as the first level width. Until a second level width different in value from the first level width is obtained.
In this embodiment, as shown in fig. 3, a schematic diagram of the level width in one embodiment is shown. Taking the first level width and the second level width as low level widths as an example, in fig. 3, first is the first level width and second is the second level width.
And step 206, performing iterative subtraction on the first level width and the second level width to obtain a target level width set.
The iterative difference making refers to a process of making difference for multiple times, and the difference values obtained by making difference for multiple times are not repeated. The set of target level widths includes the difference. The difference, the first level width, and the second level width may also be included in the set of target level widths.
Specifically, the vehicle diagnostic apparatus iteratively performs a difference between the first level width and the second level width until no new value appears, and obtains a target level width set. The new value is different from the value that was obtained.
And step 208, determining a target baud rate of communication between the devices according to the target level width set.
Specifically, the vehicle diagnostic apparatus determines a minimum level width according to the target level set, and determines a target baud rate of communication between devices according to the minimum level width. After iterative difference making, the vehicle diagnostic instrument can obtain a plurality of level widths, and then the vehicle diagnostic instrument can determine the minimum level width from the target level width set and take the baud rate corresponding to the minimum level width as the target baud rate. For example, if the first level width is 4 and the second level width is 5, then the iteration makes a difference of 5-4-1, 5-1-4, 4-1-3, 3-1-2 … so that the difference includes 1, 2, 3, and 4. Then the device does not need to wait for 1 to appear, and the minimum level width can be obtained by iteratively making a difference, and the reciprocal of the minimum level width is the target baud rate. The above 1, 2, 3, 4 and 5 are used to indicate relative widths.
Step 210, communication is performed based on the target baud rate.
Where baud rate represents the number of symbol symbols transmitted in each strip, which is a measure of the symbol transmission rate. In an information transmission channel, a signal unit carrying data information is called a symbol, and the number of symbols transmitted through the channel per second is called a symbol transmission rate, which is referred to as a baud rate for short.
Specifically, the vehicle diagnostic communicates with the vehicle based on the target baud rate.
According to the baud rate self-adaption method, the first level width and the second level width are obtained, iteration is carried out to make a difference, the obtained level widths can be fully utilized to obtain a plurality of level widths, a new level width value does not need to be waited for to appear all the time, and the baud rate can be quickly obtained through the plurality of level widths.
In one embodiment, the set of target level widths includes a difference value obtained by iteratively performing the difference, a first level width, and a second level width.
Determining a target baud rate of communication between devices according to a target level width set, comprising:
determining a minimum level width from the first level width, the second level width, and the difference when the difference is different from both the first level width and the second level width;
determining a baud rate corresponding to the minimum level width;
and taking the baud rate corresponding to the minimum level width as the target baud rate of communication between the devices.
Specifically, when the difference value obtained by iteratively making the difference includes a difference value different from both the first level width and the second level width, the vehicle diagnostic apparatus determines the minimum level width from among the first level width, the second level width, and the difference value. The vehicle diagnostic instrument takes the baud rate corresponding to the minimum level width as the target baud rate of communication between the devices. For example, if the first level width is 3 and the second level width is 2, the difference result obtained by iteration includes 1, 1 is different from 2 and 3, so that the minimum level width 1 can be determined from 1, 2 and 3 to obtain the baud rate.
In this embodiment, it is found through analysis that there are (2N +1) level widths for a communication protocol having a limited baud rate, such as a CAN protocol. Since an odd number value can be obtained inevitably when (N +1) level widths are obtained, the minimum level width can be obtained by performing iteration difference, and thus the baud rate corresponding to the minimum level width can be used as the target baud rate.
For a communication protocol with a variable baud rate, such as a UART protocol, there is no special level value, such as a limited baud rate, and then, by sacrificing some accuracy, the baud rate corresponding to the minimum level width therein can also be used as the target baud rate.
As shown in table 1 below, for a communication protocol in which the baud rate can be continuously varied, there is a possible combination of low level widths in one period. The communication protocol with the baud rate capable of changing continuously means that the baud rate supported by the communication protocol is not a specific plurality of baud rates, but can be any baud rate. The vehicle sends signals with only one baud rate of the communication protocol, namely the baud rate adopted by the signals sent by the same vehicle is generally the same. In the case of the UART protocol, a maximum of 5 low levels occur in one cycle, and therefore a fifth value is set. The first value is the first level width received, the second value is the second level width … received and the fifth value is the fifth level width received, with the possible combinations shown in table 1. The considered position refers to a position where the obtained value (i.e., level width) is considered to be located in the waveform since there may be 9 levels in one cycle of the UART. Taking the first value as 1 and the second value as 2 as an example, 1 may occur at the first position, the second position …, etc., and 2 may occur at the second position, the third position, etc., i.e., there are 10 possibilities that may be low, high, low, high, ….
A total of 256 combinations were made according to the data in Table 1 below. The probability of occurrence 1 is 207/256, the probability of occurrence 2 is 138/256, the probability of occurrence 3 is 74/256, the probability of occurrence 4 is 35/256, the probability of occurrence 5 is 16/256, the probability of occurrence 6 is 7/256, the probability of occurrence 7 is 3/256, the probability of occurrence 8 is 1/256, and the probability of occurrence 9 is 1/256. It is clear that the probability of occurrence of 1, 2 is much greater than the probability of occurrence of 8, 9. It can be guessed that under the condition of sacrificing a little accuracy, the cases which can not be judged, such as the cases of receiving 3, 6 and 9 or 2, 4 and 8, etc., are regarded as receiving 1, 2 and 3, so that the efficiency can be greatly improved, and at the same time, most cases which can not be judged because the new value is not available all the time can be eliminated. A similar case in which 3, 6, and 9 or 2, 4, and 8 are received is regarded as a case in which 1, 2, and 3 are received is called a large probability approximation.
TABLE 1
Figure BDA0003340569390000071
As shown in table 2 below, the probability that a byte cannot be determined when a byte is received means the probability that the baud rate cannot be determined after a byte is received. The probability that the 1byte itself or the difference contains 1 means the probability that the 1byte itself contains the minimum level width or contains the minimum level width after iterative difference. The probability that 1 is included but the baud rate cannot be determined means the probability that 1byte includes the minimum level width. The probability that the self or the difference includes 1 and more than 3 means that the self level width includes 1 and the value of the level width is more than 3. Taking 1byte as an example, the probability that the 1 and more than 3 probabilities cannot be determined is the ratio of the probability that the 1 and more than 3 probabilities cannot be determined by itself or by difference to the probability that the 1byte cannot be determined. The mathematical meaning is that a mode of approximate probability approximation is adopted, and the probability of the target baud rate can be determined in the case that the probability cannot be judged. If the number of the cells cannot be determined, the probability of 1 and more than 3 is 35.54688%/91.79688% × 100%: 38.72340%. That is, in the case where it cannot be determined, there is a probability of 38.72340% that the correct baud rate can be determined.
TABLE 2
Figure BDA0003340569390000081
For a communication protocol with a baud rate capable of changing continuously, the efficiency can be improved greatly on the premise of sacrificing a very small accuracy rate by increasing the approximate rate. Taking the UART as an example, in practice, for the UART waveform that transmits random numbers, the probability of occurrence of different widths is not uniformly distributed, the probability of occurrence of 1-bit width is much higher than 9-bit width, and the probability of occurrence gradually decreases from 1 to 9. Considering that the baud rate is judged as early as possible, the probabilities of 1-byte judgment, 2-byte judgment and 3-byte judgment and the probability of 1-bit width in the case that the baud rate cannot be judged are calculated. It can be found that the probability of containing a 1bit width in the case that a 2byte cannot be judged is 95.33229%. Since the probability of 1, 2 combination and 2, 4 combination is high, and 2, 4 does not contain 1, if the accuracy needs to be improved, a limiting condition can be added: 3 widths need to appear in 3 bytes, so that the judgment probability is reduced to 93.90364%, and the accuracy is improved to a certain extent.
Whereas the probability of including a 1bit width in the case that 3 bytes cannot be judged is 98.22860%. The case where 3 bytes cannot be judged may be the case where 1, 2 and 3 or 2, 3 and 4 are received because it is unclear whether 1, 2 and 3 or 2, 4 and 6 or 3, 6 and 9 are actually received at 1, 2 and 3, and the case where 2, 3 and 4 are received is unclear whether 2, 3 and 4 or 4, 6 and 8 are actually received. And because the probability that the 3-byte can not be judged is up to 98.22860%, the 3-byte can not be judged under the application scene that the requirement on efficiency is high and certain accuracy is allowed to be sacrificed, the 3-byte can not be judged and the 1-bit width is included. That is, if 3 kinds of level widths are obtained, the accuracy of the target baud rate can reach 93.90364%, and the requirement is met. The calculation of the target baud rate can be determined after 4 levels of widths are obtained, and actually, the game between the accuracy and the efficiency is obtained.
For the special case mentioned above, which cannot be determined, it can be known that the large probability itself or the difference obtained after iterative subtraction contains a width representing 1 bit. One hundred percent reliability is not generally required in engineering applications, as long as the error probability is within an acceptable range, so that the case that can be judged by considering a large probability is also considered to be judged, and the related probability processed in this way is given in table 3 below. Since the probability of 1 and 2 is very high, and if only 1, 2 widths are given all the time, it is difficult to distinguish 1, 2, 4 or 3, 6, etc., which results in that the probability of 1 and more than 3 in the case of no judgment seems not high, and in fact most cases does not satisfy the condition of 1, but does not satisfy more than 3 different widths, so that it is advisable to consider the minimum value directly as 1bit width in the case where five values cannot be obtained by making an iteration difference when more than 3 different widths are obtained, with almost no error.
As shown in table 3, the comparison of the approximate adaptive efficiency with the special case that cannot be determined is shown to show the presence or absence of approximate adaptive efficiency.
Figure BDA0003340569390000091
Figure BDA0003340569390000101
Table 3 above gives the comparison of the adaptive efficiency without considering the approximate probability approximation and with considering the approximate probability. The number of different widths needs to be the same, but under the condition of considering the approximation of the large probability, the probability that the judgment can be carried out is greatly improved no matter the judgment is carried out after a plurality of bytes are received. The judgment probability of 2 bytes reaches more than 80%, and the judgment probability of 3 bytes is close to 94%. If the requirement is relaxed to 4 bytes, the probability is further increased, and compared with the communication protocol with variable baud rate, the baud rate self-adaption efficiency is very high by considering the level width iteration difference method with large probability approximation.
In the embodiment, when the difference value different from the first level width and the second level width is obtained, the minimum level width is determined, so that the target baud rate is determined, a new value in a signal does not need to be waited for, and the baud rate self-adaption efficiency is improved.
In one embodiment, determining a target baud rate for communication between devices based on the difference results comprises:
when the number values contained in the target level width set are less than three, acquiring a third level width; the third level width is a level width between adjacent transition edges in a direction backward from the second level width; the third level width is different from both the first level width and the second level width;
performing iterative subtraction according to the target level width set and the third level width until a new value is not iterated, and obtaining a plurality of level widths;
determining a minimum level width from a plurality of level widths;
and determining the baud rate corresponding to the minimum level width to obtain the target baud rate of communication between the devices.
The target level width set comprises a result obtained by iterative difference, a first level width and a second level width.
Specifically, for a communication protocol with a maximum level width corresponding to (2N) bit or (2N +1) bit, all possible low level widths can be obtained by iteratively making differences only by obtaining the level widths between (N +1) different adjacent transition edges. Taking the CAN protocol as an example, the level widths include 1, 2, 3, 4 and 5, so when 2 and 4 are obtained, iteration difference cannot obtain a new value, and then a new level width is obtained, that is, 1, 3 or 5, so that any odd number is different from iteration differences of 2 and 4, and 1 CAN be obtained inevitably. Determining the minimum level width from the plurality of level widths enables the target baud rate to be determined. Taking the UART protocol as an example, the accuracy of calculating the target baud rate by obtaining 3 level widths can also reach 93.9%.
In this embodiment, when the number included in the target level width set is less than three, a third level width different from the first level width and the second level width is obtained, and the condition of (N +1) can be basically satisfied, so that the baud rate adaptation accuracy is improved, and the baud rate adaptation efficiency is also improved.
In one embodiment, determining the baud rate corresponding to the minimum level width includes:
carrying out width matching on the minimum level width, and determining the reference level width corresponding to the minimum level width;
and determining a reference baud rate corresponding to the reference level width.
The reference level width refers to a level width corresponding to the reference baud rate. For example, the reference level width corresponding to the baud rate of 1M is 1us, and the reference level width corresponding to the baud rate of 250K is 4 us.
Specifically, in the case where the communication protocol is a communication protocol having a limited baud rate, the vehicle diagnostic apparatus width-matches the minimum level width with each level width range, determines the corresponding level width range, and thereby obtains the reference level width. One level width range corresponds to one reference level width. Then, the reciprocal of the reference level width is the reference baud rate. For example, a minimum level width of 4.1, corresponding to a level width in the range of 3.6-4.4, then in practice the corresponding reference level width should be 4, so as to obtain a baud rate of 250K.
As in table 4, match for the minimum level width of the clock at 10 MHZ. As can be seen from table 4, when the baud rate is 1M, the reference level width is 10, the minimum value in the level width range is 9, and the maximum value is 11.
TABLE 4 minimum Length output match (10MHz)
Baud rate/bsp Width of reference level min max
1M 10 9 11
500K 20 18 22
250K 40 36 44
100K 100 90 110
ERROR 5 Others Others
TABLE 5 minimum Length output match (50MHz)
Figure BDA0003340569390000111
Figure BDA0003340569390000121
In this embodiment, the minimum level width is subjected to width matching, and the reference level width corresponding to the minimum level width is determined, so that the error of the minimum level width can be reduced to match the standard level width, and the reference baud rate corresponding to the reference level width is determined, so that the correct baud rate can be obtained.
In one embodiment, the set of target level widths includes a difference value obtained by iteratively subtracting.
Determining a target baud rate of communication between devices according to a target level width set, comprising:
when a target difference value in a preset level width set is obtained during iterative differencing, taking a baud rate corresponding to the target difference value as a target baud rate of communication between devices; the preset level width in the preset level width set has and only corresponds to one baud rate.
The preset level width in the preset level width set has and only corresponds to one baud rate. And the preset level width may represent a level width within a range.
Specifically, for a communication protocol with a limited baud rate, for example, the baud rate can only be 1M, 500K, 250K, 100K, etc., it can be known through analysis that some level widths with specific lengths only exist at a specific baud rate. For example, when the width of the level obtained when the iteration is poor is 1us, the baud rate is inevitably 1M. Therefore, when the target difference value in the preset level width set is obtained during iterative subtraction, the vehicle diagnostic apparatus can use the baud rate corresponding to the target difference value as the target baud rate of communication between devices.
In one embodiment, as shown in table 6, for a communication protocol with a finite baud rate, the clock frequency is 10MHZ, t is 0.1us, and there are:
Figure BDA0003340569390000122
where bsp represents the baud rate,. sup.1/us represents microseconds,. sup.10% represents the error taken into account by 10%. For example, at a baud rate of 1M, the level widths may be 1 microsecond, 2 microseconds, 3 microseconds, 4 microseconds, and 5 microseconds. The above table shows the counts at 10MHZ, i.e. each time the count is 0.1us, the count is 9-11 for a level width of 1us and 18-22 for a level width of 2 us. Since some values are duplicated, duplicated values 54, 55, 108, 109, and 110 are discarded. 9-11, 18-22, etc. are all level width ranges.
The preset level width set includes 1, 3, 5, 6, 12, 16, 30, 40, and 50. Or may be 10, 30, 50, 60, 120, 160, 300, 400, and 500, by count. The preset level width set may also include 0.9-1.1, 2.7-3.3, 4.5-5.5, 5.4-6.6, 10.8-13.2, 14.4-17.6, 27-33, 36-44, and 45-55, taking into account errors in the level widths. Similarly, the predetermined set of level widths may also include 9-11, 27-33, 45-55, 5.4-6.6, 90-110, 108, 132, 90-110.
As can be seen from the analysis of table 6, taking the unit of time duration as microsecond as an example, when the width of the level between adjacent transition edges is 1, only the case of the baud rate of 1M occurs. And when 2 occurs between adjacent transition edges, it may be 1M, or may be a baud rate of 500K. At this time, the second level width needs to be acquired again, and if 8 appears, 8-2 equals 6,6-2 equals 4,4-2 equals 2, and the minimum level is 2, so that the baud rate is 500K.
As in table 7, for a communication protocol with a finite baud rate, the clock frequency is 50MHZ, t is 20ns, and;
Figure BDA0003340569390000131
no consideration is given to the extreme case of just biasing to 10%; taking into account sampling errors; the red characters in the table indicate that the overlapped parts exist; the cell representation of the green shading can directly judge the baud rate without entering a self-adaptive state machine. The received 220-, 225-, 265-, 280-, 445-, 535-555-are discarded.
For a communication protocol with a limited number of common baud rates, there may be some special values that occur only at a particular baud rate. Taking the CAN protocol as an example, observing the above 2 tables, it CAN be found that if the input is matched to 1, 3, 5, the directly obtained communication baud rate is 1MHz, if the input is matched to 6, the baud rate is 500KHz, if the input is matched to 12, 16, the baud rate corresponds to 250K, if the input is matched to 30, 40, 50, the baud rate is necessarily 100 KHz. The following conclusions can be concluded: for a communication protocol with a limited number of commonly used baud rates, special values which can only appear under a specific baud rate exist, if the special values appear when input or difference is made, the baud rate can be judged to jump out of a cycle immediately, and information missed due to baud rate judgment is reduced as much as possible.
In this embodiment, when the target difference in the preset level width set is obtained during iterative subtraction, the baud rate corresponding to the target difference is used as the target baud rate, so that the target baud rate can be obtained without completing iterative subtraction, and the baud rate adaptive efficiency is improved.
In one embodiment, obtaining a second level width between backward adjacent transition edges comprises:
and when the first level width is not in the preset level width set, acquiring a second level width between backward adjacent jumping edges. The preset level width in the preset level width set has and only corresponds to one baud rate.
Specifically, for a communication protocol with a limited baud rate, width matching is carried out on a first level width, and a reference level width corresponding to the first level width is determined; and when the reference level width corresponding to the first level width is not in the preset level width set, acquiring a second level width between backward adjacent jumping edges.
In this embodiment, when the first level width is not in the preset level width set, it is indicated that the target baud rate cannot be determined only by the first level width, and therefore baud rate adaptation needs to be performed in combination with the second level width between the backward adjacent transition edges.
In one embodiment, the baud rate adaptation method further comprises: and when the first level width is in the preset level width set, taking the baud rate corresponding to the first level width as the target baud rate of communication between the devices.
Specifically, for a communication protocol with a limited baud rate, width matching is carried out on a first level width, and a reference level width corresponding to the first level width is determined; and when the reference level width corresponding to the first level width is in the preset level width set, taking the baud rate corresponding to the first level width as the baud rate of communication between the devices.
In this embodiment, when the first level width is in the preset level width set, it is described that the target baud rate can be determined only by the first level width, and the baud rate adaptive efficiency is improved.
In one embodiment, after communicating based on the target baud rate, the baud rate adaptation method further comprises:
monitoring the level width of the waveform obtained on the bus;
and when the abnormal width is determined to occur based on the level width of the waveform, sending an alarm signal and re-executing the step of acquiring the first level width between the adjacent jumping edges.
In this embodiment, after the baud rate adaptation is completed, it is still possible to monitor whether the waveform obtained on the bus has an abnormal pulse width that is too long or too short, and if an abnormal pulse width occurs, an error can be reported to the controller, and the controller can be reset when necessary, and restart the adaptation of the baud rate.
In one embodiment, a baud rate adaptation method comprises:
step a1, a first level width between adjacent transition edges is obtained.
Step a2, when the first level width is in the preset level width set, taking the baud rate corresponding to the first level width as the target baud rate of communication between devices.
Step a3, when the first level width is not in the preset level width set, acquiring a second level width between backward adjacent jumping edges; the preset level width in the preset level width set is only corresponding to one baud; the first level width and the second level width are different.
Step a4, performing iteration difference on the first level width and the second level width to obtain a target level width set; the target level width set comprises a difference value obtained by iterative difference, a first level width and a second level width.
Step a5, when obtaining a target difference value in a preset level width set during iterative subtraction, taking the baud rate corresponding to the target difference value as the target baud rate of communication between devices; the preset level width in the preset level width set has and only corresponds to one baud rate.
Step a6, when the difference is different from both the first level width and the second level width, determining a minimum level width from among the first level width, the second level width, and the difference.
Step a7, determining the baud rate corresponding to the minimum level width.
And a8, taking the baud rate corresponding to the minimum level width as the target baud rate of communication between the devices.
Step a9, when the number value contained in the target level width set is less than three, obtaining a third level width; the third level width is a level width between adjacent transition edges in a direction backward from the second level width; the third level width is different from both the first level width and the second level width.
And a10, performing iteration difference according to the target level width set and the third level width until a new value is not iterated, and obtaining a plurality of level widths.
Step a11, a minimum level width is determined from the plurality of level widths.
And a12, performing width matching on the minimum level width, and determining the reference level width corresponding to the minimum level width.
Step a13, determining a reference baud rate corresponding to the reference level width, and obtaining a target baud rate of communication between devices.
Step a14, communication is performed based on the target baud rate.
Step a15, the level width of the waveform obtained on the bus is monitored.
Step a16, when the abnormal width is determined to occur based on the level width of the waveform, an alarm signal is sent out and the step of acquiring the first level width between adjacent transition edges is executed again.
According to the baud rate self-adaption method, the only baud rate can be determined by screening through the preset level width set, and the baud rate can be obtained without differentiating to a complete sequence; various deviations and interferences under the actual application scene are considered, the error condition caused by subtracting two very similar values as different values is avoided, and the condition that the baud rate cannot be judged because no new width exists in the waveform sent by the host is greatly reduced.
In one embodiment, as shown in fig. 4, a flow diagram of a baud rate adaptation method in another embodiment is shown.
Direct input or ADC sampling: the vehicle diagnostic apparatus receives a signal transmitted by the vehicle, or the vehicle diagnostic apparatus samples the signal through an ADC (Analog to Digital Converter).
Measuring the width of a low level: the vehicle diagnostic measures the low level width between adjacent trip edges.
Input matching: for a communication protocol with a limited baud rate, all results of low level width measured under a specific clock can be predicted, the standard theoretical values are taken as centers, errors caused by factors such as clock offset and sampling are considered, numbers between two adjacent centers are divided, and numerical values of an overlapping part are discarded, so that the efficiency is improved on the premise of ensuring the accuracy, the available values are increased, two practically identical numerical values which are different due to the errors are judged to be 2 different numerical values, and the baud rate self-adaption error condition caused by obtaining a very small number through difference is avoided.
For a communication protocol with a limited baud rate, the baud rate value can be directly obtained by the existence of a plurality of specific width values under a certain baud rate. Taking CAN bus communication as an example, the Baud rates of CAN are 1M, 500K, 250K and 100K, and 1bit width corresponding to 1M is counted as 1,
when the input matching result is 1, 3 or 5, determining that the baud rate is 1M inevitably;
when the input matching result is 6, the baud rate is necessarily 500K;
when input matching results appear 12 and 16, the baud rate is necessarily 250K;
when the input matching results appear 30, 40 and 50, the baud rate is necessarily 100K;
similarly, the target baud rate can be obtained immediately as soon as the above-mentioned special value appears in the result of the iterative subtraction.
Input matching for baud rate continuous communication protocols: when comparing the level widths, there may be a case where the values of the minute deviations should be equal theoretically but actually have minute deviations due to the influence of errors such as measurement errors and pulse width errors, and it is necessary to consider how to put the values of the minute deviations into the same value. In contrast to the case of a finite number of commonly used baud rates, the baud rate of such protocols can theoretically be any value, so that there is no so-called central value, and each measured value can be a standard, unbiased value. The processing is that the number obtained firstly is taken as a central value, and if the number obtained subsequently falls in the range divided by the central value, the number is considered to be the same value, so that the signal under a certain baud rate can be correctly received mainly because of using similar baud rates, and the result cannot be influenced because the central value is slightly deviated. The specific implementation scheme mainly has 2 types, namely, the last n bits of the counter are ignored, and the specified deviation is regarded as the same within a certain proportion. The former is fixed value deviation correction, and because the span of the self-adaptive baud rate range of the target design is large, the fixed value correction can cause large value misjudgment, and the same value is written in; the latter is a fixed-scale deviation correction, and all the deviations 1/16 are considered as the same value, so that the situation that the final baud rate judgment result is a large value due to the fact that the writing deviation is small and the baud rate judgment result is theoretically equal can be prevented. For a communication protocol with a variable baud rate, when a preset ratio condition is satisfied, a minimum level width can be determined from the level widths satisfying the preset ratio condition, so as to determine a target baud rate.
And (3) iterative difference making: the simplest utilization mode of the low level width is that the minimum one of all possible widths is received and is necessarily corresponding to 1bit, the baud rate is equal to the reciprocal of the minimum one, but the efficiency is extremely low, and if one of the widths does not appear, the minimum one cannot be judged all the time; and iterative differencing can make the most efficient use of these widths. Taking the low level width of 1 and 5 measured on the CAN bus as an example, we CAN get 5 possible widths by iteratively making differences, and get the baud rate at once. For any set of low-level widths, the iterative subtraction maximizes the use of these data until no new values are present, and achieves maximum efficiency in the use of low-level widths. When the iterative subtraction is performed to obtain a new value, the minimum level width is found from the obtained low level width and the difference value obtained by the iterative subtraction. And when the iteration difference cannot obtain a new value, returning to the step of measuring the low level width.
Find the minimum level width: and finding out the minimum level width from the obtained low level width and difference result.
Minimum level width matching: for a communication protocol with a limited number of commonly used baud rates, there may be some values that fall within the matching gap after input matching due to excessive skew or other reasons. These values are iteratively subtracted to give a baud value that is a little bit different from the standard value of the minimum level width at several baud rates. Although the value thus obtained may be erroneous and should be discarded, there are cases where it can be utilized. In order to maximize the efficiency of baud rate self-adaptive judgment, output matching is added, and the minimum level width value obtained by the condition is matched with the central value of the corresponding standard baud rate.
Because the error processing is not performed on the value of the matching gap in the input matching, the adaptive stage is entered, and the set _ error processing needs to be reported when the adaptive result cannot be matched. For example, 171 and 65 are the values of the matching gap when input, the minimum value is 65 after the adaptation process is completed, the result matching cannot be completed, set _ error is reported, and the channel is closed. Since the values of these gaps are not matched with the input, there are many situations, and most of them will fall into the gap of the result matching after completing the adaptive process, and set _ error will be reported. And after the values of the gaps of the partial values input and matched for some reasons are self-adaptive, the output result falls into a result matching area, the result can be solved according to the result, the channel can be closed by mistake if the result can not be solved, and if the result can be solved, the result is correct.
Target baud rate: and taking the baud rate corresponding to the minimum level width as the target baud rate.
A controller: the controller obtains a target baud rate and performs communication between devices based on the target baud rate.
In this embodiment, taking a communication protocol with a finite baud rate as an example, the case that a frame cannot be determined may only be the case of 2, 4 and 8 in table 6 or table 7, and only 2 values and the difference between 2 values is not a new value, so that the frame cannot be determined. It can be seen that 9989 of 10000 trials (one rst is added in the end, so the last rst is 10002 in the figure) are completed in baud rate setting, the number of misjudgment is only 12, the probability of special cases is about 0.12%, and the value is quite low and is allowed to appear. For the communication protocol with variable baud rate, the probability of judging the target baud rate in the above mode is as high as 93.9%. Therefore, the efficiency of the baud rate can be improved while ensuring the correct rate.
It should be understood that, although the respective steps in the flowcharts of fig. 2 and 4 described above are sequentially displayed as indicated by arrows and the respective steps from the step (a1) to the step (a16) are sequentially displayed as indicated by reference numerals, the steps are not necessarily sequentially performed in the order indicated by the arrows or numerals. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 4 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 5, a block diagram of a baud rate adaptive apparatus in an embodiment is shown, the apparatus includes a first obtaining module 502, a second obtaining module 504, an iterative difference module 506, a baud rate determining module 508, and a communication module 510, where:
a first obtaining module 502, configured to obtain a first level width between adjacent transition edges;
a second obtaining module 504, configured to obtain a second level width between backward adjacent transition edges; the first level width and the second level width are different;
an iterative difference-making module 506, configured to perform iterative difference-making on the first level width and the second level width to obtain a target level width set;
a baud rate determining module 508, configured to determine a target baud rate of communication between devices according to the target level width set;
a communication module 510, configured to perform communication based on the target baud rate.
According to the baud rate self-adaption device, the first level width and the second level width are obtained, iteration is carried out to make a difference, the obtained level widths can be fully utilized to obtain a plurality of level widths, the baud rate can be quickly obtained through the plurality of level widths without waiting for new level width values to appear all the time.
In one embodiment, the set of target level widths includes a difference value obtained by iteratively performing the difference, a first level width, and a second level width. A baud rate determining module 508 for determining a minimum level width from the first level width, the second level width, and the difference when the difference is different from both the first level width and the second level width;
determining a baud rate corresponding to the minimum level width;
and taking the baud rate corresponding to the minimum level width as the target baud rate of communication between the devices.
In this embodiment, it is found through analysis that there are (2N +1) level widths for a communication protocol having a limited baud rate, such as a CAN protocol. Since an odd number value can be obtained inevitably when (N +1) level widths are obtained, the minimum level width can be obtained by performing iteration difference, and thus the baud rate corresponding to the minimum level width can be used as the target baud rate.
In one embodiment, the baud rate determining module 508 is configured to obtain a third level width when the number included in the target level width set is less than three; the third level width is a level width between adjacent transition edges in a direction backward from the second level width; the third level width is different from both the first level width and the second level width;
performing iterative subtraction according to the target level width set and the third level width until a new value is not iterated, and obtaining a plurality of level widths;
determining a minimum level width from a plurality of level widths;
and determining the baud rate corresponding to the minimum level width to obtain the target baud rate of communication between the devices.
In this embodiment, when the number included in the target level width set is less than three, a third level width different from the first level width and the second level width is obtained, and the condition of (N +1) can be basically satisfied, so that the baud rate adaptation accuracy is improved, and the baud rate adaptation efficiency is also improved.
In an embodiment, the baud rate determining module 508 is configured to perform width matching on the minimum level width, and determine a reference level width corresponding to the minimum level width; and determining a reference baud rate corresponding to the reference level width.
In this embodiment, the minimum level width is subjected to width matching, and the reference level width corresponding to the minimum level width is determined, so that the error of the minimum level width can be reduced to match the standard level width, and the reference baud rate corresponding to the reference level width is determined, so that the correct baud rate can be obtained.
In one embodiment, the set of target level widths includes a difference value obtained by iteratively subtracting. The baud rate determining module 508 is configured to, when a target difference in the preset level width set is obtained during iterative subtraction, use a baud rate corresponding to the target difference as a target baud rate for communication between devices; the preset level width in the preset level width set has and only corresponds to one baud rate.
In this embodiment, when the target difference in the preset level width set is obtained during iterative subtraction, the baud rate corresponding to the target difference is used as the target baud rate, so that the target baud rate can be obtained without completing iterative subtraction, and the baud rate adaptive efficiency is improved.
In one embodiment, the second obtaining module 504 is configured to obtain a second level width between backward adjacent transition edges when the first level width is not in the preset level width set. The preset level width in the preset level width set has and only corresponds to one baud rate.
In this embodiment, when the first level width is not in the preset level width set, it is indicated that the target baud rate cannot be determined only by the first level width, and therefore baud rate adaptation needs to be performed in combination with the second level width between the backward adjacent transition edges.
In one embodiment, the baud rate determining module 508 is further configured to use the baud rate corresponding to the first level width as a target baud rate for communication between devices when the first level width is in the preset level width set.
In this embodiment, when the first level width is in the preset level width set, it is described that the target baud rate can be determined only by the first level width, and the baud rate adaptive efficiency is improved.
In one embodiment, the baud rate adaptive device further comprises an alarm module, wherein the alarm module is used for monitoring the level width of the waveform obtained on the bus;
when the abnormal width is determined to occur based on the level width of the waveform, sending an alarm signal;
the first obtaining module 502 is further configured to re-obtain the first level width between adjacent transition edges.
In the embodiment, after the baud rate self-adaption is completed, whether the waveform obtained on the bus has overlong or overlong abnormal pulse width can be monitored, if the abnormal pulse width occurs, an error can be reported to the controller, and the device can be reset when needed to restart the self-adaption of the baud rate.
For the specific definition of the baud rate adaptive device, reference may be made to the above definition of the baud rate adaptive method, which is not described herein again. The various modules in the baud rate adaptation apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal device, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a baud rate adaptation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the steps of the respective baud rate adaptation method embodiments described above when executing the computer program.
In one embodiment, a computer readable storage medium is provided, having a computer program stored thereon, which, when being executed by a processor, carries out the steps of the respective baud rate adaptation method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of the computer device from the computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by hardware related to instructions of a computer program, which may be stored in a non-volatile computer readable storage medium, and when executed, may include the processes of the above embodiments of the methods. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (11)

1. A baud rate adaptation method, comprising:
acquiring a first level width between adjacent jumping edges;
acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different;
iteratively making a difference between the first level width and the second level width to obtain a target level width set;
determining a target baud rate of communication between devices according to the target level width set;
and performing communication based on the target baud rate.
2. The method of claim 1, wherein the set of target level widths comprises a difference value obtained by iteratively subtracting, the first level width and the second level width;
the determining a target baud rate of communication between devices according to the target level width set includes:
determining a minimum level width from among the first level width, a second level width, and the difference when the difference is different from both the first level width and the second level width;
determining a baud rate corresponding to the minimum level width;
and taking the baud rate corresponding to the minimum level width as a target baud rate of communication between the devices.
3. The method of claim 1 or 2, wherein determining a target baud rate for communication between devices based on the set of target level widths comprises:
when the number values contained in the target level width set are less than three, acquiring a third level width; the third level width is a level width between adjacent transition edges after the second level width; the third level width is different from both the first level width and the second level width;
performing iterative subtraction according to the target level width set and the third level width until a new value is not iterated, and obtaining a plurality of level widths;
determining a minimum level width from the plurality of level widths;
and determining the baud rate corresponding to the minimum level width to obtain the target baud rate of communication between the devices.
4. The method of claim 3, wherein said determining the baud rate corresponding to the minimum level width comprises:
carrying out width matching on the minimum level width, and determining a reference level width corresponding to the minimum level width;
and determining a reference baud rate corresponding to the reference level width.
5. The method of claim 1, wherein the set of target level widths comprises difference values obtained by iteratively subtracting;
the determining a target baud rate of communication between devices according to the target level width set includes:
when a target difference value in a preset level width set is obtained during iterative differencing, taking a baud rate corresponding to the target difference value as a target baud rate of communication between devices; the preset level width in the preset level width set has and only corresponds to one baud rate.
6. The method of claim 1, wherein obtaining a second level width between adjacent transition edges in a backward direction comprises:
when the first level width is not in a preset level width set, acquiring a second level width between backward adjacent jumping edges; the preset level width in the preset level width set has and only corresponds to one baud rate.
7. The method of claim 6, further comprising:
and when the first level width is in the preset level width set, taking the baud rate corresponding to the first level width as a target baud rate of communication between devices.
8. The method of claim 1, wherein after said communicating based on said target baud rate, said method further comprises:
monitoring the level width of the waveform obtained on the bus;
and when the abnormal width is determined to occur based on the level width of the waveform, sending an alarm signal and re-executing the step of acquiring the first level width between the adjacent jumping edges.
9. A baud rate adaptation apparatus, comprising:
the first acquisition module is used for acquiring a first level width between adjacent jumping edges;
the second acquisition module is used for acquiring a second level width between backward adjacent jumping edges; the first level width and the second level width are different;
the iteration difference making module is used for performing iteration difference making on the first level width and the second level width to obtain a target level width set;
the baud rate determining module is used for determining a target baud rate of communication between the devices according to the target level width set;
and the communication module is used for carrying out communication based on the target baud rate.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
CN202111306733.4A 2021-11-05 2021-11-05 Baud rate self-adaption method, device, computer equipment and storage medium Active CN114024795B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111306733.4A CN114024795B (en) 2021-11-05 2021-11-05 Baud rate self-adaption method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111306733.4A CN114024795B (en) 2021-11-05 2021-11-05 Baud rate self-adaption method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114024795A true CN114024795A (en) 2022-02-08
CN114024795B CN114024795B (en) 2023-08-08

Family

ID=80061602

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111306733.4A Active CN114024795B (en) 2021-11-05 2021-11-05 Baud rate self-adaption method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114024795B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116155645A (en) * 2023-02-27 2023-05-23 上海中韩杜科泵业制造有限公司 CAN bus-based equipment network access method, device, equipment and medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060245515A1 (en) * 2005-04-28 2006-11-02 Nec Electronics Corporation Data reception apparatus and synchronizing signal detection method and program
US20060256849A1 (en) * 2005-05-12 2006-11-16 Rdc Semiconductor Co., Ltd. Adaptive blind start-up receiver architecture with fractional baud rate sampling for full-duplex multi-level PAM systems
US20090323877A1 (en) * 2008-06-17 2009-12-31 Nec Electronics Corporation Data receiving apparatus and data receiving method
CN102201960A (en) * 2011-04-28 2011-09-28 华南理工大学 Baud rate adaptive method based on sequencing pulse width differential
CN107038135A (en) * 2017-03-24 2017-08-11 深圳市顺讯电子有限公司 A kind of serial port baud rate Adaptable System and method
US20170288899A1 (en) * 2016-03-29 2017-10-05 Intel IP Corporation Self-adapting baud rate
CN107368446A (en) * 2016-11-24 2017-11-21 天地融科技股份有限公司 A kind of configured transmission adaptive data transmission method and device
CN109274567A (en) * 2018-09-27 2019-01-25 潍柴动力股份有限公司 A kind of adaptive approach and system of baud rate
CN110581814A (en) * 2019-09-06 2019-12-17 惠州志顺电子实业有限公司 Baud rate adjusting method of communication equipment and communication equipment
CN110618729A (en) * 2018-06-19 2019-12-27 迈普通信技术股份有限公司 Baud rate generator, communication equipment and generation method of Baud rate clock signal
CN111211869A (en) * 2020-01-02 2020-05-29 深圳震有科技股份有限公司 Method for automatically adapting baud rate, intelligent terminal and storage medium
CN111431783A (en) * 2020-04-02 2020-07-17 希尔塔(苏州)信息技术有限公司 CAN bus baud rate self-adaption method
CN111427818A (en) * 2020-03-26 2020-07-17 重庆智慧水务有限公司 Method for identifying serial port communication baud rate and readable storage medium
CN112751738A (en) * 2020-12-29 2021-05-04 北京万集智能网联技术有限公司 Baud rate self-adaption method and device, computer equipment and readable storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060245515A1 (en) * 2005-04-28 2006-11-02 Nec Electronics Corporation Data reception apparatus and synchronizing signal detection method and program
US20060256849A1 (en) * 2005-05-12 2006-11-16 Rdc Semiconductor Co., Ltd. Adaptive blind start-up receiver architecture with fractional baud rate sampling for full-duplex multi-level PAM systems
US20090323877A1 (en) * 2008-06-17 2009-12-31 Nec Electronics Corporation Data receiving apparatus and data receiving method
CN102201960A (en) * 2011-04-28 2011-09-28 华南理工大学 Baud rate adaptive method based on sequencing pulse width differential
US20170288899A1 (en) * 2016-03-29 2017-10-05 Intel IP Corporation Self-adapting baud rate
CN107368446A (en) * 2016-11-24 2017-11-21 天地融科技股份有限公司 A kind of configured transmission adaptive data transmission method and device
CN107038135A (en) * 2017-03-24 2017-08-11 深圳市顺讯电子有限公司 A kind of serial port baud rate Adaptable System and method
CN110618729A (en) * 2018-06-19 2019-12-27 迈普通信技术股份有限公司 Baud rate generator, communication equipment and generation method of Baud rate clock signal
CN109274567A (en) * 2018-09-27 2019-01-25 潍柴动力股份有限公司 A kind of adaptive approach and system of baud rate
CN110581814A (en) * 2019-09-06 2019-12-17 惠州志顺电子实业有限公司 Baud rate adjusting method of communication equipment and communication equipment
CN111211869A (en) * 2020-01-02 2020-05-29 深圳震有科技股份有限公司 Method for automatically adapting baud rate, intelligent terminal and storage medium
CN111427818A (en) * 2020-03-26 2020-07-17 重庆智慧水务有限公司 Method for identifying serial port communication baud rate and readable storage medium
CN111431783A (en) * 2020-04-02 2020-07-17 希尔塔(苏州)信息技术有限公司 CAN bus baud rate self-adaption method
CN112751738A (en) * 2020-12-29 2021-05-04 北京万集智能网联技术有限公司 Baud rate self-adaption method and device, computer equipment and readable storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
方利缘等: "基于迭代和修正的波特率自适应算法", 《探测与控制学报》 *
方利缘等: "基于迭代和修正的波特率自适应算法", 《探测与控制学报》, no. 01, 26 February 2011 (2011-02-26) *
李森源等: "波特率自适应信号接收装置设计及其FPGA实现", 《计算机应用与软件》 *
李森源等: "波特率自适应信号接收装置设计及其FPGA实现", 《计算机应用与软件》, no. 01, 15 January 2016 (2016-01-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116155645A (en) * 2023-02-27 2023-05-23 上海中韩杜科泵业制造有限公司 CAN bus-based equipment network access method, device, equipment and medium
CN116155645B (en) * 2023-02-27 2023-09-22 上海中韩杜科泵业制造有限公司 CAN bus-based equipment network access method, device, equipment and medium

Also Published As

Publication number Publication date
CN114024795B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
EP3584658A1 (en) Method, system, device, and computer readable storage medium for diagnosing vehicle
JP2001352350A (en) Measurement system and method by statistic eye-diagram of continuous bit stream
CN112965908B (en) Communication test method, device, communication equipment and storage medium
CN111813638B (en) Alarm information processing method and device and terminal equipment
CN106257854B (en) Single-side nibble transmission error generator
CN114024795A (en) Baud rate self-adaption method and device, computer equipment and storage medium
CN112069098B (en) Baud rate identification method and device
CN108180935B (en) Fault detection method and device of sensor
CN112422369B (en) Method and device for determining offline time, storage medium and electronic device
CN109743228A (en) A kind of measuring method and system of sampling point position
CN114039807B (en) Baud rate self-adaption method, device, computer equipment and storage medium
CN111611186B (en) Transmission control method and device in embedded chip
CN111405603A (en) Time delay obtaining method, testing device and computer storage medium
CN116915367B (en) Data detection method, storage medium and electronic device
CN109688032B (en) Network transmission performance testing method and device
CN114513385B (en) Data transmission method, device, electronic equipment and storage medium
US6931057B2 (en) Method, article of manufacture and system to determine a bit rate of a signal
CN115729313A (en) Method and device for calibrating real-time clock and electronic equipment
CN114866446A (en) Data transmission rate testing method, system, electronic device and storage medium
CN109634906B (en) IC communication system and method
CN111314268B (en) Data packet analysis method and device
CN111858209A (en) Detection method, electronic device and storage medium
US9989379B2 (en) Techniques for counting resource usage
CN117714553A (en) Data transmission method, device, equipment and medium
CN115801929A (en) CAN message analysis method, device, intelligent terminal and storage medium

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