A communication baud rate identification system of an electric energy meter

By automatically identifying and matching the baud rate of the electricity meter through the SPI host, the problem of garbled characters when the baud rate of the electricity meter is inconsistent is solved, and an efficient and convenient meter reading process is realized.

CN120475281BActive Publication Date: 2025-12-16ZHEJIANG CHINT INSTR & METER
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510643431.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-12-16
Estimated Expiration
2045-05-19

AI Technical Summary

Technical Problem

When existing electricity meters have inconsistent baud rates, data reception is prone to garbled characters, resulting in low meter reading efficiency and inconvenience. It requires manual testing of multiple baud rates to match, which affects the efficiency and convenience of meter reading.

Method used

The SPI master is used to receive data instead of the UART slave. By setting the clock frequency of the SPI master to an integer multiple of the highest baud rate of the UART master, the baud rate is automatically identified and matched. The interrupt detection and data storage unit are used to identify the start bit, data bit, parity bit and stop bit of the UART data, and the baud rate is automatically adjusted to achieve correct reception.

Benefits of technology

It improves the efficiency and convenience of electricity meter reading, reduces manual intervention, and ensures data accuracy and efficient communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120475281B_ABST
    Figure CN120475281B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of electronic electric energy meter, and discloses a communication baud rate identification system of an electric energy meter. The application replaces the receiving of a UART slave machine with the receiving of an SPI host machine, that is, the UART host machine sends data, and the SPI host machine receives data. The SPI host machine receives and automatically identifies the UART data under various baud rates. The SPI host machine first assumes the to-be-tested baud rate of the UART host machine, does not need to rely on manual operation to continuously try different baud rates by using external equipment, finally can improve the communication efficiency, and in addition, the convenience and accuracy of meter reading of the electric energy meter are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic electric energy meter, and particularly relates to a communication baud rate identification system of electric energy meter. BACKGROUND

[0002] With the rapid development of China's economy, the demand for electricity in various industries is increasing. Electric energy meters are widely used in apartments, homes, office buildings, shopping malls, supermarkets and other places, mainly for measuring electric energy consumption, monitoring power system load, calculating electricity charges, optimizing power system operation efficiency, etc.

[0003] The control unit in the electric energy meter is adapted with a universal asynchronous receiver and transmitter (UART) function. UART is a commonly used serial communication interface. The output characteristics of UART are that the host and slave each have a clock. The host performs data transmission according to its own clock frequency on the rising edge of the clock pulse. The electric energy meter as a slave needs to receive data according to its own clock frequency. When the baud rates of both parties are consistent, the clock pulse frequencies are also consistent, and then the data transmitted by the host can be correctly received by the slave in time.

[0004] However, in the actual use process of the electric energy meter, the external meter reading device knows that the data bits of the electric energy meter are fixed at 8 bits, the check bits are fixed at even check, and the stop bits are fixed at 1 bit, but does not know the baud rate of the electric energy meter. If the baud rate between the electric energy meter and the external meter reading device is inconsistent, that is, the external meter reading device sends according to its own clock frequency, and the electric energy meter receives according to its own clock frequency, if the receiving frequency is too fast, the data transmitted by 1 bit may be received multiple times, and if the receiving frequency is too slow, the data may be missed. Both of these two cases may treat the start bit / check bit / stop bit / idle as data bits, and the 8-bit data bits will become a string of random codes.

[0005] Therefore, in order to avoid the phenomenon of random codes of meter reading data, the current common method is that the external meter reading device needs to manually send data one by one at each baud rate, and constantly try to find the appropriate baud rate. If the data sent by the external meter reading device to the electric energy meter has no response, a certain period of time is delayed, and another baud rate is tried again. When the baud rate consistent with the electric energy meter is found, the electric energy meter can correctly receive the data sent by the external device, and respond to the data. This method is not convenient to use in the meter reading process, and the meter reading efficiency is low. SUMMARY

[0006] Therefore, the application provides a communication baud rate identification system of an electric energy meter to solve the problem that the data transmission of the electric energy meter is continuously tried by manual to obtain a suitable baud rate, which results in the problems of inconvenience in use and low efficiency in meter reading during meter reading.

[0007] In a first aspect, the application provides a communication baud rate identification system of an electric energy meter, which comprises an asynchronous transceiver UART host, an SPI host and a UART slave, an interrupt pin and a receiving pin of the SPI host are connected to the UART host through a communication interface, and a transmitting pin and a clock pin of the SPI host are both suspended.

[0008] The transmitting pin of the SPI host is used for transmitting probe data at the rising edge of each SPI clock pulse when the SPI host is turned on.

[0009] The receiving pin of the SPI host is used for receiving UART data transmitted by the UART host at the falling edge of each SPI clock pulse when the SPI host is turned on.

[0010] The clock pin of the SPI host is used for setting the clock frequency of the SPI host, and the clock frequency is N times of the highest baud rate of the UART host, wherein N is greater than or equal to 2.

[0011] The interrupt pin is used for detecting the change state of the UART data in real time when the transmitting line of the UART host is idle, and generating an interrupt signal to turn on the SPI host when the UART data is detected to change from high level to low level.

[0012] The SPI host is used for assuming a to-be-tested baud rate of the UART host and continuously receiving the UART data through the receiving pin of the SPI host when the SPI host is in an open state each time, and the to-be-tested baud rate is less than or equal to the highest baud rate of the UART host.

[0013] The SPI host is further used for determining that the to-be-tested baud rate is assumed to be correct when the UART data is correctly identified, and re-assuming the to-be-tested baud rate when it is determined that the UART data is incorrectly identified, until the to-be-tested baud rate is correctly identified.

[0014] The UART slave is used for returning response data to the UART host when the to-be-tested baud rate is assumed to be correct, so that the UART host transmits the UART data according to the to-be-tested baud rate.

[0015] The application replaces the receiving of the UART slave by the receiving of the SPI host, that is, the data is sent by the UART host and received by the SPI host.

[0016] In some optional embodiments, the SPI host comprises:

[0017] The receiving unit is configured to continuously receive the UART data through the receiving pin of the SPI host when the SPI host is turned on.

[0018] The storage unit is configured to store the UART data according to a preset data amount when the SPI host is in the turned-on state each time.

[0019] The application can obtain the UART data of the preset data amount through the above method.

[0020] In some optional embodiments, the SPI host further comprises:

