Communication method, electronic equipment and computer readable storage medium
By setting up emergency rescue line ERL interfaces on the receiving end and the sending end, a backup communication path is formed, which solves the problem of the existing communication protocol failing under environmental interference, and improves the reliability of communication between devices.
Patent Information
- Application Number
- CN202411909507.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-15
AI Technical Summary
Existing communication protocols such as I2C, UART and SPI are prone to failure under environmental interference, resulting in low communication reliability between devices.
An emergency rescue line ERL interface is set up at the receiving end and the sending end to form a backup communication path. The receiving end monitors the emergency rescue line ERL interface and receives the communication signal after receiving the preset starting signal, and feedbacks the communication response signal through the backup communication path.
Even if the main communication protocol fails, communication can still be carried out between devices through alternate communication paths, improving the reliability of communication.
Smart Images

Figure CN119835146A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method, electronic equipment and computer-readable storage medium. Background Art
[0002] In the field of communication, communication protocols such as UART (Universal Asynchronous / Asynchronous Receiver-Transmitter), SPI (Serial Peripheral Interface) and I2C (Inter-Integrated Circuit) are widely used for data transmission between devices. Although these communication protocols have shown powerful functions in data transmission speed and transmission volume, these communication protocols may fail due to environmental interference. For example, the I2C protocol may fail due to excessive communication speed and long communication distance, and in a high-interference environment, the UART and SPI protocols cannot work stably, which may lead to interruption of communication between devices. Therefore, there is currently a technical problem of low reliability of communication between devices.
[0003] The above contents are only used to assist in understanding the technical solutions of the embodiments of the present application, and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a communication method, an electronic device and a computer-readable storage medium, aiming to solve the technical problem of low reliability of communication between devices.
[0005] To achieve the above object, the present invention provides a communication method, which is applied to a receiving end, wherein the receiving end is provided with a first emergency rescue line ERL interface, and a sending end corresponding to the receiving end is provided with a second emergency rescue line ERL interface, wherein the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end, and the communication method comprises: monitoring the first emergency rescue line ERL interface;
[0006] In the case where it is monitored that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, receiving a communication signal sent by the sending end through the backup communication path;
[0007] A communication response signal is fed back to the sending end through the backup communication path.
[0008] In one embodiment, the step of feeding back a communication response signal to the transmitting end through the backup communication path includes:
[0009] Verifying the communication signal, and if the communication signal passes the verification, switching the first emergency rescue line (ERL) interface from an input mode to an output mode;
[0010] A communication response signal is sent to the second emergency rescue line ERL interface through the first emergency rescue line ERL interface, and the first emergency rescue line ERL interface is switched back to the input mode.
[0011] In one embodiment, the step of verifying the communication signal comprises:
[0012] Acquire all data bits from the communication signal, and acquire a verification reference value from the communication signal;
[0013] Sum and modulo each of the data bits to obtain a data check value;
[0014] When the data verification value is consistent with the verification reference value, it is determined that the verification of the communication signal has passed.
[0015] In one embodiment, the method comprises:
[0016] When the first emergency rescue line ERL interface of the receiving end is not connected to the second emergency rescue line ERL interface, or the receiving end and the sending end do not communicate through the backup communication path, the first emergency rescue line ERL interface is in a high level state.
[0017] To achieve the above object, the present invention further provides a communication method, which is applied to a sending end, wherein a receiving end corresponding to the sending end is provided with a first emergency rescue line ERL interface, and the sending end is provided with a second emergency rescue line ERL interface, and the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end, and the communication method comprises:
[0018] Acquire communication data, and generate a communication signal of the communication data;
[0019] Sending a preset start signal and a communication signal to the receiving end in sequence through the backup communication path, so that the receiving end can feed back a communication response signal to the sending end when receiving the communication signal;
[0020] Receive a communication response signal fed back by the receiving end through the backup communication path.
[0021] In one embodiment, the step of acquiring communication data and generating a communication signal of the communication data includes:
[0022] Acquire communication data, generate data bits of the communication data, and a verification reference value of the communication data;
[0023] The data bits, the check reference value and the preset stop bit are sequentially spliced to obtain the communication signal.
[0024] In one embodiment, the method comprises:
[0025] If the communication response signal is not received within the preset time after sending the communication signal, return to the execution step: send a preset start signal and a communication signal to the receiving end in sequence through the backup communication path until a communication response signal is received.
[0026] In one embodiment, the method comprises:
[0027] In the case that the sending end and the receiving end do not communicate through the backup communication path, a high level signal is sent to the first emergency rescue line ERL interface of the receiving end.
[0028] The present invention also provides a communication device, the communication device comprising:
[0029] The receiving end is used to monitor the first emergency rescue line ERL interface; when monitoring that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, receive the communication signal sent by the sending end through the backup communication path; and feed back a communication response signal to the sending end through the backup communication path;
[0030] The transmitting end is used to obtain communication data and generate a communication signal of the communication data; to send a preset start signal and a communication signal to the receiving end in sequence through the backup communication path, so that the receiving end can feed back a communication response signal to the transmitting end when receiving the communication signal; and to receive the communication response signal fed back by the receiving end through the backup communication path.
[0031] The present invention also provides an electronic device, comprising a memory, a processor, and a communication program stored in the memory and executable on the processor, wherein when the communication program is executed by the processor, the steps of the communication method described above are executed.
[0032] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a communication program that can be run on a processor, and the communication program is called by the processor to implement the steps of the communication method as described above.
[0033] The present invention also provides a program product, which is a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the communication method described above are implemented.
[0034] The present invention provides a communication method, which can at least achieve the following technical effects: in this embodiment, a first emergency rescue line ERL (Emergency Rescue Line) interface is set at the receiving end, and a second emergency rescue line ERL interface is set at the sending end. The first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end. The receiving end can monitor the first emergency rescue line ERL interface. When it is monitored that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, it indicates that the sending end will communicate with the receiving end through the backup communication path. Therefore, when the receiving end monitors the preset start signal at the first emergency rescue line ERL interface, the receiving end can receive the communication signal sent by the sending end through the backup communication path. The receiving end can feed back a communication response signal to the sending end through the backup communication path, so that the receiving end and the sending end can communicate through the backup communication path. Even if the communication protocols such as UART, SPI and / or I2C of the receiving end and the sending end fail, communication can still be carried out through the backup communication path, thereby improving the communication reliability between devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1 A schematic diagram of a flow chart of an embodiment of a communication method of the present invention;
[0038] Figure 2 A flow chart of another embodiment of the communication method of the present invention;
[0039] Figure 3 A schematic diagram of level changes at a transmitting end and a receiving end in the communication method of the present invention;
[0040] Figure 4 A schematic diagram of the communication process corresponding to the sending end and the receiving end in the communication method of the present invention;
[0041] Figure 5 It is a structural schematic diagram of a communication device according to an embodiment of the present invention;
[0042] Figure 6 A schematic diagram of the structure of the hardware operating environment of the electronic device involved in the embodiment of the present invention;
[0043] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0044] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Communication protocols such as USB (Universal Serial Bus), UART, SPI, and I2C are widely used for communication between devices. USB provides a high-speed data transmission method. UART is used for asynchronous serial communication. SPI is a high-speed synchronous communication protocol, commonly used for data exchange between microcontrollers and peripherals. I2C is a two-wire serial communication bus used to connect microcontrollers and their peripherals.
[0046] Although communication protocols such as USB, UART, SPI, and I2C are powerful, they may fail in some cases due to hardware failure, compatibility issues, or environmental interference. For example, the I2C protocol has distance and speed limitations, while UART and SPI may not work stably in high-interference environments. In addition, the implementation of these communication protocols usually requires dedicated hardware support and complex configuration, which increases communication complexity and cost. In the case of damage to the dedicated hardware corresponding to the communication protocol or software failure, these communication protocols may fail completely, resulting in interruption of communication between devices.
[0047] Therefore, the embodiment of the present application provides a communication method, which can set a spare communication interface on both the sending end and the receiving end. The spare communication interface can be an emergency rescue line ERL interface. Specifically, a first emergency rescue line ERL interface is set at the receiving end, and a second emergency rescue line ERL interface is set at the sending end. The first emergency rescue line ERL interface and the second emergency rescue line ERL interface provide a spare communication path for the sending end and the receiving end. Thus, the sending end and the receiving end can communicate through the spare communication path. It is convenient to communicate through the spare communication path when the key communication protocols such as USB, UART, SPI and I2C of the sending end and the receiving end fail, so that the sending end can still access the receiving end through the spare communication path. And the emergency rescue line ERL interface in the embodiment of the present application is flexible and simple, and reliable communication guarantee can be achieved without increasing additional hardware costs. The emergency rescue line ERL interface can adapt to different communication scenarios to ensure that when the key communication protocols (USB, UART, SPI and I2C) fail, the communication between devices can continue. In addition, the emergency rescue line ERL interface does not need to rely on dedicated hardware support, simplifies the architecture of the communication device, and effectively reduces costs.
[0048] Based on this, the present invention proposes a communication method of the first embodiment, which is applied to a receiving end, wherein the receiving end is provided with a first emergency rescue line ERL interface, and the sending end corresponding to the receiving end is provided with a second emergency rescue line ERL interface, and the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end, please refer to Figure 1 The communication method includes steps S10 to S30:
[0049] Step S10, monitoring the first emergency rescue line ERL interface;
[0050] It should be noted that the receiving end and the transmitting end can be arranged in the same communication device, and the sending and receiving can be realized in the same communication device. The receiving end and the transmitting end may not be arranged in the same communication device. The receiving end and the transmitting end can both be independent devices. For example, the receiving end can be a lower computer, a module, etc., and the transmitting end can be a host computer. This embodiment does not impose specific restrictions on this. The receiving end is provided with a first emergency rescue line ERL interface, and the transmitting end is provided with a second emergency rescue line ERL interface. The backup communication path is composed of the first emergency rescue line ERL interface and the second emergency rescue line ERL interface. The first emergency rescue line ERL interface and the second emergency rescue line ERL interface can be connected by a wire to jointly form a backup communication path. The wire can be a DuPont wire, etc. This embodiment does not impose specific restrictions on this.
[0051] In addition to communicating through the backup communication path, the receiving end and the transmitting end can also communicate using communication protocols such as USB, UART, SPI and I2C. This embodiment does not make specific restrictions on this. If the communication protocols of USB, UART, SPI and / or I2C corresponding to the receiving end and the transmitting end fail, communication can be carried out through the backup communication path. In other embodiments, even if the communication protocols of USB, UART, SPI and / or I2C corresponding to the receiving end and the transmitting end are not faulty, communication can also be carried out using the backup communication path, and this embodiment does not make specific restrictions on this. This embodiment sets a first emergency rescue line ERL interface at the receiving end and a second emergency rescue line ERL interface at the transmitting end, so that communication can be achieved through the backup communication path, reducing the risk of communication interruption between the transmitting end and the device end, and improving the communication reliability between the transmitting end and the device end.
[0052] In this embodiment, the first emergency rescue line ERL interface set at the receiving end is configured as an input mode by default, so that the receiving end can receive external signals through the first emergency rescue line ERL interface, and the second emergency rescue line ERL interface set at the sending end is configured as an output mode by default, so that the sending end can send signals to the outside through the second emergency rescue line ERL interface.
[0053] Exemplarily, after the first emergency rescue line ERL interface and the second emergency rescue line ERL interface are connected, the receiving end may monitor the first emergency rescue line ERL interface in real time, for example, may monitor the level change of the first emergency rescue line ERL interface in real time.
[0054] Step S20, receiving a communication signal sent by the sending end through the backup communication path when monitoring that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path;
[0055] It should be noted that the communication signal is characterized by data that the transmitting end needs to send to the receiving end. For example, the communication signal may include a control instruction from the transmitting end to the receiving end. The control instruction may be an instruction to the receiving end to reload the driver of the USB and / or UART, etc., and this embodiment does not specifically limit this. When the USB driver is reloaded, the communication protocol corresponding to the USB may be restored to normal, so that the receiving end and the transmitting end can communicate through the communication protocol corresponding to the USB. The UART driver may also be restored to normal after being reloaded. The communication signal may be generated by the transmitting end.
[0056] The preset start signal indicates that the transmitter needs to communicate through the backup communication path. The preset start signal can be a signal composed of 8 low levels. When the transmitter needs to communicate with the receiver through the backup communication path, the transmitter will first send the preset start signal to the first emergency rescue line ERL interface through the backup communication path to inform the receiver that the transmitter needs to send a communication signal to the receiver, and the receiver can receive the communication signal at the first emergency rescue line ERL interface. When the receiver does not communicate with the outside through the first emergency rescue line ERL interface, the first emergency rescue line ERL interface is in a high level state, and when the first emergency rescue line ERL interface receives the preset start signal (8 low levels), it indicates that the transmitter needs to send a communication signal to the receiver through the backup communication path.
[0057] Exemplarily, when the receiving end detects a preset start signal at the receiving end of the first emergency rescue line ERL interface, the receiving end will receive the communication signal sent by the sending end through the backup communication path. For example, the receiving end receives the communication signal sent by the sending end through the backup communication path at the first emergency rescue line ERL interface. If the receiving end does not receive the preset start signal at the first emergency rescue line ERL interface, it will not receive any signal at the first emergency rescue line ERL interface, thereby preventing the receiving end from receiving irrelevant signals at the first emergency rescue line ERL interface, which may affect the operation of the receiving end. At the same time, since the communication signal is received only when the preset start signal is received, the preset start signal can mark the beginning of the communication signal, thereby ensuring the integrity of the communication signal reception.
[0058] Step S30: Feedback a communication response signal to the transmitting end via the backup communication path.
[0059] It should be noted that the communication response signal indicates that the communication signal is successfully received. After the receiving end successfully receives the communication signal, it needs to feed back the communication response signal to the sending end to inform the sending end that the receiving end has successfully received the communication signal. After the sending end receives the communication response signal, it means that the communication is completed. If the sending end does not receive the communication response signal, the sending end will send a preset start signal and a communication signal to the receiving end multiple times until it receives the communication response signal fed back by the receiving end.
[0060] In this embodiment, a first emergency rescue line ERL interface is set at the receiving end, and a second emergency rescue line ERL interface is set at the sending end. The first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end. The receiving end can monitor the first emergency rescue line ERL interface. When it is detected that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, it indicates that the sending end will communicate with the receiving end through the backup communication path. Therefore, when the first emergency rescue line ERL interface detects the preset start signal, the receiving end can receive the communication signal sent by the sending end through the backup communication path. The receiving end can feed back a communication response signal to the sending end through the backup communication path, so that the receiving end and the sending end can communicate through the backup communication path. Even if the communication protocols such as UART, SPI and / or I2C of the receiving end and the sending end fail, communication can still be carried out through the backup communication path, thereby improving the communication reliability between devices.
[0061] In a feasible embodiment, step S30 further includes steps S31 to S32:
[0062] Step S31, verifying the communication signal, and if the communication signal verification passes, switching the first emergency rescue line ERL interface from the input mode to the output mode;
[0063] It should be noted that after receiving the communication signal, the receiving end will first verify the communication signal to ensure the accuracy of the received communication signal. The first emergency rescue line ERL interface in the receiving end is configured as input mode by default. After the verification is passed, it is necessary to feed back the communication response signal to the sending end. Therefore, the first emergency rescue line ERL interface needs to be switched from input mode to output mode so that the communication response signal can be fed back to the sending end.
[0064] Exemplarily, the communication signal includes a preset stop bit. When the receiving end receives the preset stop bit, it indicates that the reception of the communication signal is completed. The communication signal can be checked. When the communication signal passes the check, the first emergency rescue line ERL interface is switched from input mode to output mode.
[0065] In a feasible embodiment, step S31 further includes steps S311 to S313:
[0066] Step S311, obtaining all data bits from the communication signal, and obtaining a verification reference value from the communication signal;
[0067] Step S312, summing and modulo each data bit to obtain a data check value;
[0068] Step S313: When the data verification value is consistent with the verification reference value, it is determined that the verification of the communication signal has passed.
[0069] It should be noted that the communication signal includes data bits and check reference values. The communication signal may include multiple data bits. Each data bit of the communication signal is generated by the communication data that the sender needs to send to the receiver. The check reference value is generated by the sender based on the communication data. The check reference value consists of 8 bits. The data check value is calculated by the receiver.
[0070] Exemplarily, the receiving end can sum and modulo all the acquired data bits to obtain a data check value. The receiving end can compare the data check value with the check reference value. When the data check value and the check reference value are consistent, it is determined that the communication signal has been checked. When the data check value and the check reference value are inconsistent, it means that the communication signal has failed to be checked. The receiving end will discard the communication signal and will not feed back a communication response signal to the sending end. In other embodiments, there can be other verification methods. For example, when the sending end generates a check reference value, it can generate a hash value of all data bits of the communication data. The receiving end can calculate the hash value of all data bits of the communication signal and compare the hash value with the check reference value. If the hash value is consistent with the check reference value, it is determined that the communication signal has been checked. If the hash value is inconsistent with the check reference value, it is determined that the communication signal has failed to be checked. The communication signal can also be checked by parity check, which is not specifically limited in this embodiment.
[0071] This embodiment verifies the communication signal to ensure the security and accuracy of the communication signal received by the receiving end.
[0072] Step S32: sending a communication response signal to the second emergency rescue line ERL interface through the first emergency rescue line ERL interface, and switching the first emergency rescue line ERL interface back to the input mode.
[0073] In this embodiment, after the communication signal verification is passed, the first emergency rescue line ERL interface can be switched from input mode to output mode so that a communication response signal can be sent to the second emergency rescue line ERL interface through the first emergency rescue line ERL interface, and the first emergency rescue line ERL interface can be switched back to input mode so that the receiving end can wait to receive the next communication signal.
[0074] For example, after the transmitting end sends the communication signal, the second emergency rescue line ERL interface can also switch from the output mode to the input mode to wait for receiving the communication response signal. After the transmitting end receives the communication response signal, the transmitting end can switch the second emergency rescue line ERL interface back to the output mode for the next communication. The transmitting end can also switch the second emergency rescue line ERL interface back to the output mode when the communication response signal is not received within a preset time.
[0075] The receiving end of this embodiment adjusts the first emergency rescue line ERL interface to feedback the communication response signal, thereby completing the communication between the sending end and the receiving end.
[0076] In a feasible embodiment, the communication method further includes step X10: when the first emergency rescue line ERL interface of the receiving end is not connected to the second emergency rescue line ERL interface, or the receiving end and the sending end do not communicate through the backup communication path, the first emergency rescue line ERL interface is in a high level state.
[0077] It should be noted that when the first emergency rescue line ERL interface is not connected to the second emergency rescue line ERL interface, it means that the receiving end and the transmitting end have not established a connection. The receiving end and the transmitting end can communicate without going through a backup communication path. To avoid irrelevant signals interfering with the receiving end, the receiving end can control the first emergency rescue line ERL interface to be in a high level state. For example, the first emergency rescue line ERL interface can be controlled to be in a high level state through a pull-up resistor at the receiving end.
[0078] For example, when the first emergency rescue line ERL interface is connected to the second emergency rescue line ERL interface, and the receiving end and the sending end do not communicate through the backup communication path, the first emergency rescue line ERL interface is also in a high level state. At this time, the sending end can continuously send a high level to the first emergency rescue line ERL interface through the backup communication path, so that the first emergency rescue line ERL interface is in a high level state.
[0079] In this embodiment, the emergency rescue line ERL interface can be configured as an input mode or an output mode based on needs. For example, the first emergency rescue line ERL interface at the receiving end can be configured as an input mode by default, and the second emergency rescue line ERL interface at the sending end can be configured as an output mode by default. Therefore, the emergency rescue line ERL interface can use multiple communication scenarios with high flexibility. In addition, the emergency rescue line ERL interface does not need to rely on dedicated hardware support. It only needs to connect the emergency rescue line ERL interfaces at both ends through wires to form a communication path, which simplifies the architecture of the communication device and effectively reduces costs.
[0080] Further, based on the above embodiments of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiments can be referred to the above introduction, and will not be described in detail later. Figure 2 , a communication method is applied to a sending end, a receiving end corresponding to the sending end is provided with a first emergency rescue line ERL interface, and the sending end is provided with a second emergency rescue line ERL interface, and the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end, and the communication method includes steps A10 to A30:
[0081] Step A10, acquiring communication data and generating a communication signal of the communication data;
[0082] It should be noted that the communication data is the data that the sending end needs to send to the receiving end. The sending end can automatically generate a communication signal, and the communication signal can be obtained by sequentially splicing the data bit, the check reference value and the preset stop bit.
[0083] Exemplarily, the transmitting end obtains communication data, and based on the communication data, generates a communication signal obtained by sequentially splicing data bits, check reference values, and preset stop bits.
[0084] In a feasible embodiment, step A10 further includes steps A11 to A12:
[0085] Step A11, acquiring communication data, generating data bits of the communication data, and a verification reference value of the communication data;
[0086] Step A12, sequentially splicing the data bits, the check reference value and the preset stop bit to obtain a communication signal.
[0087] It should be noted that the communication data is the data that the sender needs to transmit to the receiver. The communication data may be the instruction data from the sender to the receiver, etc. This embodiment does not specifically limit this. The communication data may be a string of characters. For each character in the string, the sender may decompose the ASCII (American Standard Code for Information Interchange, a character encoding standard) value of the character into 8 bits of binary. If the communication data includes N characters, the number of data bits corresponding to the communication data is 8×N. N is a positive integer.
[0088] The check reference value can be generated based on a preset check method and each data bit of the communication data. For example, the preset check method can be a sum modulo check, so the check reference value can be obtained by the sender performing a sum modulo check on all the data bits of the communication data. The preset check method can also be a hash check, so the check reference value can be obtained by the sender performing a hash calculation on all the data bits of the communication data. The preset check method can also be a parity check, etc., which is not specifically limited in this embodiment. The length of the check reference value is 8 bits, and the check reference value is expressed as a binary value. The preset check method can be set based on actual conditions, which is not specifically limited in this embodiment.
[0089] The preset stop bit is used to mark the end of the communication signal, so that when the receiving end receives the communication signal, it can determine the end of the communication signal reception based on the preset stop bit of the communication signal. The length of the preset stop bit is 8 bits, and the preset stop bit consists of 8 1s.
[0090] Exemplarily, communication data is acquired, each character in the communication data is converted into binary data to obtain data bits of the communication data, and a verification reference value of the communication data is generated based on each data bit of the communication data and a preset verification method; each data bit, the verification reference value and the preset stop bit are sequentially spliced to obtain a communication signal.
[0091] Step A20, sending a preset start signal and a communication signal to the receiving end in sequence through the backup communication path, so that the receiving end can feed back a communication response signal to the sending end when receiving the communication signal;
[0092] Step A30, receiving a communication response signal fed back by the receiving end through the backup communication path.
[0093] It should be noted that the preset start signal indicates that the sender needs to communicate through the backup communication path. The preset start signal can be a signal composed of 8 low levels, for example, the preset start signal can be 8 zeros. When the sender needs to communicate with the receiver through the backup communication path, the sender will first send a preset start signal to the first emergency rescue line ERL interface through the backup communication path to inform the receiver that the sender needs to send a communication signal to the receiver, and the receiver can receive the communication signal at the first emergency rescue line ERL interface.
[0094] The communication response signal indicates that the communication signal is successfully received. After the receiving end successfully receives the communication signal, it needs to feed back the communication response signal to the sending end to inform the sending end that the receiving end has successfully received the communication signal. After the sending end receives the communication response signal, it means that the communication is completed. If the sending end does not receive the communication response signal, the sending end will send the preset start signal and communication signal to the receiving end multiple times until it receives the communication response signal fed back by the receiving end.
[0095] In a feasible embodiment, the communication method applied to the sending end also includes step A21: if no communication response signal is received within a preset time after sending the communication signal, return to the execution step: send a preset start signal and a communication signal to the receiving end in sequence through a backup communication path until a communication response signal is received.
[0096] It should be noted that the preset duration can be set based on actual conditions, and this embodiment does not make any specific limitations on this. When the sending end does not receive a communication response signal within the preset duration, it means that the receiving end may not have successfully received the communication signal. Therefore, the sending end can continue to send a preset start signal and a communication signal to the receiving end until the sending end receives a response signal.
[0097] In other embodiments, the sending end can splice the preset start signal and the communication signal, and send the spliced preset start signal and the communication signal in the form of a data frame. The sending end can send the data frame to the receiving end through the backup communication path, and wait for receiving the communication response signal. Within the preset time after sending the data frame, if the communication response signal is not received, the data frame continues to be sent until the communication response signal is received.
[0098] This embodiment can improve the success rate of the receiving end receiving the communication signal, thereby ensuring the reliability of communication.
[0099] To better understand the structure of the data frame sent by the sender to the receiver, you can refer to Table 1, which shows the structure of the data frame. Table 1 is as follows:
[0100]
[0101]
[0102] Among them, Table 1 shows the structure of the data frame. The data frame can be composed of multiple fields, which are the start bit, each data bit, the check bit and the preset stop bit. The start bit has 8 bits. The preset start signal can be composed of a start bit with 8 bits. The start bit marks the beginning of the data frame and consists of 8 0s. The total number of data bits is 8×N bits. Each data bit is the data actually transmitted by the sender, consisting of 0 and 1. Every 8 bits are combined into a byte. N can be the number of characters to be transmitted. N can be set based on actual conditions. The total length of each data bit should not be too long to avoid increasing the risk of data loss. The check bit has 8 bits. The reference value can be placed in the check bit. The preset stop bit marks the end of the data frame. The preset stop bit consists of 8 1s.
[0103] In a feasible embodiment, in a feasible embodiment, the communication method applied to the sending end also includes step Y10: when the sending end and the receiving end do not communicate through the backup communication path, continuously sending a high-level signal to the first emergency rescue line ERL interface of the receiving end.
[0104] It should be noted that when the transmitting end does not need to communicate with the receiving end through the backup communication path, the transmitting end can continuously send a high-level signal to the first emergency rescue line ERL interface of the receiving end, thereby preventing the first emergency rescue line ERL interface of the receiving end from receiving other irrelevant signals. And because the preset start signal is a continuous low level, it is also convenient for the receiving end to accurately identify the preset start signal, so that the receiving end can receive the communication signal sent by the transmitting end.
[0105] For a better understanding of this embodiment, please refer to Figure 3 , taking N=2, the communication data is the string "ab", the sender is the host computer, and the receiver is the module as an example, the communication process between the sender and the receiver is described. For each character (a and b), the host computer decomposes the ASCII value corresponding to the character into 8 data bits.
[0106] First, the host computer sends a start signal, and then transmits each data bit (Data) in turn. For each character (a and b), the ASCII value corresponding to the character will be decomposed into 8 data bits. In this example, the number of data bits transmitted by the host computer is 16 bits. Then the check bit (Checksum) is transmitted, and finally ends with the stop bit (Stop). After the data frame is successfully received, the module confirms the successful reception of the data through the communication response signal (Ack).
[0107] exist Figure 3 In the idle state, the host computer continuously outputs a high level at the second emergency rescue line ERL interface, and the module continuously receives a high level signal at the first emergency rescue line ERL interface, indicating a preset start signal. The preset start signal has 8 zeros. Each data bit can specifically include data bits corresponding to character a and data bits corresponding to character b. The data bits corresponding to character a are 01100001, and the data bits corresponding to character b are 01100010. The binary data represented by the check bit is the check reference value, and the check reference value is 11000011; it represents a preset stop bit, and the preset stop bit is 8 1s; the communication response signal is 8 0s, 1 represents a high level, and 0 represents a low level. Figure 3 The figure shows the high and low level changes of the second emergency rescue line ERL interface when the host computer sends, the high and low level changes of the second emergency rescue line ERL interface when the host computer receives, the high and low level changes of the first emergency rescue line ERL interface when the module sends, and the high and low level changes of the first emergency rescue line ERL interface when the module receives. Figure 3 It can be seen that when the host computer is receiving, it will only display a low level when receiving the communication response signal. During other periods of time when the host computer is receiving, there will be no changes in the high and low levels. When the module is sending, it will only display a low level when sending the communication response signal. During other periods of time when the module is sending, there will be no changes in the high and low levels.
[0108] Refer to Figure 4 , Figure 4 The flowchart corresponding to the sending end and the receiving end is that the receiving end will execute step a: continuously monitor the level change of the first emergency rescue line ERL interface, the sending end executes step b: sending data frames, that is, the sending end sends data frames to the receiving end, and the receiving end executes step c: receiving data frames; then executes step d: verification, that is, verifying each data bit. After the sending end executes step b, it will execute step b1: waiting for the communication response signal. After the receiving end executes step d and the verification passes, the receiving end executes step e: sending a communication response signal, that is, the receiving end sends a communication response signal to the sending end.
[0109] If you cannot find a standard data cable to connect USB or UART devices for communication, you can use a simple wire (such as Dupont wire) to connect the first emergency rescue line ERL interface and the second emergency rescue line ERL interface to achieve data transmission. And in the event of unexpected failure of the USB, UART and other interface drivers, you can use the first emergency rescue line ERL interface to input data to the receiving end and control the receiving end to reload the driver without restarting the receiving end.
[0110] The embodiment of the present invention further provides a communication device 30, referring to Figure 5 , the communication device 30 comprises:
[0111] The receiving end 10 is used to monitor the first emergency rescue line ERL interface; when it is detected that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, receive the communication signal sent by the sending end through the backup communication path; and feed back a communication response signal to the sending end through the backup communication path;
[0112] The sending end 20 is used to obtain communication data and generate a communication signal of the communication data; send a preset start signal and a communication signal to the receiving end in sequence through a backup communication path, so that the receiving end can feed back a communication response signal to the sending end when receiving the communication signal; and receive the communication response signal fed back by the receiving end through the backup communication path.
[0113] The communication device provided by the present invention adopts the communication method in the above embodiment to solve the technical problem of low reliability of communication between devices. Compared with the prior art, the beneficial effects of the communication device provided by the embodiment of the present invention are the same as the beneficial effects of the communication method provided by the above embodiment, and other technical features in the communication device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0114] An embodiment of the present application also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the communication method in the above embodiment.
[0115] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0116] like Figure 6 As shown, the electronic device may include a processing device 101 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 102 or a program loaded from a storage device 103 to a random access memory (RAM: Random Access Memory) 104. In RAM104, various programs and data required for the operation of the electronic device are also stored. The processing device 101, ROM102, and RAM104 are connected to each other through a bus 105. An input / output (I / O) interface 106 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 106: an input device 107 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 108 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 103 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 109. The communication device 109 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the electronic device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0117] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 103, or installed from a ROM 102. When the computer program is executed by the processing device 101, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0118] The electronic device provided in the embodiment of the present application adopts the communication method in the above embodiment to solve the technical problem of low reliability of communication between devices. Compared with the prior art, the beneficial effects of the electronic device provided in the embodiment of the present application are the same as the beneficial effects of the communication method provided in the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the above embodiment method, which will not be described in detail here.
[0119] It should be understood that each part of the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0120] The above are only specific implementations of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be included in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be based on the protection scope of the above claims.
[0121] An embodiment of the present invention provides a computer-readable storage medium, including computer-readable program instructions stored thereon, and the computer-readable program instructions are used to execute the communication method in the above-mentioned embodiment 1.
[0122] The computer-readable storage medium provided in the embodiment of the present invention may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection including one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination thereof.
[0123] The computer-readable storage medium may be included in the communication device; or may exist independently without being assembled into the communication device.
[0124] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the communication device, the communication device: monitors the first emergency rescue line ERL interface; when it is monitored that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, receives the communication signal sent by the sending end through the backup communication path; and feeds back a communication response signal to the sending end through the backup communication path.
[0125] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0126] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0127] The modules involved in the embodiments of the present disclosure may be implemented in software or hardware, wherein the name of the module does not limit the unit itself in some cases.
[0128] The readable storage medium provided by the present invention is a computer-readable storage medium, which stores computer-readable program instructions for executing the above-mentioned communication method, and can solve the technical problem of low reliability of communication between devices. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present invention are the same as the beneficial effects of the communication method provided in the above-mentioned embodiment, and will not be repeated here.
[0129] An embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the communication method described above are implemented.
[0130] The computer program product provided by the present invention can solve the technical problem of low reliability of communication between devices. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present invention are the same as the beneficial effects of the communication method provided by the above embodiment, which will not be repeated here.
[0131] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent scope of the present invention.
Claims
1. A communication method, characterized in that: Applied to a receiving end, the receiving end is provided with a first emergency rescue line ERL interface, and the sending end corresponding to the receiving end is provided with a second emergency rescue line ERL interface, the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the sending end and the receiving end, and the communication method includes: Monitoring the first emergency rescue line ERL interface; In the case where it is monitored that the first emergency rescue line ERL interface receives a preset start signal sent by the sending end through the backup communication path, receiving a communication signal sent by the sending end through the backup communication path; A communication response signal is fed back to the sending end through the backup communication path.
2. The communication method according to claim 1, characterized in that: The step of feeding back a communication response signal to the transmitting end through the backup communication path comprises: Verifying the communication signal, and if the communication signal passes the verification, switching the first emergency rescue line (ERL) interface from an input mode to an output mode; A communication response signal is sent to the second emergency rescue line ERL interface through the first emergency rescue line ERL interface, and the first emergency rescue line ERL interface is switched back to the input mode.
3. The communication method according to claim 2, characterized in that: The step of verifying the communication signal comprises: Acquire all data bits from the communication signal, and acquire a verification reference value from the communication signal; Sum and modulo each of the data bits to obtain a data check value; When the data verification value is consistent with the verification reference value, it is determined that the verification of the communication signal has passed.
4. The communication method according to claim 1, wherein: The method includes: When the first emergency rescue line ERL interface of the receiving end is not connected to the second emergency rescue line ERL interface, or the receiving end and the sending end do not communicate through the backup communication path, the first emergency rescue line ERL interface is in a high level state.
5. A communication method, characterized in that: Applied to a transmitting end, the receiving end corresponding to the transmitting end is provided with a first emergency rescue line ERL interface, the transmitting end is provided with a second emergency rescue line ERL interface, the first emergency rescue line ERL interface and the second emergency rescue line ERL interface together constitute a backup communication path between the transmitting end and the receiving end, the communication method includes: Acquire communication data, and generate a communication signal of the communication data; Sending a preset start signal and a communication signal to the receiving end in sequence through the backup communication path, so that the receiving end can feed back a communication response signal to the sending end when receiving the communication signal; Receive a communication response signal fed back by the receiving end through the backup communication path.
6. The communication method according to claim 5, characterized in that: The step of acquiring communication data and generating a communication signal of the communication data comprises: Acquire communication data, generate data bits of the communication data, and a verification reference value of the communication data; The data bits, the check reference value and the preset stop bit are sequentially spliced to obtain the communication signal.
7. The communication method according to claim 5, characterized in that: The method includes: If the communication response signal is not received within the preset time after sending the communication signal, return to the execution step: send a preset start signal and a communication signal to the receiving end in sequence through the backup communication path until a communication response signal is received.
8. The communication method according to claim 5, characterized in that: The method includes: In the case that the sending end and the receiving end do not communicate through the backup communication path, a high level signal is sent to the first emergency rescue line ERL interface of the receiving end.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a communication program stored in the memory and executable on the processor, wherein when the communication program is executed by the processor, the steps of the communication method according to any one of claims 1 to 8 are executed.
10. A computer-readable storage medium, characterized in that: A communication program that can be run on a processor is stored, and the communication program is called by the processor to implement the steps of the communication method according to any one of claims 1 to 8.