A baud rate adaptive update method based on LIN protocol

By real-time detection and update of baud rate in the LIN protocol, the frame loss problem caused by baud rate calculation lag in the prior art is solved, and the baud rate synchronization between the slave and the master device is realized, and communication interruption is avoided.

CN118677716BActive Publication Date: 2024-12-24DIOO MICROCIRCUITS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411147214.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-24
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

There is a lag in the baud rate update technology in the existing LIN protocol, which causes the slave to fail to detect the complete synchronization interval and synchronization segment, resulting in frame loss and communication interruption.

Method used

Adaptive baud rate update method based on LIN protocol is adopted to calculate and update the baud rate in real time by detecting the level changes of frame start time, synchronization interval segment, frame interval segment and synchronization segment, and ensure the waves between slave devices and master devices. Special rate synchronization.

Benefits of technology

It effectively avoids frame loss and communication interruption, realizes real-time detection of message frame headers by slave devices and baud rate update, and synchronizes the current baud rate with the master device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677716B_ABST
    Figure CN118677716B_ABST
Patent Text Reader

Abstract

The present invention discloses a baud rate adaptive updating method based on LIN protocol, confirms the frame start time, marks the low level starting from the first falling edge detected as synchronization interval segment A, judges whether the length T0 of synchronization interval segment A is greater than or equal to the synchronization interval segment threshold, if so, enters step S2, otherwise re-executes step S1, confirms the frame interval segment, judges whether the length of frame interval segment B meets the requirement, if so, enters step S3, otherwise re-executes step S1; confirms the first bit data of the synchronization segment; confirms the second bit data of the synchronization segment; confirms each bit data of the synchronization segment; calculates the baud rate length and updates the baud rate. The present invention can detect the message frame header received from the slave device in real time and update the baud rate, so as to synchronize with the current baud rate of the master device, thereby effectively avoiding the frame loss caused by the hysteresis of the baud rate calculation in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a baud rate updating method, in particular to a baud rate adaptive updating method based on a LIN protocol, belonging to the technical field of communication. Background Art

[0002] LIN is the abbreviation of Local Interconnect Network. It is a low-cost serial communication protocol based on UART / SCI (Universal Asynchronous Receiver-Transmitter / Serial Communication Interface). It can be used in many fields such as automobiles, home appliances, and office equipment. For example, the LIN bus is a message-based communication bus protocol often used in automobiles. The LIN communication frame structure of the prior art is as follows: Figure 3 shown.

[0003] The current LIN baud rate update technology starts calculating after receiving the complete synchronization interval and synchronization segment time. When the master device uses the LIN protocol to send a message frame to the slave device, it may change the transmission baud rate at any time. If the master device switches the baud rate in the middle of sending a message frame, the slave device will not be able to detect the complete synchronization interval and synchronization segment, which will cause errors in the received data. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a baud rate adaptive updating method based on LIN protocol, so as to solve the problem of frame loss caused by hysteresis of baud rate detection in existing LIN communication, thereby interrupting communication.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A baud rate adaptive updating method based on LIN protocol comprises the following steps:

[0007] S1. Confirm the frame start time; mark the low level starting from the first falling edge detected as the synchronization interval A, and determine the length T of the synchronization interval A. 0 Is it greater than or equal to the synchronization interval threshold? If so, proceed to step S2, otherwise, re-execute step S1;

[0008] S2, confirm the frame interval; the first high level mark after the synchronization interval A is the frame interval B, and determine whether the length of the frame interval B meets the requirements. If so, proceed to step S3, otherwise re-execute step S1;

[0009] S3, confirm the first bit data of the synchronization segment;

[0010] S4, confirm the second bit of data in the synchronization segment;

[0011] S5, confirm each bit of data in the synchronization segment; in steps S3-S5, when any step does not meet the data judgment condition, if the data of the current bit is a high level or a rising edge, the previous low level adjacent to the rising edge or high level is considered as the synchronization interval segment and enters step S2; if the data of the current bit is a low level, the low level is considered as the synchronization interval segment and enters step S1.