[0021] The calculation unit is configured to calculate the target data amount of the continuously received UART data according to the preset data amount, the to-be-tested baud rate and the clock frequency.

[0022] The application can calculate the UART data of the target data amount through the calculation unit.

[0023] In some optional embodiments, the SPI host further comprises:

[0024] The detection unit is configured to, when the SPI host is in the turned-on state each time, turn off the SPI host once the UART data is idle data after the target data amount of the UART data is continuously received, and continue to receive the UART data through the receiving unit when the target data amount of the UART data is not received.

[0025] The application can receive the UART data in real time through the detection unit, and can also save the power consumption of the SPI host.

[0026] In some optional embodiments, the SPI host further comprises:

[0027] The assumption unit is configured to assume the to-be-tested baud rate according to different levels of standard baud rates.

[0028] The application assumes the to-be-tested baud rate in the SPI host, and does not need to manually try different baud rates for multiple times, which is beneficial to improving the baud rate identification efficiency.

[0029] In some alternative embodiments, the SPI host further comprises:

[0030] The extraction unit is configured to extract a preset amount of UART data from the storage unit at a preset interval starting from a preset position.

[0031] The present application extracts UART data in sequence through the extraction unit, which is conducive to accurately identifying the to-be-tested baud rate.

[0032] In some alternative embodiments, the preset amount of UART data comprises a start bit, a data bit, an even parity bit, and a stop bit.

[0033] The SPI host further comprises:

[0034] The first identification unit is configured to identify whether the UART data of the start bit is correct, and if so, obtain the UART data of the even parity bit, and if not, re-assume the to-be-tested baud rate through the assumption unit.

[0035] The second identification unit is configured to identify whether the UART data of the even parity bit is correct when the UART data of the start bit is identified as correct, and if so, obtain the UART data of the stop bit, and if not, re-assume the to-be-tested baud rate through the assumption unit.

[0036] The third identification unit is configured to identify whether the UART data of the stop bit is correct when the UART data of the even parity bit is identified as correct, and if so, obtain the UART data of the data bit, and if not, re-assume the to-be-tested baud rate through the assumption unit.

[0037] The data analysis unit is configured to analyze the UART data of the data bit according to a preset communication protocol when the UART data of the stop bit is identified as correct.

[0038] The present application is conducive to accurately identifying the preset amount of UART data through the above-mentioned manner.

[0039] In some alternative embodiments, the SPI host further comprises:

[0040] The fourth identification unit is configured to identify whether a first frame header of the UART data of the data bit is correct according to the UART data of the data bit, and if so, obtain a current communication address of the UART data of the data bit, and if not, re-assume the to-be-tested baud rate through the assumption unit until the to-be-tested baud rate is identified as correct.

[0041] The fifth identification unit is configured to identify whether a current communication address of the UART data of the data bit is correct when the first frame header of the UART data of the data bit is identified as correct, and if so, obtain a second frame header of the UART data, and if not, re-assume the to-be-tested baud rate through the assumption unit until the to-be-tested baud rate is identified as correct.

[0042] The sixth identification unit is configured to identify whether a second frame header of the UART data is correct again when a current communication address of the UART data is correct, and if yes, obtain a control code of the UART data, and if no, re-identify the baud rate to be tested by the assuming unit until the baud rate to be tested is correctly identified;

[0043] The seventh identification unit is configured to identify whether a data field length of the UART data is correct again when the second frame header of the UART data is correct, and if no, re-identify the baud rate to be tested by the assuming unit until the baud rate to be tested is correctly identified;

[0044] The eighth identification unit is configured to identify whether a check code of the UART data is correct again when the data field length of the UART data is correct, and if yes, obtain an end symbol of the UART data, and if no, re-identify the baud rate to be tested by the assuming unit until the baud rate to be tested is correctly identified;

[0045] The ninth identification unit is configured to identify whether the end symbol of the UART data is correct again when the check code of the UART data is correct, and if yes, determine that the baud rate to be tested is correctly assumed, and if no, re-identify the baud rate to be tested by the assuming unit until the baud rate to be tested is correctly identified.

[0046] By means of the above-mentioned embodiments, the meter reading data of the electric energy meter can be accurately identified.

[0047] In some optional embodiments, the SPI host further comprises:

[0048] The interrupt pin is further configured to generate an opening signal to re-detect the change state of the UART data in real time when the UART slave successfully transmits the response data.

[0049] By means of the above-mentioned method, when the baud rate to be tested is successfully identified, the opening signal is generated to re-detect the change state of the UART data.

[0050] In some optional embodiments, the communication interface comprises a first communication interface and a second communication interface, and the first communication interface and the UART host are arranged in an external device.

[0051] The receiving pin of the UART host is connected to the output pin of the first communication interface, the transmitting pin of the UART host is connected to the input pin of the second communication interface, the output pin of the first communication interface is connected to the input pin of the second communication interface, and the input pin of the first communication interface is connected to the output pin of the second communication interface.

[0052] In some optional embodiments, the application further comprises a UART slave, the UART slave, the second communication interface and the SPI host are arranged in the electric energy meter.

[0053] The transmitting pin of the UART slave is connected to the input pin of the second communication interface, the interrupt pin is connected to the output pin of the second communication interface, and the receiving pin of the UART slave is left in suspension. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the description of the embodiments or the prior art. Obviously, the drawings described below are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0055] Figure 1 Fig. 1 is a schematic diagram of a conventional communication structure of an electric energy meter according to an embodiment of the present application;

[0056] Figure 2 Fig. 2 is a schematic diagram of an improved communication structure of an electric energy meter according to an embodiment of the present application;

[0057] Figure 3 Fig. 3 is a schematic diagram of data receiving timing of an SPI host according to an embodiment of the present application;

[0058] Figure 4 Fig. 4 is a schematic diagram of the structure of an SPI host according to an embodiment of the present application

[0059] Figure 5 Fig. 5 is a schematic diagram of the format of a DL / T645-2007 protocol according to an embodiment of the present application;

[0060] Figure 6 Fig. 6 is a schematic diagram of the flow of data receiving and parsing performed by an SPI host according to an embodiment of the present application. DETAILED DESCRIPTION

[0061] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0062] According to the embodiment of the present application, an embodiment of a communication baud rate identification system of an electric energy meter is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.

