Baud rate detection method, system, controller and electrical equipment

By monitoring the voltage fluctuation and actual pulse width time of the communication signal, the baud rate matching situation is detected in real time, which solves the problems of complexity and lack of real-time performance in baud rate detection in the existing technology, and improves the operational reliability of the controller.

CN115834441BActive Publication Date: 2024-08-27GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211575105.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2024-08-27
Estimated Expiration
2042-12-08

AI Technical Summary

Technical Problem

The baud rate detection method in the existing technology has complex logic and cannot detect the controller's own baud rate in real time, resulting in poor communication signal stability and increasing the difficulty of fault repair.

Method used

By monitoring the voltage fluctuation of the communication signal, recording the actual pulse width time, determining the verification pulse width time, and judging whether the reciprocal matches the target baud rate, if not, the communication signal is determined to be abnormal, achieving real-time detection.

Benefits of technology

It simplifies the data processing volume, realizes baud rate detection without external equipment, detects communication faults in time, and improves the reliability of the controller operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834441B
    Figure CN115834441B
Patent Text Reader

Abstract

The present invention discloses a baud rate detection method, system, controller and electrical equipment. The baud rate detection method includes: monitoring voltage fluctuations caused by communication signals; recording the actual pulse width time after each voltage rise and change; analyzing multiple actual pulse width times and determining the verification pulse width time; judging whether the reciprocal of the verification pulse width time matches the target baud rate of the communication signal; if so, judging that the communication signal is normal; if not, judging that the communication signal is abnormal. The detection process of the present invention has a small amount of data processing and is easy to implement. It does not require the aid of external devices. When the controller starts communication or is in operation, its own baud rate can be detected in real time, so as to timely discover abnormal conditions of the communication signal and ensure the reliability of the operation of the electrical equipment where the controller is located.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of baud rate, and in particular to a baud rate detection method, system, controller and electric equipment. Background Art

[0002] CAN communication, 485 communication, etc. are all serial data buses with strong real-time performance, good flexibility and high standardization, and are widely used in automotive electronics, condensing units, medical equipment and other fields. The working principle of the serial data bus is to receive and send data from the communication chip through the specific pins of the main control chip to complete the information exchange. The baud rate is a very important parameter to measure the communication performance. The baud rate indicates the number of code symbols transmitted per unit time, which is a measure of the code symbol transmission rate.

[0003] During use, even if the communication is successful, there is no guarantee that the actual baud rate is consistent with the set baud rate. If they are inconsistent, the stability of the communication signal is poor and erroneous data is easy to be transmitted, which not only seriously affects the normal operation of the equipment, but also the erroneous data will increase the difficulty of fault repair. Therefore, it is extremely important to detect whether the actual baud rate is consistent with the set baud rate.

[0004] In the prior art, a baud rate identification method has been proposed, which determines the bus baud rate through a timer, calculates the number of code elements according to the bus baud rate, and determines the relative error between the number of the minimum code element time occupied by the first level pulse width and the reference value; when the absolute value of the relative error is less than or equal to the first threshold, the first data stream of a frame of data is determined according to the number of the minimum code element time occupied by the first level pulse width; the first data stream is processed according to the polynomial generator to determine the first calculated value; when the first calculated value is the same as the check value of the first data stream, the first bus baud rate is determined to be the correct baud rate. This identification method has complex logic, large data volume and large calculation amount, and requires external equipment for measurement and inspection. The controller itself cannot detect its own baud rate, and communication or data transmission failures cannot be discovered in time. Summary of the invention

[0005] In order to solve the defects of the prior art that the logic design is complex and cannot be used for the controller to detect its own baud rate, the present invention proposes a baud rate detection method, system, controller and electrical equipment. The baud rate detection method determines the verification pulse width time by monitoring the communication signal, and compares the inverse of the verification pulse width time with the target baud rate of the communication signal to timely discover abnormal conditions of the communication signal. The detection process has a small amount of data processing and is easy to implement without the aid of external equipment.

[0006] The technical solution adopted by the present invention is to design a baud rate detection method, comprising:

[0007] Monitor voltage fluctuations caused by communication signals;

[0008] Record the actual pulse width time after each voltage rise;

[0009] Analyze multiple actual pulse width times and determine the verification pulse width time;

[0010] Determine whether the inverse of the check pulse width time matches the target baud rate of the communication signal;

[0011] If yes, it is determined that the communication signal is normal;