[0012] S6. Calculate the baud rate length and update the baud rate.

[0013] Furthermore, the step S1 is specifically to mark the low level starting from the first falling edge detected as the synchronization interval A, and the length of the low level of the synchronization interval A is T 0 , and the length of each bit of data in the synchronization interval is sampled by 16 times oversampling, then the threshold of the synchronization interval is 16*11, and the length T of the synchronization interval A is determined. 0 Is it greater than or equal to the synchronization interval threshold 16*11? If so, go to step S2, otherwise re-execute step S1.

[0014] Furthermore, the step S2 is specifically as follows: the high level after the synchronization interval A is marked as a frame interval B, and the high level length of the frame interval B is T 1 , determine the length T of the frame interval B 1 Is it less than 1.5 times the length T of the synchronization interval A? 0 If yes, go to step S3, otherwise re-execute step S1.

[0015] Furthermore, the step S3 is specifically that the low level after the frame interval B is marked as the first bit data C of the synchronization segment 1 , the first bit data C of the synchronization segment 1 The length is t 1 , determine the first bit data C of the 8-fold synchronization segment 1 The length t 1 Is it less than the length T of the synchronization interval A? 0 If yes, then go to step S4, otherwise the first bit data C of the synchronization segment 1 Mark it as synchronization interval A and go to step S1.

[0016] Furthermore, the step S4 is specifically as follows: the first bit data C of the synchronization segment 1 The high level after that is marked as the second bit data C of the synchronization segment 2 , the second bit data C of the synchronization segment 2 The length is t 2, determine the second bit data C of the synchronization segment 2 The length t 2 and the first bit of the synchronization segment C 1 The length t 1 Whether t is satisfied 2 >0.5*t 1 And t 2 <1.5*t 1 If it is satisfied, then go to step S5, otherwise the first bit data C of the synchronization segment 1 Mark it as synchronization interval A and go to step S2.

[0017] Furthermore, the step S5 is specifically as follows: assuming that the synchronization segment has N bits of data, for the i-th bit of data, that is, the i-th bit of data in the synchronization segment, determine the i-th bit of data C in the synchronization segment. i The length t i and the i-1th bit data C of the synchronization segment i-1 The length t i-1 Whether t is satisfied i >0.5*t i-1 And t i <1.5*t i-1 If it is satisfied, then go to step S6, otherwise determine the i-th bit data C of the synchronization segment i If the sync segment i bit data C i is low level, the i-th bit data C of the synchronization segment i Marked as synchronization interval segment A and enter step S1, if the i-th bit data C of the synchronization segment i is high, the i-1th bit data C of the synchronization segment i-1 Mark it as synchronization interval A and go to step S2.

[0018] Furthermore, the step S6 is specifically as follows: when the N-bit data of the synchronization segment are all detected and completed, the total length T2 of the synchronization segment data is calculated based on the N-bit data of the synchronization segment, then the baud rate F of the currently received frame structure is F=T2 / N, and the calculated baud rate F is updated to the baud rate of the transmitted signal to complete the baud rate update.

[0019] Compared with the prior art, the present invention has the following advantages and effects: the present invention provides a baud rate adaptive updating method based on the LIN protocol, which can detect the message frame header received by the slave device in real time and update the baud rate, thereby synchronizing with the current baud rate of the master device, thereby effectively avoiding the frame loss caused by the lag of the baud rate calculation in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The invention discloses a flow chart of a baud rate adaptive updating method based on LIN protocol.

[0021] Figure 2 It is a schematic diagram of LIN bus frame header timing processing according to an embodiment of the present invention.

[0022] Figure 3 It is a schematic diagram of the LIN communication frame structure of the prior art. DETAILED DESCRIPTION