[0063] As shown in Figure 1 , it is a schematic diagram of a conventional communication structure of an electric energy meter. A UART slave 11 is connected to a UART master 12 of an external device, wherein the UART slave 11 is disposed in the electric energy meter. Figure 1 In the prior art, since the MCU controller of the electric energy meter includes the UART slave 11, the MCU of the electric energy meter has a function of transmitting and receiving UART data. The data output RO pin of a first communication interface 13 of the external device is connected to the receiving pin RXD of the UART master 12, the data input pin DI of the first communication interface 13 is connected to the transmitting pin TXD of the UART master 12, the data input pin DI of a second communication interface 14 is connected to the transmitting pin TXD of the UART slave 12, and the data output pin RO of the second communication interface 14 is connected to the receiving pin RXD of the UART slave 11. When the baud rate of the external device and the electric energy meter is consistent, the UART master 12 and the UART slave 11 can normally communicate. That is, the external device transmits UART data through the first communication interface 13, the RXD pin of the UART slave 11 can correctly receive and identify the UART data, and the UART slave 11 transmits response data through the TXD pin.

[0064] In the prior art, Figure 1 , when the baud rate of the external device and the electric energy meter is inconsistent, the UART master 12 transmits UART data according to its own clock frequency, the UART slave 11 receives UART data according to its own clock frequency, and automatically eliminates the start bit, stop bit, check bit and idle bit. The extracted 8-bit data bit can be a string of random codes, which will cause the UART slave 11 to be unable to correctly receive and identify the UART data transmitted by the UART master 12.

[0065] In addition, in order to avoid the phenomenon of random codes of meter reading data, the current common method is to manually transmit data one by one using each baud rate, and to continuously try to find a suitable baud rate. If the data transmitted by the external meter reading device to the electric energy meter has no response, a delay time is set, and then another baud rate is used to continue to try. When the tried baud rate is consistent with the baud rate of the electric energy meter, the electric energy meter can correctly receive the data transmitted by the external device and respond to the data. This method is relatively inconvenient to use in the meter reading process, and the meter reading efficiency is low.

[0066] The principle of data transmission of the SPI host and the SPI slave is as follows: the host sends data out and receives data in synchronously, the SPI host has an SPI clock, the slave does not have an SPI clock, the clock output line of the host is connected to the clock input line of the slave, both share one clock, because the UART transmission is performed by using the clock of each side respectively, there is a deviation between the clocks, so the clock frequency cannot be very high, the SPI transmission shares one clock, there is no deviation in the clock frequency, the clock frequency can be much higher than that of the UART, the SPI data has no idle bit, start bit, check bit and stop bit, only data bit, all data is considered as data bit, at each rising edge of the clock, the SPI host sends data out to the SPI slave, at each falling edge of the clock, the SPI slave sends data out to the SPI host. When the host stops sending data out, the clock stops sending pulses, and the data transmission stops.

[0067] Due to the difference between the data transmission of the UART host and the SPI host, under normal circumstances, the UART host corresponds to the UART slave, and the SPI host corresponds to the SPI slave, so that normal communication can be performed between them. However, the communication baud rate identification system of the electric energy meter provided in the embodiment of the present disclosure utilizes the characteristics of the transmission of the SPI host and the UART host, and designs a receiving of the SPI host to replace the receiving of the UART slave, that is, the UART host sends data, and the SPI host receives data. The SPI host receives and automatically identifies the UART data under various baud rates. Finally, the embodiment of the present disclosure can improve the communication efficiency, and in addition, the convenience and accuracy of meter reading of the electric energy meter are also improved.

[0068] As shown in Figure 2 , the communication baud rate identification system of the electric energy meter in the embodiment of the present disclosure comprises: an asynchronous transceiver UART host 12, an SPI host 15 and a UART slave 11, an interrupt pin 16, a receiving pin of the SPI host 15 and a UART host 12 connected through a communication interface, and a sending pin and a clock pin of the SPI host 15 are both suspended.

[0069] In Figure 2 , the interrupt pin 16 is IO, the receiving pin of the SPI host 15 is MISO, the sending pin of the SPI host 15 is MOSI, and the clock pin of the SPI host 15 is SCLK.

[0070] In Figure 2 , the sending pin MOSI of the SPI host 15 is used to send detection data at the rising edge of each SPI clock pulse when the SPI host 15 is turned on.

[0071] Specifically, after the SPI host function is opened, the clock pulse starts to work, and at the rising edge of each SPI clock pulse, in order to ensure the continuity of the clock, the SPI host sending pin MOSI is used to send invalid detection data.

[0072] In Figure 2 , the receiving pin MISO of the SPI host 15 is used to receive the UART data sent by the UART host 12 at the falling edge of each SPI clock pulse when the SPI host 15 is opened.

[0073] Specifically, after the SPI host function is opened, at the falling edge of each clock pulse, the receiving pin MISO of the SPI host automatically receives the UART data on the pin. The UART data is level data.

[0074] In Figure 2 , the clock pin SCLK of the SPI host 15 is used to set the clock frequency of the SPI host 15, and the clock frequency is N times of the highest baud rate of the UART host 12, N≧2.

[0075] The commonly used baud rates of the electric energy meter are respectively 600, 1200, 2400, 4800, 9600, 19200, 38400, and 115200, which are units of bps. The clock frequency of the SPI host is set to be N times of the highest baud rate of the UART host, for example, the clock frequency of the SPI host is an integer multiple of the highest baud rate 115200 of the UART host, and no matter which baud rate is sent by the UART host, the SPI host can completely scan all the level changes on the receiving pin.

[0076] In Figure 2 , the interrupt pin 16 is used to detect the change state of the UART data in real time when the UART host 12 sends a line idle, and when the UART data is detected to change from high level to low level, an interrupt signal is generated to open the SPI host 15.

[0077] Specifically, when the SPI host is idle, the SPI host is closed. When the SPI host is idle, the SPI host is closed in order to save the power consumption of the SPI host. The interrupt pin IO is used for detection, that is, the level on the receiving pin is detected in real time, and when the receiving pin changes from high level to low level, it means that the UART host starts to transmit the start bit. During the interrupt, the SPI host is opened, and in order to avoid the frequent generation of interrupts affecting the execution efficiency of the SPI host during transmission, the external interrupt is closed first.