[0012] If not, it is determined that the communication signal is abnormal.

[0013] Further, the check pulse width time is a single code element pulse width time, and determining whether the reciprocal of the check pulse width time matches the target baud rate includes: if the target baud rate is an integer multiple of the reciprocal of the check pulse width time, then it matches; if the target baud rate is not an integer multiple of the reciprocal of the check pulse width time, then it does not match.

[0014] Analyzing multiple actual pulse width times and determining the verification pulse width time also includes:

[0015] After the verification pulse width time is determined, the actual pulse width time is screened. If the actual pulse width time is a multiple of the verification pulse width time, it is a valid pulse width time. If the actual pulse width time is not a multiple of the single code element pulse width time, it is an invalid pulse width time.

[0016] Count the actual number of invalid pulse width times. When the actual number exceeds the set upper limit, the communication signal is determined to be abnormal.

[0017] Further, analyzing a plurality of actual pulse width times and determining the verification pulse width time includes:

[0018] Determining whether a common divisor that divides at least two actual pulse width times can be found;

[0019] If not, it is determined that the communication signal is abnormal;

[0020] If so, first determine the check pulse width time, and then determine whether the reciprocal of the check pulse width time matches the target baud rate of the communication signal.

[0021] Furthermore, the verification pulse width time is determined in the following manner: finding a common divisor that divides the largest number of actual pulse width times, and using the common divisor as the single symbol pulse width time.

[0022] In some embodiments, when the controller under test starts communication, each communication signal is monitored in turn. If all communication signals are judged to be normal, the controller under test starts running. If any communication signal is judged to be abnormal, the controller under test stops running and sends out an alarm signal.

[0023] The present invention also proposes a baud rate detection system, comprising:

[0024] Communication module;

[0025] A main control chip, the main control chip having a timer, a detection pin of the timer receiving a communication signal between the main control chip and the communication module;

[0026] The main control chip captures the voltage fluctuation caused by the communication signal through the timer, records the actual pulse width time after each voltage rise and change, analyzes multiple actual pulse width times and determines the verification pulse width time, and determines whether the communication signal is abnormal based on the inverse of the verification pulse width time and the target baud rate of the communication signal.

[0027] Further, the baud rate detection system also includes:

[0028] A switch circuit, which is used to switch between the detection pin of the timer and any communication line of the communication module;

[0029] The main control chip sends a selection signal to the switch circuit to control the corresponding communication signal to be input to the detection pin of the timer.

[0030] In some embodiments, the communication module includes: a 485 communication circuit and / or a CAN communication circuit.

[0031] The present invention also provides a controller, which uses the above baud rate detection method to determine whether its own communication signal is abnormal.

[0032] The present invention also provides a controller, which has the above-mentioned baud rate detection system.

[0033] The present invention also provides an electrical device, comprising the above-mentioned controller.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] 1. Monitor the communication signal and determine the verification pulse width time, judge whether the reciprocal of the verification pulse width matches the target baud rate of the communication signal, and determine whether the communication signal is normal based on the judgment result. The detection process has a small amount of data processing and is easy to implement without the help of external equipment;

[0036] 2. Determine whether the communication signal is abnormal by finding the verification pulse width time, screening the invalid pulse width time, etc., and discover the communication failure in time;

[0037] 3. The controller has a baud rate detection system, which detects its own baud rate when the controller starts communication to ensure that the normal process of the program function can be started only after the communication signal is normal, thereby improving the reliability of the operation of the electrical equipment where the controller is located. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The present invention is described in detail below with reference to the embodiments and accompanying drawings, wherein:

[0039] Figure 1 It is a flow chart of the baud rate detection method of the present invention;

[0040] Figure 2 It is a hardware connection block diagram of the baud rate detection system of the present invention. DETAILED DESCRIPTION

[0041] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0042] At present, the baud rate detection scheme has a large amount of data processing, and is usually measured and tested by external devices when the controller is developed. The controller itself cannot detect its own baud rate, and the problem cannot be discovered in the first time when communication or data transmission fails, and the reliability of the operation of the electrical equipment where the controller is located is poor. In view of the defects of the prior art, the present invention proposes a baud rate detection method, which is suitable for controllers of serial communication, and serial communication includes but is not limited to CAN communication and 485 communication. The detection method determines the verification pulse width time by monitoring the voltage fluctuation caused by the communication signal, and compares the inverse of the verification pulse width time with the target baud rate of the communication signal to timely discover the abnormal situation of the communication signal. The detection process has a small amount of data processing and is easy to implement. It does not require the help of external devices. When the controller starts communication or is running, its own baud rate can be detected in real time to timely discover the abnormal situation of the communication signal, thereby ensuring the reliability of the operation of the electrical equipment where the controller is located.

