Baud rate detection method and device based on LIN bus
By using a shift register to calculate the baud rate in real time in LIN bus communication, the data loss problem caused by the baud rate detection lag in the existing technology is solved, and the reliability of communication is improved.
Patent Information
- Application Number
- CN202311199209.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-09-18
AI Technical Summary
In the existing technology, there is hysteresis in baud rate detection in LIN bus communication, which can easily lead to data loss.
A shift register is used to store the levels of the sync interval field and the sync field, and the baud rate is calculated in real time through shift control. It is judged in real time whether the baud rate size and level length meet the preset conditions, and the baud rate register is updated.
It improves the real-time performance of baud rate detection, reduces data frame loss, and enhances the reliability of communication.
Smart Images

Figure CN117201366B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of baud rate detection, and in particular to a baud rate detection method and device based on a LIN bus. Background Art
[0002] In the prior art, automatic baud rate detection is required in LIN bus communication. "Baud rate" is a unit used to describe the communication speed. In communication, only when the baud rates of both communicating parties are the same can the normal communication be ensured. To achieve a complete receiving and sending process of a LIN data frame, the following steps are required: first, the receiving controller completes the detection of the synchronization interval field according to the preset baud rate, and then performs automatic baud rate detection of the synchronization field, and detects and calculates the temporary baud rate, completes the detection of the identifier field based on the temporary baud rate, and detects whether the data of the identifier field is abnormal. If there is an abnormality, the temporary baud rate is discarded and re-detected.
[0003] In the above process, after the automatic baud rate detection of the synchronization field is completed, the communication baud rate will be immediately overwritten and updated. Its detection needs to be completed after the detection of the identifier field to determine whether the correct synchronization frame is detected. This judgment method will have a lag, which is easy to cause the loss of synchronization frames and data loss. Summary of the invention
[0004] One of the purposes of the present invention is to provide a baud rate detection method based on LIN bus to solve the technical problem that the baud rate detection in LIN bus communication in the prior art has hysteresis and easily causes data loss.
[0005] One of the purposes of the present invention is to provide a baud rate detection device based on LIN bus.
[0006] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides a baud rate detection method based on a LIN bus, the method comprising: obtaining a LIN data frame; receiving a synchronization interval field and a pulse of a synchronization field of the LIN data frame; storing the level of the synchronization interval field in the LIN data frame and each level in the synchronization field in a preset number of shift buffers respectively; controlling each level to continuously shift in a preset direction so that the synchronization interval field and the level of the synchronization field of each LIN data frame are stored in each shift buffer in sequence; obtaining the level length stored in the shift buffer based on each shift and calculating the baud rate; when the baud rate meets a first preset condition and the level length of the shift buffer representing the synchronization interval field meets a second preset condition, updating the baud rate to a baud rate register.
[0007] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides a baud rate detection device based on a LIN bus, the device comprising: a LIN data receiver, used to receive a LIN data frame; a plurality of shift buffers, used to store the level of the synchronization interval field in the LIN data frame and each level in the synchronization field; a shift control module, used to control each level in the plurality of shift buffers to continuously shift in a preset direction so that the synchronization interval field and the level of the synchronization field of each LIN data frame are stored in each shift buffer in sequence; a window operation module, used to calculate the level length in each shift buffer at each shift and obtain the baud rate according to the calculation; and also used to determine whether the size of the baud rate and the level length of the shift buffer representing the synchronization interval field meet preset conditions, and if the preset conditions are met, update the baud rate to the baud rate register; a baud rate register, used to store the baud rate.
[0008] Compared with the prior art, the present invention has the following beneficial effects: a shift buffer is used to cache the level length of the synchronization interval field and the length of each level in the synchronization field, and the level of the synchronization interval field and each level in the synchronization field can be serially transmitted through the shift buffer in real time through a shift control method, and the baud rate can be calculated in real time. At the same time, the baud rate and whether the level length of the shift buffer representing the synchronization interval field meets the preset conditions can be judged in real time, thereby improving the real-time performance of automatic baud rate detection and reducing data frame loss caused by frequency switching. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is a flow chart of a baud rate detection method based on LIN bus in one embodiment of the present invention.
[0010] Figure 2 4 is a pulse waveform diagram of a synchronization field in one embodiment of the present invention.
[0011] Figure 3 It is a structural schematic diagram of a baud rate detection device based on a LIN bus in one embodiment of the present invention. DETAILED DESCRIPTION
[0012] The present invention will be described in detail below in conjunction with the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on these embodiments are all within the scope of protection of the present invention.
[0013] In one embodiment of the present invention, a baud rate detection method based on a LIN bus is provided. The method uses a serial data shift method to receive a level in real time, and calculates the level length stored in a buffer in real time to obtain the baud rate in real time. This method can solve the problem of baud rate hysteresis in the prior art and improve efficiency.
[0014] Please refer to Figure 1 As shown, the baud rate detection method based on the LIN bus specifically includes:
[0015] S1: Get LIN data frame.
[0016] S2: Receive the synchronization interval field and the synchronization field pulse of the LIN data frame.
[0017] S3: storing the level of the synchronization interval field and each level in the synchronization field in the LIN data frame in a preset number of shift buffers 2 respectively.
[0018] S4: Control each level to continuously shift in a preset direction so that the levels of the synchronization interval field and the synchronization field of each LIN data frame are stored in each shift buffer 2 in sequence.
[0019] S5: Based on each shift, the level length stored in the shift register 2 is obtained and the baud rate is calculated.
[0020] S6: When the baud rate meets the first preset condition and the level length of the shift buffer 2 representing the synchronization interval field meets the second preset condition, updating the baud rate into the baud rate register.
[0021] In this way, by setting the shift buffer 2, the shift operation can be performed synchronously after the LIN data frame is obtained, and the baud rate is obtained based on each shift synchronization calculation, and the baud rate in the LIN data frame is compared according to the preset conditions to determine whether the baud rate and the synchronization interval field meet the preset conditions. Therefore, it is possible to determine whether the data frame is a synchronization frame in the early stage of data serial communication, thereby improving the efficiency of data communication, solving the problem of data frame loss caused by baud rate lag, and greatly enhancing the reliability of communication.
[0022] Among them, the number of shift buffers 2 can be pre-set and can be set based on the level of the synchronization interval field in the LIN data frame and the number of levels in the synchronization field to ensure that when the first frame of LIN data frame passes through the shift buffer 2 serially, the level of the synchronization interval field and the level in the synchronization field inside it can be saved in the shift buffer 2 without leaving any redundant buffers.
[0023] Moreover, "controlling each level to continuously shift in a preset direction" can be understood as: the level of the synchronization interval field of the LIN data frame and the level in the synchronization field are shifted in sequence in the preset direction according to a specific frequency. Specifically, a left shift can be set, that is, the level of the synchronization interval field and the level in the synchronization field are shifted in sequence from right to left through the shift buffer 2, and when the data of the first frame is fully stored in the shift buffer 2, it can still be shifted to the left according to the preset frequency, so that the first level is shifted out of the shift buffer 2, and the first level of the second frame data enters the shift buffer 2 from the right, and so on, circulating through the shift buffer 2 and calculating the shift buffer 2 at each shift, thereby realizing real-time calculation.
[0024] "Updating the baud rate to the baud rate register" can be understood as: saving the baud rate of the relevant device communicating with it to facilitate the next connection, thereby creating convenience for subsequent connections.
[0025] In one embodiment of the present invention, the “controlling each level to continuously shift in a preset direction” includes:
[0026] Preset falling edge trigger command;
[0027] When a falling edge pulse of a LIN data frame is detected, a shift signal is sent, wherein the shift signal is used to indicate that the level in the shift buffer 2 is shifted once in a preset direction.
[0028] In this way, based on the preset falling edge trigger command and the serial communication method of the LIN data frame, the system can automatically shift left based on the falling edge when receiving the next frame of data. At the same time, the left shift can also free up the shift buffer 2 for the level of the next frame of data, thereby ensuring the reliability of the system's automatic operation.
[0029] Among them, the preset direction can be selected to shift left, that is, the level of the synchronization interval field and the level within the synchronization field are shifted in sequence from right to left through the shift buffer 2, and when the data of the first frame is fully stored in the shift buffer 2, it can still be shifted left according to the preset frequency, so that the first level is shifted out of the shift buffer 2, and the first level of the second frame data enters the shift buffer 2 from the right, and the cycle passes through the shift buffer 2 and the shift buffer 2 is calculated at each shift, thereby realizing real-time calculation.
[0030] In one embodiment of the present invention, “obtaining the level length stored in the shift register 2” includes:
[0031] Each shift buffer 2 is marked with characteristics, and the marked shift buffer 2 includes a first type buffer for characterizing the synchronization field.
[0032] The high and low levels stored in the first type shift buffer 2 are obtained based on each shift.
[0033] Get binary data based on high and low levels and convert it into hexadecimal.
[0034] Determine whether the hexadecimal data is a preset number. If it is a preset number, calculate the baud rate according to the level length.
[0035] Based on the above scheme, the high and low levels in the first type of buffer representing the synchronization field are obtained and formed into binary data, which is then converted into hexadecimal data. The hexadecimal data can be compared with the hexadecimal data of the synchronization field in the standard LIN data frame. Therefore, according to the comparison result, it can be determined whether the positions of the high and low levels in the obtained first type of buffer are correct, that is, whether the obtained level data is standard, thereby determining whether the data frame is valid. The baud rate is calculated based on the valid frame, which can further ensure the reliability of the data.
[0036] Usually, the hexadecimal data of the synchronization field in the standard LIN data frame is 0x55, as shown in the following figure. Figure 2 As shown, converted into binary, it is 1010101. If the high and low levels in the first type buffer obtained are 1010101, it means that the synchronization field level position is correct.
[0037] The characteristic mark is to mark the attribute of each shift buffer 2 based on the corresponding relationship between the position sequence of each shift buffer 2 and the position sequence of the synchronization interval field and the synchronization field in the LIN data frame. For example, when the levels of the synchronization interval field and the synchronization field in a frame of LIN data frame are completely stored in the shift buffer 2, if the first shift buffer 2 corresponds to the synchronization interval field level, the characteristic mark of the first shift buffer 2 is a buffer that characterizes the synchronization interval field level. By analogy, the subsequent shift buffers 2 can also be marked as buffers that characterize the synchronization field level; since the synchronization field level has multiple high and low levels, it can correspond to multiple shift buffers 2 respectively and each buffer can also be distinguished by a number.
[0038] In one embodiment of the present invention, the specific steps of calculating the baud rate include:
[0039] The level length is calculated based on the acquired level of the first-type shift buffer 2.
[0040] The baud rate is calculated according to the number of the first-type shift buffers 2 .
[0041] The baud rate calculation formula is:
[0042]
[0043] In this way, by calculating the baud rate, it is possible to detect whether the acquired data frame is a synchronization frame, and communication can be carried out based on the determination that it is a synchronization frame. In this embodiment, the synchronization field level is acquired in real time during the shift control through the shift buffer 2, and the baud rate can be calculated in real time when the synchronization field pulse is acquired, which effectively avoids the lag of using a temporary baud rate in the prior art, thereby avoiding data loss in subsequent communications and enhancing the robustness of the system.
[0044] In one embodiment of the present invention, “obtaining the level length stored in the shift register 2” further includes calculating the level length stored in the shift register 2 representing the synchronization interval field level, and the specific steps include:
[0045] Each shift buffer 2 is marked with characteristics, and the marked shift buffer 2 includes a second type buffer for characterizing the synchronization interval field.
[0046] The level of the second type buffer is obtained based on each shift.
[0047] The length of the level in the second-type buffer is calculated.
[0048] By calculating the level length stored in the second type buffer and comparing it with the level length in the first type shift buffer 2, it is possible to determine whether the level in the first type shift buffer 2 representing the synchronization interval field meets the requirements, and indirectly confirm whether the level in the first type shift buffer 2 is the level of the synchronization interval field; based on this, the level in the first type shift buffer 2 is judged, and it can be detected at each shift whether the level in the shift buffer 2 meets the synchronization frame to determine whether communication can be carried out, thereby avoiding data loss due to communication asynchrony in the later stage, and also enhancing the stability of communication and improving the effectiveness of communication.
[0049] The characteristic mark is to mark the attribute of each shift buffer 2 based on the corresponding relationship between the position sequence of each shift buffer 2 and the position sequence of the synchronization interval field and the synchronization field in the LIN data frame. For example, when the levels of the synchronization interval field and the synchronization field in a frame of LIN data frame are completely stored in the shift buffer 2, if the first shift buffer 2 corresponds to the synchronization interval field level, the characteristic mark of the first shift buffer 2 is a buffer that characterizes the synchronization interval field level. By analogy, the subsequent shift buffers 2 can also be marked as buffers that characterize the synchronization field level; since the synchronization field level has multiple high and low levels, it can correspond to multiple shift buffers 2 respectively and each buffer can also be distinguished by a number.
[0050] In one implementation manner of the present invention, the first preset condition for the baud rate is: first preset value < baud rate < second preset value.
[0051] The second preset condition for characterizing the level length of the shift register 2 of the synchronization interval field is: the length of the level in the second type of register>the sum of the lengths of the levels in the first type of shift register 2.
[0052] In one implementation, the first preset value may be set to 1k, and the second preset value may be set to 20k.
[0053] In one implementation manner, the second preset condition characterizing the level length of the shift buffer 2 of the synchronization interval field may also be set as the length of the level in the second type buffer>13 bits.
[0054] In a preferred embodiment, the second preset condition for the level length of the shift buffer 2 characterizing the synchronization interval field can be set to that the length of the level in the second type buffer is greater than 13 bits and the length of the level in the second type buffer is greater than the sum of the lengths of the levels in the first type shift buffer 2.
[0055] In one embodiment of the present invention, “obtaining the level stored in the shift register 2 based on each displacement” also includes determining the validity of the level, and the specific steps include:
[0056] Marking each shift buffer 2 with characteristics, wherein the marked shift buffer 2 includes a first type buffer for characterizing a synchronization field;
[0057] respectively calculating the length of the high level and the length of the low level in the first type buffer;
[0058] The low level length is compared with the lengths of two adjacent high levels to determine whether a third preset condition is met. If so, it is determined to be valid data.
[0059] Judging the validity of the level can effectively filter out data noise, ensure the stable transmission of valid data, reduce the distortion rate during communication, make communication reliable and stable, and enhance the robustness of the system.
[0060] In one embodiment of the present invention, the third preset condition for comparing the length of the low level with the lengths of two adjacent high levels is: (length of the first adjacent high level) / 2<length of the low level<2*(length of the second adjacent high level).
[0061] Refer to Figure 3 As shown, in one embodiment of the present invention, a baud rate detection device based on a LIN bus is provided. The device includes a LIN data receiver 1 for receiving a LIN data frame.
[0062] A plurality of shift buffers 2 are used to store the level length of the synchronization interval field in the LIN data frame and the length of each level in the synchronization field.
[0063] The shift control module 3 is used to control each level in the plurality of shift registers 2 to continuously shift in a preset direction so that the levels of the synchronization interval field and the synchronization field of each LIN data frame are stored in each shift register 2 in sequence.
[0064] The window operation module 4 is used to calculate the level length in each shift buffer 2 at each shift and obtain the baud rate based on the calculation; it is also used to determine whether the size of the baud rate meets the first preset condition and whether the level length of the shift buffer 2 representing the synchronization interval field meets the second preset condition, and if both are satisfied, the baud rate is updated to the baud rate register.
[0065] Baud rate register 5 is used to store the baud rate.
[0066] Among them, the LIN data receiver 1 is connected to multiple shift buffers 2, and the level of the synchronization interval field and each level in the synchronization field in the received LIN data frame are stored in the multiple shift buffers 2 respectively. The shift control module 3 is used to control the shift operation of the multiple shift buffers 2. The window operation module 4 is respectively connected to the shift control module 3 and the shift buffer 2. The level length in the shift buffer 2 can be calculated during each shift operation of the shift control module 3. The window operation module 4 is connected to the baud rate register 5, and the final baud rate can be stored in the baud rate register 5 so that the baud rate in the baud rate register 5 can be called when communicating with the same device next time.
[0067] In one embodiment of the present invention, the shift control module 3 is configured as: a preset falling edge trigger command; when a falling edge pulse of a LIN data frame is detected, a shift signal is sent, and the shift buffer 2 receives the shift signal to control the level in the shift buffer 2 to shift once in a preset direction.
[0068] In one embodiment of the present invention, each shift buffer 2 is further included in characteristic marking, and the marked shift buffer 2 includes a first type of buffer for characterizing the synchronization field. The window operation module 4 is configured as follows: based on each displacement, the high and low levels stored in the first type of shift buffer 2 are obtained; according to the high and low levels, binary data is obtained and converted into hexadecimal; it is determined whether the hexadecimal data is a preset base number, and if it is a preset base number, the baud rate is calculated according to the level length.
[0069] In the window operation module 4, the specific steps of configuring and calculating the baud rate are:
[0070] Calculating a level length based on the acquired level of the first type shift buffer 2;
[0071] Calculating the baud rate according to the number of the first type shift buffers 2;
[0072] The baud rate calculation formula is:
[0073]
[0074] In one embodiment of the present invention, in the window operation module 4, the preset condition for configuring the baud rate is: first preset value < baud rate < second preset value.
[0075] In one embodiment of the present invention, each shift buffer 2 is further included in characteristic marking, and the marked shift buffer 2 includes a second type buffer for characterizing the synchronization interval field, and the window operation module 4 is also configured to: obtain the level of the second type buffer based on each displacement; calculate the length of the level in the second type buffer.
[0076] In one embodiment of the present invention, in the window operation module 4, the preset condition for configuring the level length of the shift register 2 representing the synchronization interval field is: the length of the level in the second type of register> the sum of the level lengths in the first type of shift register 2.
[0077] In one embodiment of the present invention, each shift buffer 2 is marked with characteristics, and the marked shift buffer 2 includes a first type of buffer for characterizing the synchronization field. The window operation module 4 is also configured to: respectively calculate the length of the high level and the length of the low level in the first type of buffer; compare the length of the low level with the length of two adjacent high levels and determine whether the third preset condition is met. If so, it is determined to be valid data.
[0078] The third preset condition for comparing the length of the low level with the lengths of two adjacent high levels is: (length of the first adjacent high level) / 2<length of the low level<2*(length of the second adjacent high level).
[0079] In summary, the present invention mainly sets a plurality of shift buffers 2 for caching the synchronization interval field and the pulse level of the synchronization field of the LIN data frame, and configures a shift control method. When the LIN data frame is serially received, the synchronization interval field and the pulse level of the synchronization field are simultaneously controlled to shift in the shift buffer 2, so that the synchronization interval field and the pulse level of the synchronization field are cached while being serially transmitted, and the level length in the shift buffer 2 is calculated in real time, and the level length in the buffer representing the synchronization interval field and the baud rate in the buffer representing the synchronization field are calculated. Whether the received LIN data frame is a synchronization frame is determined by comparing the baud rate and the length of the level in the buffer representing the synchronization interval field, and data is received when it is determined to be based on the synchronization frame.
[0080] In this way, when receiving a serially transmitted LIN data frame, it is possible to determine in real time whether the LIN data frame is a synchronous frame, thereby quickly determining the validity of the data, thereby deciding whether the data needs to be received. This solves the hysteresis problem in the baud rate detection method in the prior art, avoids the loss of later data, strengthens the robustness of the system, and enhances the reliability of communication.
[0081] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0082] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and modules can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.
[0083] In several embodiments provided in the present application, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system implementation described above is only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, systems or modules, which can be electrical, mechanical or other forms. The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present implementation scheme.
[0084] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of hardware plus software functional modules. The above-mentioned integrated module implemented in the form of software functional modules can be stored in a computer-readable storage medium. The above-mentioned software functional modules are stored in a storage medium, including a number of instructions for a computer system (which can be a personal computer, a server, or a network system, etc.) or a processor (processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0085] Finally, it should be noted that the above implementation modes are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned implementation modes, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned implementation modes, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various implementation modes of the present application.
Claims
1. A baud rate detection method based on LIN bus, It is characterized in that include: Get LIN data frame; Receiving the pulses of the synchronization interval field and the synchronization field of the LIN data frame; The level of the synchronization interval field in the LIN data frame and each level in the synchronization field are stored in a preset number of shift buffers, and each shift buffer is marked with characteristics, wherein the marked shift buffers include a first type of buffer for characterizing the synchronization field and a second type of buffer for characterizing the synchronization interval field; Controlling each level to continuously shift in a preset direction so that the levels of the synchronization interval field and the synchronization field of each LIN data frame are sequentially stored in each shift buffer; Based on each displacement, the level length stored in the shift buffer is obtained and the baud rate is calculated; When the baud rate meets the first preset condition and the level length of the shift buffer representing the synchronization interval field meets the second preset condition, updating the baud rate to the baud rate register; The first preset condition for the baud rate is: first preset value < baud rate < second preset value; the second preset condition for the level length of the shift buffer representing the synchronization interval field is: the length of the level in the second type of buffer > the sum of the level lengths in the first type of shift buffer.
2. The baud rate detection method based on LIN bus according to claim 1, wherein the "controlling each level to continuously shift in a preset direction" include: Preset falling edge trigger command; When a falling edge pulse of a LIN data frame is detected, a shift signal is sent, wherein the shift signal is used to indicate that the level in the shift buffer is shifted once in a preset direction.
3. The baud rate detection method based on the LIN bus according to claim 1, wherein "obtaining the level length stored in the shift buffer and calculating the baud rate" include: Based on each displacement, high and low levels stored in the first type shift buffer are obtained; Get binary data according to high and low levels and convert it into hexadecimal; Determine whether the hexadecimal data is a preset number. If it is a preset number, calculate the baud rate according to the level length.
4. The baud rate detection method based on LIN bus according to claim 3, wherein the specific steps of calculating the baud rate are include: Calculating a level length based on the acquired level of the first type of shift buffer; Calculating a baud rate according to the number of the first type of shift registers; The baud rate calculation formula is:
5. The baud rate detection method based on LIN bus according to claim 3, wherein "obtaining the level length stored in the shift register" further comprises calculating the level length stored in the shift register representing the synchronization interval field level, and the specific steps are: include: Acquire the level of the second type buffer based on each displacement; The length of the level in the second-type buffer is calculated.
6. The baud rate detection method based on LIN bus according to claim 1, wherein "obtaining the level length stored in the shift buffer based on each displacement" also includes judging the validity of the level, the specific steps are include: respectively calculating the length of the high level and the length of the low level in the first type buffer; The low level length is compared with the lengths of two adjacent high levels to determine whether a third preset condition is met. If so, it is determined to be valid data.
7. The baud rate detection method based on LIN bus according to claim 6, in, The third preset condition for comparing the length of the low level with the lengths of two adjacent high levels is: (length of the first adjacent high level) / 2<length of the low level<2*(length of the second adjacent high level).
8. A baud rate detection device based on LIN bus, It is characterized in that include: LIN data receiver, used for receiving LIN data frames; A plurality of shift buffers, including a first type of buffer and a second type of buffer, wherein the second type of buffer is used to store the level of the synchronization interval field in the LIN data frame, and the first type of buffer is used to store each level in the synchronization field in the LIN data frame; A shift control module, which is used to control each level in a plurality of shift buffers to continuously shift in a preset direction so that the levels of the synchronization interval field and the synchronization field of each LIN data frame are sequentially stored in each shift buffer; A window operation module, which is used to calculate the level length in each shift buffer at each shift and obtain the baud rate according to the calculation; it is also used to determine whether the baud rate meets the first preset condition and whether the level length of the shift buffer representing the synchronization interval field meets the second preset condition, and if both are satisfied, the baud rate is updated to the baud rate register, wherein the first preset condition of the baud rate is: the first preset value < baud rate < the second preset value; the second preset condition of the level length of the shift buffer representing the synchronization interval field is: the length of the level in the second type of buffer > the sum of the level lengths in the first type of shift buffer; Baud rate register, used to store the baud rate.
9. The baud rate detection device based on the LIN bus according to claim 8, wherein the window operation module is further configured to respectively calculate the length of the high level and the length of the low level in the shift buffer representing the synchronization field, compare the length of the low level with the lengths of two adjacent high levels, and determine whether a third preset condition is met, and if so, determine it as valid data.
10. The baud rate detection device based on the LIN bus according to claim 9, wherein the third preset condition for the window operation module to determine the valid data is: (length of the first adjacent high level) / 2<length of the low level<2*(length of the second adjacent high level).
Citation Information
Patent Citations
LIN protocol Baud rate detection device and chip equipment
CN115834304A