[0023] In order to elaborate on the technical scheme adopted by the present invention to achieve the predetermined technical purpose, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments, and the technical means or technical features in the embodiments of the present invention can be replaced without paying creative work. The present invention will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0024] like Figure 1 As shown, a baud rate adaptive updating method based on LIN protocol of the present invention comprises the following steps:

[0025] S1. Confirm the frame start time; mark the low level starting from the first falling edge detected as the synchronization interval A, and determine the length T of the synchronization interval A. 0 Is it greater than or equal to the synchronization interval threshold? If so, proceed to step S2, otherwise re-execute step S1.

[0026] Step S1 specifically includes marking the low level starting from the first falling edge detected as the synchronization interval A, and the length of the low level of the synchronization interval A is T 0 , and the length of each bit of data in the synchronization interval is sampled by 16 times oversampling, then the threshold of the synchronization interval is 16*11, and the length T of the synchronization interval A is determined. 0 Is it greater than or equal to the synchronization interval threshold 16*11? If so, go to step S2, otherwise re-execute step S1.

[0027] S2, confirm the frame interval; the first high level mark after the synchronization interval A is the frame interval B, and determine whether the length of the frame interval B meets the requirements. If so, proceed to step S3, otherwise re-execute step S1.

[0028] Step S2 is specifically as follows: the high level after the synchronization interval A is marked as a frame interval B, and the high level length of the frame interval B is T 1 , determine the length T of the frame interval B 1 Is it less than 1.5 times the length T of the synchronization interval A? 0 If yes, go to step S3, otherwise re-execute step S1.

[0029] S3. Confirm the first bit of data in the synchronization segment.

[0030] Step S3 specifically includes: the low level after the frame interval B is marked as the first bit data C of the synchronization segment 1 , the first bit data C of the synchronization segment 1 The length is t 1 , determine the first bit data C of the 8-fold synchronization segment 1 The length t 1 Is it less than the length T of the synchronization interval A? 0 If yes, then go to step S4, otherwise the first bit data C of the synchronization segment 1 Mark it as synchronization interval A and go to step S1.

[0031] S4. Confirm the second bit of data in the synchronization segment.

[0032] Step S4 specifically includes: the first bit data C of the synchronization segment 1 The high level after that is marked as the second bit data C of the synchronization segment 2 , the second bit data C of the synchronization segment 2 The length is t 2 , determine the second bit data C of the synchronization segment 2 The length t 2 and the first bit of the synchronization segment C 1 The length t 1 Whether t is satisfied 2 >0.5*t 1 And t 2 <1.5*t 1 If it is satisfied, then go to step S5, otherwise the first bit data C of the synchronization segment 1 Mark it as synchronization interval A and go to step S2.

[0033] S5. Confirm each bit of data in the synchronization segment.

[0034] Specifically, step S5 is as follows: assuming that the synchronization segment has N bits of data, for the i-th bit of data, that is, the i-th bit of data in the synchronization segment, determine the i-th bit of data C in the synchronization segment. i The length t i and the i-1th bit data C of the synchronization segment i-1 The length t i-1 Whether t is satisfied i >0.5*t i-1 And t i <1.5*t i-1 If it is satisfied, then go to step S6, otherwise determine the i-th bit data C of the synchronization segment i If the sync segment i bit data C i is low level, the i-th bit data C of the synchronization segment iMarked as synchronization interval segment A and enter step S1, if the i-th bit data C of the synchronization segment i is high, the i-1th bit data C of the synchronization segment i-1 Mark it as synchronization interval A and go to step S2.

[0035] S6. Calculate the baud rate length and update the baud rate.

[0036] Step S6 is specifically, when the N-bit data of the synchronization segment are all detected, the total length T2 of the synchronization segment data is calculated according to the N-bit data of the synchronization segment, then the baud rate F of the currently received frame structure is F=T2 / N, and the calculated baud rate F is updated to the baud rate of the transmitted signal to complete the baud rate update.