[0078] In Figure 2In the above, the SPI master 15 is used to assume that the baud rate to be measured of the UART master 12 and the continuous reception of UART data through the receive pin of the SPI master 15 each time the SPI master is in the open state, and the baud rate to be measured is less than or equal to the highest baud rate of the UART master.

[0079] Specifically, because electricity meters have different baud rates, under normal circumstances, for external devices to exchange data with electricity meters, the communication formats of both parties must be completely identical. However, if the baud rates of the two parties are inconsistent, the external device sends data according to its own clock frequency, and the electricity meter receives data according to its own clock frequency. If the receiving frequency is too fast, one bit of transmitted data may be received multiple times; if the receiving frequency is too slow, data may be missed, resulting in garbled data.

[0080] Therefore, in this embodiment, the SPI host first assumes the baud rate to be measured for the UART host, eliminating the need for manual experimentation with different baud rates using external devices. Since the SPI host is an internal MCU controller of the energy meter, the baud rate to be measured is automatically adjusted within the MCU controller, thereby improving communication efficiency. Furthermore, it also enhances the convenience and accuracy of energy meter reading.

[0081] For example, since a baud rate of 1152000 is an integer multiple of baud rates 600, 1200, 2400, 4800, 9600, 19200, 38400, and 115200, let's assume the baud rate to be measured on the SPI master's receive pin MISO is 115200, N=10, and the clock frequency is 10 times this baud rate. In this case, regardless of the baud rate at which the UART master continuously sends UART data, the SPI master can completely scan all level changes on the receive pin MISO. In this embodiment, the baud rate to be measured is less than or equal to 115200, and the baud rate to be measured can be any of the baud rates in the above examples, and is not limited to 115200.

[0082] exist Figure 2 In addition, the SPI host 15 is also used to determine that the baud rate to be measured is assumed to be correct when the UART data is correctly identified, and to re-assume the baud rate to be measured when the UART data is determined to be incorrect, until the baud rate to be measured is correctly identified.

[0083] exist Figure 2 In the UART slave 11, when the baud rate to be measured is assumed to be correct, it returns response data to the UART master 12 so that the UART master 12 can send UART data according to the baud rate to be measured.

[0084] In a specific example, the UART data of the preset data volume includes: start bit, data bit, even parity bit, and stop bit.

[0085] Specifically, the preset data amount can be 1 byte of data amount. The principle that the SPI host receives 1 byte of data is as follows: the UART data is received on a single line of 1 bit width, 1 byte of data has 11 bits, which are 1 bit of start bit, 8 bits of data bit, 1 bit of parity bit and 1 bit of stop bit, and the 11 bits of UART data are received 1 bit by 1 bit in sequence on the jump edge of the SPI clock.

[0086] When the SPI host is idle, the level on the receiving pin MISO of the SPI host is high, the UART host internally has a clock, different baud rates correspond to different clock frequencies, and whether the level on the receiving pin MISO of the SPI host changes from high to low is captured in real time on the jump edge of the clock pulse.

[0087] The 1-bit start bit is fixed as low, when it is detected that the level changes from high to low on the jump edge of the clock pulse, it is considered that the start bit is received, and then the data bit is received.

[0088] The 8-bit data bit is the real content to be transmitted. On the jump edge of each clock pulse, the 8-bit data bit is received 1 bit by 1 bit in sequence, and then the even parity bit is received.

[0089] The 1-bit even parity bit is received on the jump edge of the clock pulse.

[0090] The 1-bit stop bit is fixed as high, and the 1-bit stop bit is received on the jump edge of the clock pulse.

[0091] In the process of identifying the UART data by the SPI host, the data received by the SPI host is stored byte by byte, and when the SPI host continuously receives several bytes of UART data, it is considered that the reception of all data is completed.

[0092] In a specific example, if the baud rate of communication between the UART host and the SPI slave does not match, the data received by the SPI host looks like a string of random codes. The SPI host needs to extract the 8-bit data bit in the 11-bit from front to back according to the UART format. The SPI host first assumes a to-be-tested baud rate, identifies whether the 11-bit UART data is correct according to the relationship between the clock frequency and the multiple of the baud rate, and when the 11-bit UART data is all correct, it means that the to-be-tested baud rate assumption is correct, and when any of the 11-bit UART data is incorrect, it means that the UART data identification is incorrect. If the above identification is correct, it means that the UART host sends the UART data according to the to-be-tested baud rate assumed in advance, and then the UART slave returns response data to the UART host to inform the UART host that the to-be-tested baud rate assumed in advance can be used. If the above identification is incorrect, it means that the UART host does not send the UART data according to the baud rate, and then another to-be-tested baud rate is assumed, and the identification is repeated until the to-be-tested baud rate is correctly identified.

[0093] Therefore, in the communication baud rate identification system of the electric energy meter in the embodiment of the present disclosure, the reception of the SPI host replaces the reception of the UART slave, that is, the data sent by the UART host is received by the SPI host. The SPI host receives and automatically identifies the UART data under various baud rates. By assuming the to-be-tested baud rate of the UART host in advance, the SPI host does not need to rely on manual use of external equipment to constantly try different baud rates, which can ultimately improve the communication efficiency, and in addition, the convenience and accuracy of meter reading of the electric energy meter are improved.

[0094] In some specific embodiments, as shown in Figure 4 The communication baud rate identification system of the electric energy meter in the embodiment of the present disclosure includes an SPI host 15, which includes a receiving unit 151, a storage unit 152, a calculation unit 153, a detection unit 154, an assumption unit 155, and an extraction unit 156.

[0095] In Figure 4 The receiving unit 151 is configured to continuously receive UART data through the receiving pin of the SPI host 15.

[0096] In Figure 4 The storage unit 152 is configured to store the UART data according to a preset data amount when the SPI host 15 is in an open state each time.

[0097] Specifically, the preset amount is 1 byte of data, which is usually 11-bit UART data, and in the above example, the preset data amount of the UART data includes a start bit, a data bit, an even parity bit, and a stop bit.

[0098] Because the clock frequency of the SPI is an integer multiple of the highest baud rate 115200 of the UART, no matter which baud rate is sent by the external device, the SPI host can completely capture all the level changes on its receiving pin, i.e. the start bit, data bit, check bit and stop bit transmitted by the UART host. After receiving a byte of 8 bits, the storage unit stores the 8-bit UART data, for example, the storage unit can store the preset amount of UART data into a table.