[0043] like Figure 1 As shown, specifically, the baud rate detection method includes the following steps:

[0044] Step S1, monitoring voltage fluctuation caused by communication signals;

[0045] During the controller power-on phase, communication is started after the program is initialized, that is, there is a communication signal sent and received between the controller's main control chip and the communication module. One of the communication signals is selected and input into the timer detection pin of the main control chip, and the voltage fluctuation caused by the communication signal is captured by the timer;

[0046] Step S2, recording the actual pulse width time after each voltage rise;

[0047] The actual pulse width time refers to the interval time between the voltage rising to a high level and the voltage falling to a low level, that is, the time the voltage is maintained at a high level after each capture of the voltage rise jump. The actual pulse width time of serial communication is directly related to the number of data bits transmitted, that is, the number of code elements. Taking 1-bit data as an example, its actual pulse width time is the pulse width time of a single code element. The actual pulse width time of 2-bit data should be twice the actual pulse width time of 1-bit data, and the actual pulse width time of 3-bit data should be three times the actual pulse width time of 1-bit data, and so on.

[0048] Step S3, analyzing multiple actual pulse width times and determining a verification pulse width time;

[0049] The above “multiple actual pulse width times” generally refers to at least two actual pulse width times obtained by continuous recording. The number of samples can be designed and set. After starting to monitor the communication signal, the actual pulse width times of the set number of samples are continuously collected. For example, 10 actual pulse width times obtained by continuous recording are analyzed and the verification pulse width time is determined. Of course, the sampling time is also designed and set. After starting to monitor the communication signal, the actual pulse width time after each voltage rise change is recorded within the set sampling time. Setting the number of samples or setting the sampling time are designed according to actual needs. The present invention does not impose any special restrictions on the specific sampling method of the “multiple actual pulse width times”.

[0050] The check pulse width time can be a single code element pulse width time, that is, the actual pulse width time of 1 bit of data. In this case, if the actual baud rate of the currently monitored communication signal is normal, the target baud rate of the communication signal should be a multiple of the reciprocal of the check pulse width time. The check pulse width time can also be determined according to the target baud rate of the currently monitored communication signal. For example, if the number of code elements transmitted per unit time at the target baud rate is n, the actual pulse width time of n bits of data is determined from multiple actual pulse width times, and the actual pulse width time is used as the check pulse width time. In this case, if the actual baud rate of the currently monitored communication signal is normal, the target baud rate of the communication signal should be the same as the reciprocal of the check pulse width time.

[0051] Step S4, determine whether the inverse of the check pulse width time matches the target baud rate of the communication signal. If so, the communication signal is determined to be normal and the next communication signal is detected. If not, the communication signal is determined to be abnormal, the program function of the controller to be tested stops running, and an alarm signal is sent out.

[0052] The check pulse width time can be a single codeword pulse width time or an actual pulse width time with the same number of bits as the target baud rate. If the check pulse width time is a single codeword pulse width time, then determine whether the reciprocal of the check pulse width time is in a multiple relationship with the target baud rate. When the target baud rate is an integer multiple of the reciprocal of the check pulse width time, it means that the reciprocal of the check pulse width time matches the target baud rate, and the communication signal is normal; on the contrary, when the target baud rate is not an integer multiple of the reciprocal of the check pulse width time, it means that there is an error between the reciprocal of the check pulse width time and the target baud rate, and the communication signal is abnormal. If the check pulse width time is an actual pulse width time with the same number of bits as the target baud rate, then determine whether the reciprocal of the check pulse width time is the same as the target baud rate. When the reciprocal of the check pulse width time is the same as the target baud rate, it means that the reciprocal of the check pulse width time matches the target baud rate, and the communication signal is normal; on the contrary, when the reciprocal of the check pulse width time is different from the target baud rate, it means that there is an error between the reciprocal of the check pulse width time and the target baud rate, and the communication signal is abnormal.