[0037] The present invention provides a baud rate adaptive updating method based on LIN protocol, which can detect the message frame header received by the slave device in real time and update the baud rate, so as to synchronize with the current baud rate of the master device, thereby effectively avoiding the frame loss caused by the lag of baud rate calculation in the prior art.

[0038] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent replacement and improvement made to the above embodiments without departing from the content of the technical solution of the present invention, based on the technical essence of the present invention, within the spirit and principles of the present invention, still fall within the protection scope of the technical solution of the present invention.

Claims

1. A baud rate adaptive update method based on LIN protocol, characterized in that The following steps are involved: S1, confirm the frame start time; mark the low level starting from the first falling edge detected as the synchronization interval A, and determine whether the length T0 of the synchronization interval A is greater than or equal to the synchronization interval threshold. If so, proceed to step S2, otherwise re-execute step S1; Specifically, the step S1 is to mark the low level starting from the first falling edge detected as the synchronization interval A, the length of the low level of the synchronization interval A is T0, and the length of each bit of data in the synchronization interval is sampled by 16 times oversampling, then the synchronization interval threshold is 16*11, and determine whether the length T0 of the synchronization interval A is greater than or equal to the synchronization interval threshold 16*11, if so, proceed to step S2, otherwise re-execute step S1; S2, confirm the frame interval; the first high level mark after the synchronization interval A is the frame interval B, and determine whether the length of the frame interval B meets the requirements. If so, proceed to step S3, otherwise re-execute step S1; Specifically, step S2 is as follows: the high level after the synchronization interval A is marked as a frame interval B, the high level length of the frame interval B is T1, and it is determined whether the length T1 of the frame interval B is less than 1.5 times the length T0 of the synchronization interval A. If so, step S3 is entered, otherwise step S1 is re-executed; S3, confirm the first bit data of the synchronization segment; Specifically, the step S3 is as follows: the low level after the frame interval B is marked as the first bit data C1 of the synchronization segment, the length of the first bit data C1 of the synchronization segment is t1, and it is determined whether the length t1 of the first bit data C1 of the synchronization segment, which is 8 times, is less than the length T0 of the synchronization interval segment A. If so, the step S4 is entered; otherwise, the first bit data C1 of the synchronization segment is marked as the synchronization interval segment A and the step S1 is entered; S4, confirm the second bit of data in the synchronization segment; Specifically, the step S4 is as follows: the high level after the first bit data C1 of the synchronization segment is marked as the second bit data C2 of the synchronization segment, the length of the second bit data C2 of the synchronization segment is t2, and it is determined whether the length t2 of the second bit data C2 of the synchronization segment and the length t1 of the first bit data C1 of the synchronization segment satisfy t2>0.5*t1 and t2<1.5*t1. If so, the step S5 is entered; otherwise, the first bit data C1 of the synchronization segment is marked as the synchronization interval segment A and the step S2 is entered; S5, confirm each bit of data in the synchronization segment; Specifically, step S5 is as follows: assuming that the synchronization segment has N bits of data, for the i-th bit of data, that is, the i-th bit of data in the synchronization segment, determine the i-th bit of data C in the synchronization segment. i The length t i and the i-1th bit data C of the synchronization segment i-1 The length t i-1 Whether t is satisfied i >0.5*t i-1 And t i <1.5*t i-1 If it is satisfied, then go to step S6, otherwise determine the i-th bit data C of the synchronization segment i If the sync segment i bit data C i is low level, the i-th bit data C of the synchronization segment i Marked as synchronization interval segment A and enter step S1, if the i-th bit data C of the synchronization segment i is high, the i-1th bit data C of the synchronization segment i-1 Mark as synchronization interval A and go to step S2; S6, calculate the baud rate length and update the baud rate; Specifically, step S6 is as follows: when the N-bit data of the synchronization segment are all detected and completed, the total length T2 of the synchronization segment data is calculated based on the N-bit data of the synchronization segment, then the baud rate F of the currently received frame structure is equal to T2 / N, and the calculated baud rate F is updated to the baud rate of the transmitted signal to complete the baud rate update.