[0099] In Figure 4 , the calculation unit 153 is configured to calculate a target data amount of the continuously received UART data according to the preset data amount, the to-be-tested baud rate and the clock frequency.

[0100] For example, assuming that the to-be-tested baud rate is 600, the clock frequency is set to N times of the highest baud rate 115200 of the UART host according to the minimum to-be-tested baud rate 600, assuming that N is 10, the clock frequency is 1152000, and the preset data amount is 11 bits. The target data amount is denoted by M, M = 11 * 1152000 / 600.

[0101] In Figure 4 , the detection unit 154 is configured to, when the SPI host 15 is in the open state each time, after continuously receiving the target data amount of the UART data, close the SPI host 15 once it is detected that the UART data is idle data, and continue to receive the UART data by the receiving unit 151 when the target data amount of the UART data is not received.

[0102] For example, if the SPI host continuously receives 11 * 1152000 / 600 data FF, it is considered that the data receiving is completed once it is detected that the UART data is idle data, and the SPI host is closed. After the data in the table of the storage unit is processed, the next round of data receiving is performed, and the SPI host is opened.

[0103] In Figure 4 , the assumption unit 155 is configured to assume the to-be-tested baud rate according to different levels of standard baud rates.

[0104] Because the commonly used baud rates are 600, 1200, 2400, 4800, 9600, 19200, 38400 and 115200, which are in bps, the assumption unit assumes the to-be-tested baud rate according to different levels of standard baud rates.

[0105] In Figure 4 , the extraction unit 156 is configured to extract the preset data amount of the UART data from the preset position in the storage unit 152 according to a preset interval.

[0106] Specifically, the UART host sends one byte of 11-bit UART data, and the SPI host receives one byte of 8-bit data according to the communication protocol DL / T645-2007. The received data looks like a string of random codes because it is mixed with a start bit, 8-bit data, an odd parity bit, a stop bit, and a plurality of idle bits. However, the 8-bit data is actually useful, and needs to be extracted from the 11-bit data in order. At this time, the SPI host does not know the baud rate of the data received by the receiving pin, and assumes a baud rate. According to the multiple relationship between the clock frequency and the baud rate, the start bit, 8-bit data, 1-bit parity bit, and 1-bit stop bit are extracted at the corresponding multiple intervals. After extracting one byte of data, the next byte of start bit is searched 1 bit by 1 bit, and when 0 is searched, it is considered that the start bit is searched. Then, the start bit, 8-bit data, 1-bit parity bit, and 1-bit stop bit are extracted at the corresponding intervals, until all the data is extracted.

[0107] Specifically, because the clock frequency 1152000 is an integer multiple of the baud rates 600, 1200, 2400, 4800, 9600, 19200, 38400, and 115200, the baud rate to be measured of the receiving pin is assumed to be 115200, and the clock frequency is 10 times the baud rate. In order to make the collected data more reliable, the data is extracted at the preset position of each data bit UART transmission. The preset position can be the middle position.

[0108] For example, as shown in Table 1, Figure 3 the data in the table is arranged bit by bit from front to back. The 5th bit is extracted as a start bit, the 15th, 25th, 35th, 45th, 55th, 65th, 75th, and 85th bits are extracted as 8-bit data, the 95th bit is extracted as an even parity bit, and the 105th bit is extracted as a stop bit. After the stop bit, one 11-bit byte of UART data is extracted. There can be a plurality of idle bits between the byte and the next byte. Then, the next byte of start bit is searched 1 bit by 1 bit from the 105th bit. When 105+X is searched, 0 is searched, which is considered to be the start bit of the next byte. The 110+X bit is extracted as a start bit, the 120+X, 130+X, 140+X, 150+X, 160+X, 170+X, 180+X, and 190+X bits are extracted as 8-bit data, the 200+X bit is extracted as an even parity bit, and the 210+X bit is extracted as a stop bit. After the stop bit, another byte is extracted. The next byte of UART data is extracted according to the above example.

[0109] In a more specific embodiment, the communication baud rate identification system of the electric energy meter in the embodiments of the present disclosure is used for Figure 4In the SPI host 15, there are also: a first identification unit 1570, a second identification unit 1571, a third identification unit 1572, a data parsing unit 1573, a fourth identification unit 1574, a fifth identification unit 1575, a sixth identification unit 1576, a seventh identification unit 1577, an eighth identification unit 1578, and a ninth identification unit 1579.

[0110] exist Figure 4 In the first identification unit 1570, it is used to identify whether the UART data of the start bit is correct. If it is, it obtains the UART data of the even parity bit. If not, it re-assumes the baud rate to be tested through the assumption unit 155.

[0111] Since the start bit is fixed at a low level, when the first identification unit detects that the start bit received by the SPI master's receive pin changes from high to low on the clock pulse transition edge, it indicates that the UART data of the start bit has been correctly identified. Otherwise, it indicates an identification error. In this case, the baud rate to be measured is re-assumed using the assumption unit described in the example above. If the first identification unit fails to identify the start bit, it means that the external device is not transmitting data according to the previously assumed baud rate to be measured, and another baud rate to be measured is then re-assumed.

[0112] exist Figure 4 In the middle, the second identification unit 1571 is used to identify whether the UART data of the even parity bit is correct when the UART data of the start bit is correct. If it is correct, the UART data of the stop bit is obtained. If not, the baud rate to be measured is re-assumed through the assumption unit 155.

[0113] If the first identification unit correctly identifies the data, the second identification unit will detect an even number of high-level even parity bits received by the SPI master's receive pin on the clock pulse transition edge. If this number is even, the UART data for the even parity bits is correctly identified, and the stop bit UART data is acquired. Otherwise, it indicates an identification error, and the baud rate to be measured is re-assumed using the assumption unit described in the example above. If the second identification unit fails to identify the data, it means the external device is not transmitting data at the pre-assumed baud rate, and another baud rate to be measured is re-assumed.

[0114] exist Figure 4 In the middle, the third identification unit 1572 is used to identify whether the UART data of the stop bit is correct when the UART data of the even parity bit is correct. If it is correct, the UART data of the data bit is obtained. If not, the baud rate to be measured is re-assumed through the assumption unit.