[0053] In a preferred embodiment of the present invention, the check pulse width time is a single code element pulse width time, and the check pulse width time is determined by: finding a common divisor that divides the largest number of actual pulse width times, and using the common divisor as the single code element pulse width time. In order to facilitate the search for the common divisor, multiple actual pulse width times can be sorted first, and then calculated in sequence. If there are more than two common divisors that divide the largest number of actual pulse width times, the smallest common divisor is selected as the single code element pulse width time. For example, if the common divisors a and b can divide the same number of actual pulse width times, the smaller one of a and b is selected as the single code element pulse width time.

[0054] It should be pointed out that in practical application, the multiple actual pulse width times collected can also be sorted according to size, and the smallest actual pulse width time is used as the verification pulse width time. This determination method has a smaller amount of calculation and simpler logic, but does not take into account the situation where the communication signal is jittering. If the smallest actual pulse width time happens to be an invalid pulse width time that jitters, it will cause errors in the judgment result of whether the communication signal is abnormal. That is, using the smallest actual pulse width time as the verification pulse width time is easier to implement in the program, but the baud rate detection accuracy is slightly worse. Therefore, the preferred solution is to find a common divisor that divides the most actual pulse width times, and use the common divisor as the single code element pulse width time.

[0055] Based on the above preferred embodiment, in order to more accurately identify the abnormality of the communication signal, after determining the check pulse width time, the multiple actual pulse width times collected are screened. If the actual pulse width time is a multiple of the check pulse width time, it means that the actual pulse width time is a valid pulse width time. If the actual pulse width time is not a multiple of the check pulse width time, it means that the actual pulse width time is an invalid pulse width time. During the screening, the actual number of invalid pulse width times is counted. When the actual number exceeds the set upper limit, it means that the current communication signal is frequently jittering and the communication quality is poor, so the communication signal is determined to be abnormal.

[0056] In some embodiments of the present invention, in order to more quickly identify abnormalities in communication signals, in the process of determining the verification pulse width time, it is determined whether a common divisor that divides at least two actual pulse width times can be found. If not, it means that the actual pulse width time is chaotic and disordered, and the communication signal is in an extremely unstable state, so the communication signal is determined to be abnormal; if so, it means that the actual pulse width time is relatively regular, and it is necessary to further confirm whether the communication signal is abnormal by verifying the pulse width time.

[0057] It should be pointed out that when the controller to be tested has more than two communication signals, after the controller to be tested starts communication, the above detection method is used to monitor each communication signal in turn. If all communication signals are judged to be normal, the controller to be tested starts running and enters the operation stage. If any communication signal is judged to be abnormal, the controller to be tested stops running and sends an alarm signal to the outside. In actual application, each communication signal can also be monitored after the controller starts running, and the abnormality of the communication signal can also be identified, but the fault detection time is relatively delayed. Therefore, the preferred solution is to detect the communication signal when the controller to be tested starts communication.

[0058] like Figure 2 As shown, the present invention also proposes a baud rate detection system, which includes a communication module and a main control chip 1, a communication line is connected between the communication module and the main control chip 1, the main control chip 1 has a timer, and the detection pin of the timer is connected to the communication line. The main control chip 1 starts the communication, and the detection pin of the timer receives the communication signal between the main control chip 1 and the communication module. The main control chip 1 executes the above-mentioned detection method, captures the voltage fluctuation caused by the communication signal through the timer, and after determining the check pulse width time, determines whether the communication signal is abnormal according to the inverse of the check pulse width time and the target baud rate of the communication signal.

[0059] In order to realize accurate identification of communication signals, only one RX signal or TX signal in one communication can be captured at a time. A switch circuit 2 is also provided between the timer and the communication module, and the switch circuit 2 is used to switch and select the detection pin of the timer and any communication line of the communication module. The switch circuit 2 can be implemented by a decoder chip, and the multi-recorded signals to be detected are input to the chip. The main control chip 1 sends a decoding signal to the decoder chip, and then one of the multi-channel input signals corresponding to the signal can be output to the timer detection pin of the main control chip 1.