[0115] When the second identification unit identifies correctly, since the stop bit is fixed as high level, the third identification unit identifies that the stop bit of the UART data is correct when the stop bit received by the receiving pin of the SPI host changes from low level to high level at the edge of the clock pulse, at which time, the UART data of the data bit is obtained. On the contrary, it means that the identification is incorrect, at which time, the assumed baud rate is re-assumed by the assumed unit in the above example. When the third identification unit identifies incorrectly, it means that the external device does not transmit data according to the assumed baud rate, and another assumed baud rate is re-assumed.

[0116] In the Figure 4 , the data analysis unit 1573 is configured to analyze the UART data of the data bit according to a preset communication protocol when the UART data of the stop bit is identified correctly.

[0117] In an example, the preset communication protocol is DL / T645-2007 protocol.

[0118] The DL / T645-2007 protocol is a widely used communication protocol. Generally, the electric energy meter is a slave device, and the external device can read the data in the electric energy meter or set the parameters in the electric energy meter through the 485 communication port using the DL / T645-2007 communication protocol, and the electric energy meter performs an action or responds after receiving the data. The communication format of the DL / T645-2007 communication protocol includes baud rate, data bit, check bit, and stop bit, wherein the data bit is fixed as 8 bits, the check bit is fixed as even check, and the stop bit is fixed as 1 bit.

[0119] On the premise that the start bit, the even check bit, and the stop bit are identified correctly, the data analysis unit analyzes the data on the 8-bit data bit extracted by the extraction unit according to the DL / T645-2007 protocol.

[0120] In the Figure 4 , the fourth identification unit 1574 is configured to identify whether the first frame header of the UART data of the data bit is correct according to the UART data of the data bit, and if yes, obtain the current communication address of the UART data of the data bit; and if no, re-assume the assumed baud rate by the assumed unit until the assumed baud rate is identified correctly.

[0121] When the data analysis unit analyzes the UART data of the data bit correctly, since the data format of the DL / T645-2007 protocol is as shown in Figure 5The fourth identification unit first judges whether the first frame header 68H is correct. When the first frame header is correctly identified, the current communication address of the UART data of the data bit is obtained, which is 6 bytes, i.e. A0A1A2A3A4A5A6. Otherwise, it is identified incorrectly. At this time, the assumed unit of the above example re-assumes the to-be-tested baud rate. In the case of incorrect identification of the fourth identification unit, it is indicated that the external device does not transmit data according to the to-be-tested baud rate assumed in advance. Another to-be-tested baud rate is re-assumed.

[0122] In the above-mentioned Figure 4 , the fifth identification unit 1575 is configured to, when the first frame header of the UART data of the data bit is correctly identified, further identify whether the current communication address of the UART data of the data bit is correct. If yes, the second frame header of the UART data is obtained. If no, the assumed unit re-assumes the to-be-tested baud rate until the to-be-tested baud rate is correctly identified.

[0123] The fifth identification unit is mainly configured to identify whether the 6-byte current communication address A0A1A2A3A4A5A6 in the above-mentioned Figure 5 is correct. In the specific identification process, the current communication address is matched with a preset communication address. If the matching is successful, it is indicated that the identification is correct. On the premise of correct identification, the 68H of the second frame header is further obtained. If the matching is incorrect, the assumed unit of the above example re-assumes the to-be-tested baud rate. In the case of incorrect identification of the fifth identification unit, it is indicated that the external device does not transmit data according to the to-be-tested baud rate assumed in advance. Another to-be-tested baud rate is re-assumed.

[0124] In the above-mentioned Figure 4 , the sixth identification unit 1576 is configured to, when the current communication address of the UART data of the data bit is correctly identified, further identify whether the second frame header of the UART data is correct. If yes, the control code of the UART data is obtained. If no, the assumed unit re-assumes the to-be-tested baud rate until the to-be-tested baud rate is correctly identified.

[0125] On the premise of correct identification of the above-mentioned fifth identification unit, the sixth identification unit identifies whether the 68H of the second frame header is correct. When the identification is correct, the control code of the UART data is obtained, which can be represented by C. If the identification is incorrect, the assumed unit of the above example re-assumes the to-be-tested baud rate. In the case of incorrect identification of the sixth identification unit, it is indicated that the external device does not transmit data according to the to-be-tested baud rate assumed in advance. Another to-be-tested baud rate is re-assumed.

[0126] In the above-mentioned Figure 4In the seventh identification unit 1577, when the second frame header of the UART data is identified correctly, whether the data field length of the UART data is correct is identified again. If not, the assumed baud rate is re-assumed by the assumption unit until the baud rate is identified correctly.

[0127] In the above-mentioned case that the seventh identification unit is identified correctly, Figure 5 In the seventh identification unit, whether the data field length L of the UART data is correct is identified. If not, the assumed baud rate is re-assumed by the assumption unit in the above-mentioned example. In the case that the seventh identification unit is identified incorrectly, it is indicated that the external device does not transmit data according to the assumed baud rate, and another assumed baud rate is re-assumed.

[0128] In the above-mentioned case that the seventh identification unit is identified correctly, Figure 4 In the eighth identification unit 1578, when the data field length of the UART data is identified correctly, whether the check code of the UART data is correct is identified again. If yes, the end symbol of the UART data is obtained. If not, the assumed baud rate is re-assumed by the assumption unit until the baud rate is identified correctly.

[0129] In the above-mentioned case that the seventh identification unit is identified correctly, the eighth identification unit identifies whether the check code of the UART data is correct. If identified correctly, the end symbol of the UART data is obtained. If identified incorrectly, the assumed baud rate is re-assumed by the assumption unit in the above-mentioned example. In the case that the eighth identification unit is identified incorrectly, it is indicated that the external device does not transmit data according to the assumed baud rate, and another assumed baud rate is re-assumed.

[0130] In the above-mentioned case that the seventh identification unit is identified correctly, Figure 4 In the ninth identification unit 1579, when the check code of the UART data is identified correctly, whether the end symbol of the UART data is correct is identified again. If yes, it is determined that the assumed baud rate is correct. If not, the assumed baud rate is re-assumed by the assumption unit until the baud rate is identified correctly.

[0131] In the above-mentioned case that the eighth identification unit is identified correctly, the ninth identification unit identifies the end symbol of the UART data. The end symbol is 16H. When the end symbol is identified correctly, it is determined that the assumed baud rate is correct, i.e. it is determined that the external device transmits data according to the assumed baud rate. The UART host can be configured to the assumed baud rate. Otherwise, it is indicated that the identification is incorrect. At this time, the assumed baud rate is re-assumed by the assumption unit in the above-mentioned example. In the case that the ninth identification unit is identified incorrectly, it is indicated that the external device does not transmit data according to the assumed baud rate, and another assumed baud rate is re-assumed.

[0132] In the above-mentioned case that the seventh identification unit is identified correctly, Figure 2In the middle, the interrupt pin 16, and also used when the UART slave 11 successfully sent the response data, generate open signal, real-time detection of changes in the state of the UART data.

[0133] If the entire data frame of the UART data is identified to be consistent with the DL / T645-2007 protocol, it is indicated that the external device is transmitting data according to the to-be-tested baud rate, the UART host is configured to the to-be-tested baud rate, and the sending function of the UART slave is used to respond to data. After the sending is completed, the interrupt pin is opened, and the UART data is detected again.

[0134] As shown in Figure 6 The communication baud rate identification system of the electric energy meter in the embodiment of the present disclosure is executed through the receiving unit, the storage unit, the calculation unit, the detection unit, the assumption unit, the extraction unit, the first identification unit, the second identification unit, the third identification unit, the data analysis unit, the fourth identification unit, the fifth identification unit, the sixth identification unit, the seventh identification unit, the eighth identification unit, the ninth identification unit, and the sequentially executed process. The specific execution process is as follows:

[0135] Step 1: The IO pin of the SPI host is opened to detect the interrupt;

[0136] Step 2: The SPI host is opened during the interrupt, and the interrupt is closed;

[0137] Step 3: It is judged whether the SPI host receives data. If yes, the fourth step is executed, and if no, the fifth step is executed;

[0138] Step 4: The data is stored in the table;

[0139] Step 5: It is judged whether a plurality of data FFs are continuously received. If yes, the sixth step is executed, and if no, the third step is executed;

[0140] Step 6: The SPI host is closed;

[0141] Step 7: One kind of baud rate is assumed;

[0142] Step 8: The start bit is extracted;

[0143] Step 9: The 8-bit data bit is extracted;

[0144] Step 10: The even parity bit is extracted;

[0145] Step 11: The 1-bit stop bit is extracted;

[0146] Step 12: It is judged whether the start bit is correct. If yes, the thirteenth step is executed, and if no, the seventh step is executed;

[0147] Thirteenth step: judging whether the even parity bit is correct, if yes, executing the following fourteenth step, if no, executing the above seventh step;

[0148] Fourteenth step: judging whether the stop bit is correct, if yes, executing the following fourteenth step, if no, executing the above seventh step;

[0149] Fifteenth step: judging whether the first frame header 68H is correct, if yes, executing the following sixteenth step, if no, executing the above seventh step;

[0150] Sixteenth step: judging whether the communication address is correct, if yes, executing the following seventeenth step, if no, executing the above seventh step;

[0151] Seventeenth step: judging whether the second frame header 68H is correct, if yes, executing the following eighteenth step, if no, executing the above seventh step;

[0152] Eighteenth step: judging whether the control code C is correct, if yes, executing the following nineteenth step, if no, executing the above seventh step;

[0153] Nineteenth step: judging whether the length L is correct, if yes, executing the following twentieth step, if no, executing the above seventh step;

[0154] Twentieth step: judging whether the check code CS is correct, if yes, executing the following twenty-first step, if no, executing the above seventh step;

[0155] Twenty-first step: judging whether the end symbol 16H is correct, if yes, executing the following twenty-second step, if no, executing the above seventh step;

[0156] Twenty-second step: identifying the previously assumed baud rate;

[0157] Twenty-third step: sending response data from the UART slave to the UART master;

[0158] Twenty-fourth step: completing the response and re-enabling the IO interrupt detection.

[0159] In some specific embodiments, the communication baud rate identification system of the electric energy meter in the embodiments of the present disclosure, the communication interface comprises: a first communication interface 13 and a second communication interface 14, the first communication interface 13 and the UART master 12 are arranged in an external device; a receiving pin of the UART master 12 is connected to an output pin of the first communication interface 13, a sending pin of the UART master is connected to an input pin of the second communication interface 14, the output pin of the first communication interface 13 is connected to the input pin of the second communication interface 14, and the input pin of the first communication interface 13 is connected to the output pin of the second communication interface 14.

[0160] That is to say Figure 2For the improved communication line connection diagram of the electric energy meter in the embodiments of the present disclosure, the MCU of the electric energy meter is provided with an SPI function. Since the SPI host has a clock function, the SPI host is adopted instead of the SPI slave. The receiving pin MISO of the SPI host is adopted instead of the receiving pin RXD of the UART slave. The original receiving pin RXD of the UART slave no longer receives data, and the pin is suspended. The data output pin RO of the 485 is connected with the receiving pin MISO and the IO pin of the SPI host. The data input pin DI of the 485 is connected with the sending pin TX of the UART host. The clock pin SCLK of the SPI host is suspended. The clock pulse of the SPI host is mainly used because there is no SPI slave outside, and the clock pin does not need to be connected externally. The sending pin MOSI of the SPI host is suspended because there is no SPI slave outside, and the sending pin does not need to be connected externally. However, the suspended sending pin needs to send data all the time in the data receiving process, and the clock pulse needs to be continuous and uninterrupted, so that the data can be normally received at each falling edge of the clock pulse. If no data is sent externally, the clock will stop. However, the sent data can be set at will.

[0161] In some specific embodiments, the communication baud rate identification system of the electric energy meter in the embodiments of the present disclosure is provided in the Figure 2 electric energy meter. The system further comprises a UART slave 11, a second communication interface 14, and an SPI host 15. The sending pin of the UART slave 11 is connected with the input pin of the second communication interface 14. The interrupt pin 16 and the sending pin of the SPI host 15 are connected with the output pin of the second communication interface 14. The receiving pin of the UART slave 11 is suspended.

[0162] In some specific embodiments, the communication baud rate identification system of the electric energy meter in the embodiments of the present disclosure is provided in the Figure 2 electric energy meter. The interrupt pin IO and the sending pin MISO of the SPI host 15 are connected with the output pin RO of the second communication interface. Meanwhile, the receiving of the UART host 12 is connected with the sending of the UART slave 11. After identification, the UART slave 11 sends data in response. The sending pin and the clock pin of the SPI host 15 are suspended. The receiving pin of the UART slave 11 is suspended.