[0060] In some embodiments of the present invention, the main control chip 1 is connected to a buzzer alarm circuit 3, and the communication module includes a 485 communication circuit 4 and a CAN communication circuit 5. After the controller software is initialized, the communication is started, and the main control chip 1 sends a selection signal, that is, a decoding signal, to the switch circuit 2, and selects a certain RX signal or TX signal in the 485 communication circuit 4 or the CAN communication circuit 5 for baud rate self-test. For example, the decoding signal of the RX signal of the CAN communication is "001". After the switch circuit 2 receives the decoding signal, the RX signal of the CAN communication, that is, CAN-RX, is input to the timer detection pin of the main control chip 1, and the timer starts the capture. The main control chip 1 has a function to obtain the actual pulse width time after each voltage rise and change, and analyzes multiple actual pulse width times and determines the verification pulse width time. It determines whether the communication signal is abnormal according to the inverse of the verification pulse width time and the target baud rate of the communication signal. When the TX signal and RX signal of the 485 communication circuit 4 and the CAN communication circuit 5 are judged to be normal, the main control chip 1 starts the normal process of the program function. When any one of the TX signal and RX signal of the 485 communication circuit 4 and the CAN communication circuit 5 is judged to be abnormal, the main control chip 1 sends a driving signal to the buzzer alarm circuit 3, so that the buzzer alarm circuit 3 is controlled to send an alarm signal.

[0061] The present invention also proposes a controller having the above baud rate detection system, and the baud rate detection system uses the above baud rate detection method to determine whether its own communication signal is abnormal.

[0062] The present invention also provides an electrical device, which includes the above-mentioned controller. The controller can be used in the fields of automotive electronics, air conditioning units, medical equipment, etc.

[0063] It should be noted that the terms used above are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0064] Unless otherwise specifically stated, the relative arrangement, numerical expressions and numerical values ​​of the parts and steps set forth in these embodiments do not limit the scope of the present application. At the same time, it should be understood that, for ease of description, the sizes of the various parts shown in the accompanying drawings are not drawn according to the actual proportional relationship. The technology, method and equipment known to those of ordinary skill in the relevant field may not be discussed in detail, but in appropriate cases, the technology, method and equipment should be considered as a part of the authorization specification. In all examples shown and discussed here, any specific value should be interpreted as being merely exemplary, rather than as a limitation. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so that once a certain item is defined in an accompanying drawing, it does not need to be further discussed in subsequent drawings.

[0065] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A baud rate detection method, characterized in that: include: Monitor voltage fluctuations caused by communication signals; Record the actual pulse width time after each voltage rise; Analyze the multiple actual pulse width times and determine the verification pulse width time; Determining whether a common divisor that divides at least two of the actual pulse width times can be found; If not, determining that the communication signal is abnormal; If so, first determine the check pulse width time, find the common divisor that divides the actual pulse width time the most, use the common divisor as the single code element pulse width time, and the check pulse width time is the single code element pulse width time. Determine whether the reciprocal of the check pulse width time matches the target baud rate of the communication signal. If the target baud rate is an integer multiple of the reciprocal of the check pulse width time, then it matches, and the communication signal is determined to be normal. If the target baud rate is not an integer multiple of the reciprocal of the check pulse width time, then it does not match, and the communication signal is determined to be abnormal.

2. The baud rate detection method according to claim 1, characterized in that: Analyzing the plurality of actual pulse width times and determining the verification pulse width time further comprises: After determining the check pulse width time, screening the actual pulse width time, if the actual pulse width time is a multiple of the check pulse width time, it is a valid pulse width time, if the actual pulse width time is not a multiple of the single code element pulse width time, it is an invalid pulse width time; The actual number of the invalid pulse width time is counted, and when the actual number exceeds a set upper limit number, it is determined that the communication signal is abnormal.

3. The baud rate detection method according to claim 1 or 2, characterized in that: Also includes: When the controller under test starts communication, each communication signal is monitored in turn. If all communication signals are judged to be normal, the controller under test starts running. If any communication signal is judged to be abnormal, the controller under test stops running and sends out an alarm signal.

4. Baud rate detection system, characterized in that, include: Communication module; A main control chip, wherein the main control chip has a timer, and a detection pin of the timer receives a communication signal between the main control chip and the communication module; The main control chip executes the detection method according to any one of claims 1 to 3.

5. The baud rate detection system according to claim 4, characterized in that: Also includes: A switch circuit, used for switching the detection pin of the timer and any one of the communication lines of the communication module; The main control chip sends a selection signal to the switch circuit to control the corresponding communication signal to be input to the detection pin of the timer.

6. The baud rate detection system according to claim 4, characterized in that: The communication module includes: a 485 communication circuit and / or a CAN communication circuit.

7. A controller, characterized in that The controller has the baud rate detection system according to any one of claims 4 to 6.

8. Electrical equipment, characterized in that: include: The controller of claim 7.