[0163] Therefore, through the above examples, the communication baud rate identification system of the electric energy meter in the embodiments of the present disclosure can identify the data sent by the external device at different baud rates and make correct responses without increasing the cost of the electric energy meter and only increasing a small amount of system resources.

[0164] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A communication baud rate identification system for an electricity meter, characterized in that, include: The system includes an asynchronous UART master, an SPI master, a UART slave, and an interrupt pin. The interrupt pin and the receive pin of the SPI master are connected to the UART master through a communication interface. The transmit pin and clock pin of the SPI master are both left floating. The transmit pin of the SPI host is used to transmit probe data on the rising edge of each SPI clock pulse when the SPI host is turned on. The receive pin of the SPI master is used to receive UART data sent by the UART master on the falling edge of each SPI clock pulse when the SPI master is turned on. The clock pin of the SPI host is used to set the clock frequency of the SPI host, which is N times the highest baud rate of the UART host, where N ≧ 2; The interrupt pin is used to detect the change status of the UART data in real time when the UART host transmit line is idle. When the UART data changes from high level to low level, an interrupt signal is generated to turn on the SPI host. The SPI master is used to assume that the baud rate to be measured of the UART master and to continuously receive UART data through the receive pin of the SPI master each time the SPI master is in the on state, wherein the baud rate to be measured is less than or equal to the maximum baud rate of the UART master. The SPI host is also used to determine that the baud rate to be tested is assumed to be correct when the UART data is correctly identified, and to re-assume the baud rate to be tested when the UART data is determined to be incorrectly identified, until the baud rate to be tested is correctly identified; The UART slave device is used to return response data to the UART master device when it is determined that the baud rate to be tested is assumed to be correct, so that the UART master device can send the UART data according to the baud rate to be tested.

2. The communication baud rate identification system for an electricity meter according to claim 1, characterized in that, The SPI master includes: A receiving unit is configured to continuously receive UART data through the receiving pin of the SPI host when the SPI host is turned on; The storage unit is used to store the UART data according to a preset data amount each time the SPI host is in the open state.

3. The communication baud rate identification system for an electricity meter according to claim 2, characterized in that, The SPI master includes: The calculation unit is used to calculate the target data volume of the continuously received UART data based on the preset data volume, the baud rate to be measured, and the clock frequency.

4. The communication baud rate identification system for an electricity meter according to claim 3, characterized in that, The SPI host also includes: The detection unit is configured to, each time the SPI host is in the on state, shut down the SPI host once the UART data becomes idle after continuously receiving the target amount of UART data, and continue to receive UART data through the receiving unit when the UART data is not received.

5. The communication baud rate identification system for an electricity meter according to claim 3, characterized in that, The SPI host also includes: An assumption unit is used to assume the baud rate to be measured according to different levels of standard baud rates; The extraction unit is used to extract the preset amount of UART data from the storage unit starting from a preset position and at preset intervals.

6. The communication baud rate identification system for an electricity meter according to claim 5, characterized in that, The preset data volume of UART data includes: start bit, data bit, even parity bit, and stop bit; The SPI host also includes: The first identification unit is used to identify whether the UART data of the start bit is correct. If it is, the UART data of the even parity bit is obtained. If not, the baud rate to be tested is re-assumed by the assumption unit. The second identification unit is used to identify whether the UART data of the even parity bit is correct when the UART data of the start bit is correct. If it is correct, the UART data of the stop bit is obtained. If not, the baud rate to be measured is re-assumed by the assumption unit. The third identification unit is used to identify whether the UART data of the stop bit is correct when the UART data of the even parity bit is correct. If it is correct, the UART data of the data bit is obtained. If not, the baud rate to be measured is re-assumed by the assumption unit. The data parsing unit is used to parse the UART data of the data bit according to a preset communication protocol when the UART data of the stop bit is correctly identified.

7. The communication baud rate identification system for an electricity meter according to claim 6, characterized in that, The SPI host also includes: The fourth identification unit is used to identify whether the first frame header of the UART data of the data bit is correct based on the UART data of the data bit. If it is correct, the current communication address of the UART data of the data bit is obtained. If not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is correctly identified. The fifth identification unit is used to identify whether the current communication address of the UART data is correct when the first frame header of the UART data of the data bit is correct. If it is correct, the second frame header of the UART data is obtained. If not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is correctly identified. The sixth identification unit is used to identify whether the second frame header of the UART data is correct when the current communication address of the UART data of the identified data bit is correct. If it is correct, the control code of the UART data is obtained. If not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is correctly identified. The seventh identification unit is used to identify whether the data field length of the UART data is correct when the second frame header of the UART data is identified as correct. If not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is identified as correct. The eighth identification unit is used to identify whether the check code of the UART data is correct when the data field length of the UART data is correct. If it is correct, the end symbol of the UART data is obtained; if not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is correctly identified. The ninth identification unit is used to identify whether the end character of the UART data is correct when all the check codes of the UART data are correct. If it is correct, the baud rate to be tested is assumed to be correct. If not, the baud rate to be tested is re-assumed by the assumption unit until the baud rate to be tested is correctly identified.

8. The communication baud rate identification system for an electricity meter according to any one of claims 1 to 7, characterized in that, The interrupt pin is also used to generate an enable signal when the UART slave device successfully sends the response data, so as to re-detect the change status of the UART data in real time.

9. The communication baud rate identification system for an electricity meter according to claim 1, characterized in that, The communication interface includes: a first communication interface and a second communication interface, wherein the first communication interface and the UART host are located in an external device; The receive pin of the UART host is connected to the output pin of the first communication interface, the transmit pin of the UART host is connected to the input pin of the second communication interface, the output pin of the first communication interface is connected to the input pin of the second communication interface, and the input pin of the first communication interface is connected to the output pin of the second communication interface.

10. The communication baud rate identification system for an electricity meter according to claim 9, characterized in that, Also includes: The UART slave, the second communication interface, and the SPI master are installed in the power meter; The transmit pin of the UART slave is connected to the input pin of the second communication interface, the interrupt pin and the transmit pin of the SPI master are connected to the output pin of the second communication interface, and the receive pin of the UART slave is left floating.

Citation Information

Patent Citations

  • Air conditioning unit communication method and device

    CN108826588A

  • Baud rate detection in serial data transmission

    US6847615B1