A communication method based on 485 bus and smart home system

By determining the delay time based on its own device address, the master device prioritizes handling 485 bus conflicts, thus solving the problem of low communication efficiency caused by random delay processing and achieving more efficient bus communication.

CN116582384BActive Publication Date: 2026-01-23QINGDAO HISENSE BOSCH AIR CONDITIONING SYSTEM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310431003.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-19
Publication Date
2026-01-23
Estimated Expiration
2043-04-19

AI Technical Summary

Technical Problem

In multi-master communication on the 485 bus, the random delay processing method results in a high probability of collisions, leading to low communication efficiency.

Method used

The master device determines the delay time based on its own device address. The master device that prioritizes handling conflicts will resend the data when the delay time is reached, while the other master devices will send the data after the bus becomes idle, thus avoiding multiple random delay processing.

Benefits of technology

It improves the communication efficiency of the 485 bus, avoids communication anomalies caused by conflicts, and optimizes the bus communication process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116582384B_ABST
    Figure CN116582384B_ABST
Patent Text Reader

Abstract

The application discloses a communication method based on a 485 bus and a smart home system, and relates to the technical field of communication, and aims at solving the problem of low communication efficiency of the 485 bus caused by the random delay method for solving the 485 bus conflict in the traditional 485 bus multi-master communication process. The method comprises the following steps: when a plurality of master devices receive data error indication sent by a slave device, at least two master devices determine delay time for delaying data transmission according to the device address of the self device, and the remaining master devices except the at least two master devices enter a waiting transmission state. A first master device with the shortest delay time among the at least two master devices sends data to the slave device again when the first delay time of the self device arrives, and if the plurality of master devices all receive data correct indication, the master devices except the first master device among the at least two master devices send data again.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, in particular to a communication method based on 485 bus and a smart home system. BACKGROUND

[0002] In the process of multi-master communication of 485 bus, when multiple master devices simultaneously send data to a slave device, a conflict of 485 bus occurs, so that the slave device cannot correctly parse the data information sent by the master device. At present, the conflict problem of 485 bus is mainly solved by randomly delaying the master device in conflict. However, when the conflict probability of 485 bus is high, multiple random delay processing needs to be performed on the master device in conflict, resulting in low communication efficiency of 485 bus. SUMMARY

[0003] Embodiments of the present application provide a communication method based on 485 bus and a smart home system, which solve the problem of low communication efficiency of 485 bus when the random delay method is used to solve the conflict problem of 485 bus in the process of traditional multi-master communication of 485 bus.

[0004] To achieve the above-mentioned purpose, embodiments of the present application adopt the following technical solutions.

[0005] In a first aspect, the present application provides a communication method based on 485 bus, which is applied to a smart home system. The smart home system includes multiple master devices, a slave device and a 485 bus. The multiple master devices and the slave device are coupled on the 485 bus. The method includes that at least two master devices in the multiple master devices simultaneously send data to the slave device. When the multiple master devices receive a data error indication sent by the slave device, the at least two master devices respectively determine a delay time for sending data by delay according to the device address of the self device. The remaining master devices except the at least two master devices in the multiple master devices enter a waiting sending state. A first master device with the shortest delay time in the at least two master devices sends data to the slave device again when the first delay time of the self device arrives. If the multiple master devices all receive a data correct indication, the master devices except the first master device in the at least two master devices send data again. When the multiple master devices receive the data correct indication and determine that the idle time of the 485 bus reaches a preset time period, the remaining master devices start to send data to the slave device.

[0006] Thus, in the present application, when at least two master devices in the plurality of master devices simultaneously send data to the slave device, a bus collision occurs. The slave device cannot correctly parse the data sent by the at least two master devices, and sends a data error indication to the at least two master devices. When the plurality of master devices receives the data error indication, the at least two master devices respectively determine their own delay time according to the device address of the device. The first master device with the shortest delay time in the at least two master devices sends data to the slave device again when the first delay time of the first master device arrives. When the plurality of master devices all receive the data correct indication, the master devices other than the first master device in the at least two master devices send data again. That is, when a bus collision occurs, the master devices that cause the collision are given priority to send data to the slave device according to the length of the delay time. That is, when one of the master devices that cause the collision sends data to the slave device again, the remaining master devices that cause the collision are in a waiting state. In this way, the plurality of master devices that cause the collision can be sent data in turn according to the delay time. Compared with the low communication efficiency caused by the need for multiple random delay processing in the prior art, the present application prioritizes the processing of the master devices that cause the collision, and after the plurality of master devices that cause the collision have completed communication, the other master devices initiate communication only after the bus is idle, thereby avoiding the problem that a certain master device cannot complete communication due to a collision, and improving the communication efficiency of the 485 bus.

[0007] In some embodiments, the delay time corresponding to each master device in the plurality of master devices is equal to the numerical value of the device address of each master device itself.

[0008] In some embodiments, before the at least two master devices in the plurality of master devices simultaneously send data to the slave device, the method further comprises: for any master device in the at least two master devices, when any master device determines that no data from the slave device has been received within a preset time period, any master device sends a first communication request to the slave device, and the first communication request is used by any master device to request to send data to the slave device. The slave device sends a first communication response to any master device, and the first communication response is used to indicate that any master device is allowed to communicate with the slave device.

[0009] In some embodiments, before the slave device sends the first communication response to any master device, the method further comprises: if any master device does not receive the first communication response within a first preset time interval after sending the first communication request, any master device sends the first communication request to the slave device again. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a first preset number of times and the first communication response is not received, any master device continues to send the first communication request to the slave device after a second preset time interval. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a second preset number of times and the first communication response is not received, any master device determines that the communication is abnormal.

[0010] In some embodiments, the re-sending data by the at least two master devices other than the first master device comprises: for a second master device of the at least two master devices other than the first master device, when the second master device does not receive data from the slave device within a preset time period, the second master device sends a second communication request to the slave device, the second communication request being used for the second master device to request to send data to the slave device. The slave device checks the data received by the slave device, the data received by the slave device including the data sent by the second master device, and if the slave device fails to check, the slave device sends a data error indication to the plurality of master devices. The second master device determines a second delay time for delaying sending data according to a device address of the second master device, and re-sends data to the slave device when the second delay time arrives.

[0011] In a second aspect, the present application provides an intelligent home system, the intelligent home system comprising a plurality of master devices, a slave device and a 485 bus, the plurality of master devices and the slave device being coupled on the 485 bus. At least two master devices of the plurality of master devices are configured to send data to the slave device simultaneously. The at least two master devices are further configured to determine a delay time for delaying sending data according to a device address of each master device respectively when a data error indication sent by the slave device is received. The remaining master devices of the plurality of master devices other than the at least two master devices are configured to enter a waiting sending state. A first master device of the at least two master devices with the shortest delay time is configured to re-send data to the slave device when a first delay time of the first master device arrives. The master devices of the at least two master devices other than the first master device are configured to re-send data to the slave device if a data correct indication is received. The remaining master devices are configured to start sending data to the slave device when the data correct indication is received and when a 485 bus idle time reaches a preset time period.

[0012] In some embodiments, the delay time corresponding to each master device of the plurality of master devices is equal to a value of the device address of each master device.

[0013] In some embodiments, any master device of the at least two master devices is configured to determine to send a first communication request to the slave device when data from the slave device is not received within a preset time period, the first communication request being used for any master device to request to send data to the slave device. The slave device is configured to send a first communication response to any master device, the first communication response being used to indicate that any master device is allowed to communicate with the slave device.

[0014] In some embodiments, any master device is further configured to: if the first communication response is not received within a first preset time interval after sending the first communication request, send the first communication request to the slave device again. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a first preset number of times and the first communication response is not received, continue to send the first communication request to the slave device after a second preset time interval. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a second preset number of times and the first communication response is not received, determine that the communication is abnormal.

[0015] In some embodiments, for a second master device other than the first master device among the at least two devices, the second master device is configured to send a second communication request to the slave device when data from the slave device is not received within a preset time period, the second communication request being used by the second master device to request the slave device to send data. The slave device is configured to check data received by the slave device, the data received by the slave device including data sent by the second master device, and if the slave device fails to check, send a data error indication to the plurality of master devices. The second master device is configured to determine a second delay time for delaying sending data according to a device address of the device itself, and resend the data to the slave device when the second delay time arrives.

[0016] The beneficial effects of the second aspect can be seen from the description of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 A 485 bus communication schematic diagram of an intelligent home system provided by the present application;

[0018] Figure 2 A schematic diagram of a household water machine control system;

[0019] Figure 3 A flowchart of a 485 bus communication method provided by the present application;

[0020] Figure 4 A bus idle detection mechanism schematic diagram provided by the present application;

[0021] Figure 5 A schematic diagram of a master device 10 initiating a communication application to a slave device 11 provided by the present application;

[0022] Figure 6 A schematic diagram of two master devices simultaneously sending data to a slave device 11 provided by the present application;

[0023] Figure 7 A communication schematic diagram of a master device 10 reinitiating a communication application provided by the present application;

[0024] Figure 8A flowchart of a process of checking a data frame by a slave device 11 provided in the present application is shown in the figure;

[0025] Figure 9 A schematic diagram of a data analysis error provided in the present application is shown in the figure;

[0026] Figure 10 A flowchart of a 485 bus communication method of a household water machine control system 200 provided in the present application is shown in the figure. DETAILED DESCRIPTION

[0027] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0028] In the description of the present application, it should be understood that the terms "first", "second" are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.

[0029] In the description of the present application, it should be noted that, unless otherwise specified and limited, the term "coupling" should be understood broadly, for example, it can be fixedly connected, or detachably connected, or integrally connected; it can be mechanically connected, or electrically connected; it can be directly connected, or indirectly connected through an intermediate medium, or it can be the communication inside two elements. For those skilled in the art, the specific meaning of the above-mentioned term in the present application can be understood according to the specific circumstances. In addition, when describing pipelines or channels, the "connected" and "connected" used in the present application have the meaning of conducting. The specific meaning needs to be understood in combination with the context.

[0030] In the embodiments of the present application, the words "exemplary" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words "exemplary" or "for example" are intended to present the relevant concept in a specific manner.

[0031] The 485 bus multi-master communication means that multiple master devices can send data to the slave device. When the slave device sends data through the 485 bus, multiple master devices coupled with the 485 bus will receive the data sent by the slave device.

[0032] In a conventional multi-master communication process of a 485 bus, a random delay processing mode is used to solve the conflict problem of the 485 bus by using the random delay processing mode for the conflicting master device. The random delay processing is mainly determined by the idle waiting time of the master device through the random attribute information of the master device. The random attribute information includes at least one of the hardware parameters of the master device in the current environment and any random number in 0-255. For example, the hardware parameters of the master device in the current environment can be understood as the environment temperature of the master device, for example, it can be 20 degrees. For any master device in the plurality of master devices, the master device can send data to the slave device only when the idle time of the 485 bus is equal to the idle waiting time of the master device. The idle waiting time of the master device can be understood as the time required for the master device to wait for data transmission on the bus to the master device. The idle time of the 485 bus is equal to the idle waiting time of the master device, which can be understood as that there is no data transmission on the 485 bus within the idle waiting time of the master device.

[0033] If a master device needs to send data to a slave device, but the master device detects data transmission on the 485 bus within its idle waiting time, the master device needs to wait until the data transmission on the 485 bus is completed, and then determine the idle waiting time of the master device according to the random attribute information of the master device. And the master device can send data to the slave device only when the idle time of the 485 bus is equal to the idle waiting time determined by the master device and there is no data transmission on the 485 bus. For example, assuming that the idle waiting time of the master device with address 60 is 25 ms according to its random attribute information, and the idle waiting time of the master device with address 62 is 30 ms according to its random attribute information, when the idle time of the 485 bus reaches 30 ms, if the master device with address 60 starts to send data to the slave device, the master device with address 62 also needs to send data to the slave device. The master device with address 62 detects data transmission on the 485 bus when its idle waiting time reaches 30 ms, and the master device with address 62 needs to determine a new idle waiting time according to its random attribute information, for example, it can be 32 ms, after the data transmission of the master device with address 60 is completed. When the idle time of the 485 bus reaches 32 ms, the master device with address 62 can start to send data to the slave device.

[0034] However, when the idle waiting time of the master device with address 62 is equal to 32 ms, there may still be data transmission on the 485 bus at this time, and the master device with address 62 needs to determine a new idle waiting time according to its random attribute information again. When the conflict probability of the 485 bus is high, the master device with address 62 needs to determine the idle waiting time many times, resulting in low communication efficiency of the 485 bus.

[0035] Therefore, the application provides a communication method based on a 485 bus and a smart home system. When a conflict occurs in the 485 bus, the master device causing the conflict is preferentially processed. When the master device causing the conflict and the slave device complete data transmission, other master devices can send data to the slave device. The application does not need to determine the idle waiting time of the master device causing the conflict multiple times, and the communication efficiency of the 485 bus is improved.

[0036] As shown in Figure 1 , it is a 485 bus communication schematic diagram of a smart home system provided by the application. The smart home system includes a plurality of master devices 10, a slave device 11 and a 485 bus. The plurality of master devices 10 and the slave device 11 are coupled on the 485 bus. The number of the plurality of master devices 10 can be n, that is, the plurality of master devices 10 includes Figure 1 the master device 1, the master device 2 and the master device n shown in the figure, and n is an integer greater than or equal to 2. The number of the slave device 11 is only 1. Each master device 10 and slave device 11 is provided with a different device address.

[0037] For example, the smart home system herein can be a household water machine control system. The plurality of master devices 10 can be end temperature controllers. The slave device 11 can be a water temperature controller. The embodiments of the application can also be applied to other smart home systems other than the household water machine control system, and the plurality of master devices and slave devices in other smart home systems can also be other types of devices, and the application does not limit the types of the plurality of master devices and slave devices.

[0038] In the application, the master device 10 can send data information to the slave device 11 through the 485 bus, and the slave device 11 can operate the received data information sent by the master device 10. When the master device 10 sends data information to the slave device 11 through the 485 bus, the baud rate can be 9600 in the household water machine control system.

[0039] Taking the master device 10 as an end temperature controller and the slave device 11 as a water temperature controller as an example. The user sets a temperature information on the end temperature controller, and the end temperature controller sends the set temperature information to the water temperature controller. The water temperature controller operates the received set temperature information to obtain a temperature adjustment control instruction.

[0040] As shown in Figure 2 , it is a schematic diagram of a household water machine control system 200. The household water machine control system 200 includes a plurality of air discs 21, a plurality of end temperature controllers 22, a plurality of floor heating valves 23, a water temperature controller 24 and an outdoor unit 25. Figure 2 In the figure, n is the number of the plurality of air discs 21, the plurality of end temperature controllers 22 and the plurality of floor heating valves 23, and n is an integer greater than or equal to 2, for example, it can be 31.

[0041] The end temperature controller 22 is used to control the air disc 21 and the floor heating valve 23. For example, the user can set the temperature of the air disc 21 through the end temperature controller 22.

[0042] The water temperature controller 24 is used to control the outdoor unit 25. For example, the water temperature controller 24 can control the outdoor unit 25 to adjust the operation state of the compressor, so that the air disc 21 reaches the temperature set by the user.

[0043] For example, the user sets the temperature to 25 degrees on the end temperature controller 22, and the end temperature controller 22 sends the set temperature information to the water temperature controller 24. The water temperature controller 24 performs operations on the received set temperature information to obtain a temperature adjustment control instruction. The water temperature controller 24 sends the temperature adjustment control instruction obtained by the operation to the outdoor unit 25. The outdoor unit 25 adjusts the operation state of the compressor in the outdoor unit according to the temperature adjustment control instruction, so that the temperature of the air disc 21 reaches 25 degrees.

[0044] As shown in Figure 3 Fig. 1 is a flowchart of a 485 bus communication method provided by the present application.

[0045] 301. At least two master devices 10 in the plurality of master devices 10 simultaneously send data to the slave device 11.

[0046] Here, the data can be understood as a data frame. Taking the master device 10 as an end temperature controller and the slave device 11 as a water temperature controller as an example. The format of the data frame can be as shown in Table 1.

[0047] Table 1

[0048]

[0049] For example, two or more master devices 10 simultaneously send data to the slave device 11. For example, the master device 10 with device address 1 and the master device 10 with device address 3 simultaneously send data to the slave device 11.

[0050] 302. When the plurality of master devices 10 receives the data error indication sent by the slave device 11, at least two master devices 10 respectively determine the delay time for sending data according to the device address of the device itself, and the remaining master devices 10 in the plurality of master devices 10 except the at least two master devices 10 enter a waiting sending state.

[0051] In some embodiments, the delay time of each master device 10 corresponds to the numerical value of the device address of each master device itself. For example, the delay time of the master device 10 with device address 1 is 1 ms. The data frame of the data error indication here can be as shown in Table 2.

[0052] Table 2

[0053]

[0054] For example, when the master device 10 with device address 1 and the master device 10 with device address 3 send data frames to the slave device 11 at the same time, the 485 bus conflict occurs. The slave device 11 checks the received data frames from the master device 10 with device address 1 and the master device 10 with device address 3, and the error in parsing the data frames received by the slave device 11 from the master device 10 with device address 1 and the master device 10 with device address 3 occurs. At this time, the slave device 11 can send a data error indication to each master device 10 through the 485 bus, and the master device 10 with device address 1 and the master device 10 with device address 3 also receive the data frame of the data error indication sent by the slave device 11. The master device 10 with device address 1 and the master device 10 with device address 3 determine that the 485 bus conflict occurs when receiving the data frame of the data error indication, and the master device 10 with device address 1 and the master device 10 with device address 3 need to determine the delay time to try to send data again according to the delay time.

[0055] In which, the master device 10 with device address 1 determines the delay time as 1 ms according to the address of the device itself, and the master device 10 with device address 3 determines the delay time as 3 ms according to the address of the device itself. The remaining master devices 10 which do not send data also determine that the 485 bus conflict occurs at this time when receiving the data frame of the data error indication, and need to enter the waiting sending state, that is, the remaining master devices 10 do not send data.

[0056] 303、The first master device 10 with the shortest delay among the at least two master devices 10 sends data to the slave device 11 again when the first delay time of the first master device 10 itself arrives, and if the plurality of master devices 10 all receive the data correct indication, the master devices 10 other than the first master device 10 among the at least two master devices 10 send data again.

[0057] It needs to be understood that among the master devices 10 in conflict, the first master device 10 with the shortest delay time will send data first.

[0058] For example, when the number of master devices 10 in conflict is 2, the first delay time of the master device 10 with device address 1 is 1 ms, and the second delay time of the master device 10 with device address 3 is 3 ms, and since the first delay time 1 ms of the master device 10 with device address 1 is shorter than the second delay time 3 ms of the master device 10 with device address 3, the first master device 10 here can be understood as the master device 10 with device address 1.

[0059] At this time, the master device 10 with the device address of 1 first sends the data frame to the slave device 11 again after the delay of 1 ms. The slave device 11 will only receive the data frame sent by the master device 10 with the device address of 1 at the same time, and the slave device 11 correctly parses the data frame. The slave device 11 sends the data frame with the data correct indication to the plurality of master devices 10. If the plurality of master devices 10 all receive the data frame with the data correct indication, the master device 10 with the device address of 3 can immediately send the data frame in the format shown in Table 1 to the slave device 11 again.

[0060] The data frame with the data correct indication here can be as shown in Table 3.

[0061] Table 3

[0062]

[0063]

[0064] 304、When the plurality of master devices 10 all receive the data correct indication and determine that the 485 bus is idle for a preset period of time, the remaining master devices 10 start to send data to the slave device 11.

[0065] When the plurality of master devices 10 are in the waiting-to-send state, they are always in the receiving state. When the plurality of master devices 10 do not receive data within a preset period of time, it can be considered that the 485 bus is in an idle state at this time.

[0066] Since the baud rate of the 485 bus is 9600 when the master device 10 and the slave device 11 perform data transmission, the longest data frame in the data frame is 10 bytes, that is, the longest data transmission time of the master device 10 and the slave device 11 is about 10 ms. The preset period of time here can be 20 ms, for example. That is, when each of the plurality of master devices 10 does not receive data within 20 ms continuously, each of the plurality of master devices 10 can consider that the 485 bus is in an idle state at this time.

[0067] For example, when the data transmission of the master device 10 with the device address of 3 is completed, the slave device 11 sends the data frame with the data correct indication to the master device 10 with the device address of 3. If the plurality of master devices 10 all receive the data frame with the data correct indication and do not receive other data frames within 20 ms continuously at this time, the remaining master devices 10 except the master device 10 with the device address of 1 and the master device 10 with the device address of 3 can send data to the slave device 11.

[0068] Thus, in the present application, when at least two master devices 10 in the plurality of master devices 10 simultaneously send data to the slave device 11, a bus collision occurs. The slave device 11 cannot correctly parse the data sent by the at least two master devices 10, and sends a data error indication to the at least two master devices 10. When the plurality of master devices 10 receive the data error indication, the at least two master devices 10 respectively determine their own delay time according to the device address of the device. The first master device 10 with the shortest delay time in the at least two master devices 10 sends data to the slave device 11 again when the first delay time of the first master device 10 arrives. When the plurality of master devices 10 all receive the data correct indication, the master devices 10 other than the first master device 10 in the at least two master devices 10 send data again. That is, when a bus collision occurs, the master devices 10 that have collided are given priority to send data to the slave device 11 according to the length of the delay time. That is, when one of the master devices 10 that have collided sends data to the slave device 11 again, the remaining master devices 10 that have collided are in a waiting state. In this way, the plurality of master devices 10 that have collided can be sent data in turn according to the delay time. Compared with the low communication efficiency problem caused by the need for multiple random delay processing in the prior art, the present application prioritizes the processing of the master devices 10 that have collided, and after the plurality of master devices 10 that have collided have completed communication, the other master devices 10 initiate communication only after the bus is idle, which can avoid the problem that a certain master device 10 cannot complete communication due to a collision, and improves the communication efficiency of the 485 bus.

[0069] In the method flow described above Figure 3 , how to determine that the 485 bus idle time reaches the preset time period in step 304 can be as shown in Figure 4 .

[0070] As shown in Figure 4 , a bus idle detection mechanism provided by the present application is shown in the figure. The data confirmation can be understood as a data correct indication.

[0071] The master device 10 sending data can be understood as a master device 10 in the plurality of master devices 10 that is sending data to the slave device 11, for example, a master device 10 with a device address of 1. The master device 10 preparing to send data can be understood as a master device 10 in the plurality of master devices 10 other than the master device 10 that is sending data, which is sending data to the slave device 11, for example, a master device 10 with a device address of 3.

[0072] For example, when the master device 10 with the device address of 1 on the 485 bus is sending data to the slave device 11, the master device 10 with the device address of 3 cannot send data to the slave device 11 at this time. When the master device 10 with the device address of 1 receives the data correct indication sent by the slave device 11, i.e., the master device 10 with the device address of 1 completes the data sending to the slave device 11, the master device 10 with the device address of 3 can send data to the slave device 11. When the master device 10 with the device address of 3 waits for 20 ms and does not receive the data correct indication, i.e., the 485 bus is in the idle state, the master device 10 with the device address of 3 sends data to the slave device 11. When the master device 10 with the device address of 3 receives the data correct indication sent by the slave device 11, the master device 10 with the device address of 3 completes the data sending to the slave device 11.

[0073] Before the step 301, the following process can also be included in some embodiments.

[0074] For any master device 10 of the at least two master devices 10, when the master device 10 determines that no data from the slave device 11 is received within a preset time period, the master device 10 sends a first communication request to the slave device 11, and the first communication request is used for the master device 10 to request to send data to the slave device 11. The slave device 11 sends a first communication response to the master device 10, and the first communication response is used to indicate that the master device 10 is allowed to communicate with the slave device 11.

[0075] That is, before any master device 10 sends data to the slave device 11 when the bus is in the idle state, the master device 10 needs to send a communication request to the slave device 11 first, and after the slave device 11 allows the communication, the master device 10 can send data to the slave device 11.

[0076] As Figure 5 Fig. 4 shows a schematic diagram of the master device 10 initiating a communication request to the slave device 11 according to the present application.

[0077] As Figure 5 can be seen, when the master device 10 sends data to the slave device 11, the master device 10 first sends a communication request to the slave device 11, and after the slave device 11 receives the communication request, the slave device 11 sends a communication permission to the master device 10. After the master device 10 receives the communication permission, the master device 10 sends data to the slave device 11, and after the slave device 11 receives the data, the slave device 11 parses the data and sends the data confirmation result to the master device 10.

[0078] The first communication request can be understood as a data frame in which the master device 10 sends a communication request to the slave device 11, as shown in Table 4.

[0079] Table 4

[0080]

[0081] The first communication response can be understood as the slave device 11 sending a communication permission data frame to the master device 10, as shown in Table 5.

[0082] Table 5

[0083]

[0084] For example, the master device 10 with device address 1 and the master device 10 with device address 3 do not receive the data frame sent by the slave device 11 continuously within 20 ms. The master device 10 with device address 1 and the master device 10 with device address 3 send a communication application data frame to the slave device 11. After the slave device 11 receives the communication application data frame, it sends a first communication response data frame to the master device 10 with device address 1 and the master device 10 with device address 3. After the master device 10 with device address 1 and the master device 10 with device address 3 receive the first communication response data frame sent by the slave device 11, they can send data frames to the slave device 11.

[0085] In the method flow described above Figure 3 , at least two master devices 10 in the plurality of master devices 10 send data to the slave device simultaneously at step 301. Taking the example of two master devices 10 sending data to the slave device 11 simultaneously, it can be as shown in Figure 6 .

[0086] Figure 6 A schematic diagram of two master devices 10 sending data to the slave device 11 simultaneously is provided.

[0087] As shown in Figure 6It can be seen that when the master device 10 with the device address of 1 and the master device 10 with the device address of 3 send data to the slave device 11 at the same time, the master device 10 with the device address of 1 and the master device 10 with the device address of 3 first send a communication application to the slave device 11. After receiving the communication application, the slave device 11 sends a communication permission to the master device 10 with the device address of 1 and the master device 10 with the device address of 3. After receiving the communication permission, the master device 10 with the device address of 1 and the master device 10 with the device address of 3 send data to the slave device 11 at the same time. At this time, a bus conflict occurs, and the slave device 11 cannot correctly parse the data sent by the master device 10 with the device address of 1 and the master device 10 with the device address of 3. The slave device 11 sends a data error to the master device 10 with the device address of 1 and the master device 10 with the device address of 3. After receiving the data error, the master device 10 with the device address of 1 and the master device 10 with the device address of 3 re-initiate a communication application to the slave device 11 after a delay. That is, the master device 10 with the device address of 1 re-sends a communication application to the slave device 11. When the master device 10 with the device address of 1 receives the data confirmation sent by the slave device 11, the master device 10 with the device address of 3 immediately sends a communication application to the slave device 11.

[0088] On the basis of the above Figure 5 In some embodiments, the master device 10 sending a communication application to the slave device 11 can further include the following process.

[0089] If any master device 10 does not receive a first communication response within a first preset time interval after sending a first communication request, the master device 10 sends the first communication request to the slave device 11 again. If the number of times that any master device 10 repeatedly sends the first communication request to the slave device 11 reaches a first preset number of times and the first communication response is not received, after a second preset time interval, the master device 10 continues to send the first communication request to the slave device 11. If the number of times that any master device 10 repeatedly sends the first communication request to the slave device 11 reaches a second preset number of times and the first communication response is not received, the master device 10 determines that the communication is abnormal.

[0090] The first preset time interval here can be 5 ms, for example. That is, the master device 10 cannot exceed 5 ms from sending a data frame of a communication application to the slave device 11 to receiving a data frame of a communication permission sent by the slave device 11. The first preset number of times here can be 3, for example. The second preset number of times here can be 6, for example. The second preset time interval here = device address of the master device 10 / 2+10. For example, the second preset time interval of the master device 10 with the device address of 1 is 10.5 ms.

[0091] That is, if the master device 10 does not receive a communication response from the slave device 11, it will re-initiate a communication request to the slave device 11.

[0092] like Figure 7 The diagram shown is a communication schematic of a master device 10 re-initiating a communication request, as provided in this application.

[0093] For example, by Figure 7 Taking a data frame from master device 10 (device address 1) to slave device 11 requesting communication as an example: If master device 10 (device address 1) does not receive a communication permission data frame within 5ms after sending the data frame, it will send a second data frame. If master device 10 (device address 1) sends three consecutive first communication response data frames to slave device 11 without receiving a communication permission data frame, it will send a second data frame after 10.5ms. If master device 10 (device address 1) sends six consecutive communication request data frames to slave device 11 without receiving a communication permission data frame, it indicates a communication failure with master device 10 (device address 1).

[0094] In the above Figure 3 In the method flow, step 303, in which at least two of the multiple master devices 10, excluding the first master device, resend data, may also include the following process.

[0095] In some embodiments, for a second master device 10 other than the first master device 10 among at least two devices, the second master device 10 immediately sends a second communication request to the slave device 11. The second communication request is used by the second master device 10 to request the transmission of data to the slave device 11. The slave device 11 verifies the data received by the slave device 11, which includes the data sent by the second master device 10. If the verification by the slave device 11 fails, the slave device 11 sends a data error indication to the multiple master devices 10. The second master device 10 determines a second delay time for delaying data transmission based on its own device address, and retransmits the data to the slave device 11 when the second delay time expires.

[0096] The second communication request here can be understood as a data frame in which the master device 10 initiates a communication request to the slave device 11 again.

[0097] The second master device can be understood as master device 10 with device address 3. The second delay time is 3ms.

[0098] For example, when the master device 10 with device address 1 finishes sending data to the slave device 11, the master device 10 with device address 3 receives the data frame with data correct indication, and then sends a data frame with communication application to the slave device. After the slave device 11 receives the data frame with communication application sent by the master device 10 with device address 3, the slave device 11 sends a data frame with communication permission to the master device 10 with device address 3. After the master device 10 with device address 3 receives the data frame with communication permission, the master device 10 with device address 3 sends a data frame to the slave device 11. The slave device 11 receives the data frame sent by the master device 10 with device address 3, and checks the received data frame. If the slave device 11 fails to check the received data frame, the slave device 11 sends a data frame with data error indication to the master device 10 with device address 3. After the master device 10 with device address 3 receives the data frame with data error indication sent by the slave device 11, the master device 10 with device address 3 delays for 3 ms, and then sends a data frame to the slave device 11 again.

[0099] In the above embodiment, the process of checking the data received by the slave device 11 is shown in Figure 8

[0100] Figure 8 A flowchart of checking the data frame by the slave device 11 is provided in the present application.

[0101] 801. The slave device 11 receives the data frame sent by the master device 10.

[0102] 802. The slave device 11 determines whether the frame header of the data frame is correct.

[0103] The slave device 11 analyzes the received data frame, and compares the analyzed frame header of the data frame with the frame header of the received data frame. If they are consistent, it is determined that the frame header of the data frame is correct, and then step 803 is performed. If the analyzed frame header of the data frame is not consistent with the frame header of the received data frame, step 808 is performed.

[0104] 803. The slave device 11 determines whether the data length is correct.

[0105] The slave device 11 analyzes the received data frame, and compares the analyzed data length with the received data length. If they are consistent, it is determined that the data length is correct, and then step 804 is performed. If the analyzed data length is not consistent with the received data length, step 808 is performed.

[0106] 804. The slave device 11 determines whether the initiating device type is correct.

[0107] ​The slave device 11 parses the received data frame, and compares the parsed initiating device type with the received initiating device type. If they are consistent, it is determined that the initiating device type is correct, and then step 805 is performed. If the parsed initiating device type is inconsistent with the received initiating device type, step 808 is performed.

[0108] 805. The slave device 11 determines whether the receiving device type is correct.

[0109] The slave device 11 parses the received data frame, and compares the parsed receiving device type with the received receiving device type. If they are consistent, it is determined that the receiving device type is correct, and then step 806 is performed. If the parsed receiving device type is inconsistent with the received receiving device type, step 808 is performed.

[0110] 806. The slave device 11 determines whether the CRC check code is correct.

[0111] The slave device 11 parses the received data frame, and compares the parsed CRC check code with the received CRC check code. If they are consistent, it is determined that the CRC check code is correct, and then step 807 is performed. If the parsed CRC check code is inconsistent with the received CRC check code, step 808 is performed.

[0112] 807. The slave device 11 sends a data frame with a data correct indication to the master device 10.

[0113] 808. The slave device 11 sends a data frame with a data error indication to the master device 10.

[0114] In the above steps 802-806, if the slave device 11 parses the received data frame incorrectly, the following process can also be included.

[0115] As shown in Figure 9 , it is a schematic diagram of data parsing error provided by the present application.

[0116] As can be seen from Figure 9 , when the master device 10 sends data to the slave device 11, the master device 10 first sends a communication application to the slave device 11. After the slave device 11 receives the communication application, it sends a communication permission to the master device 10. After the master device 10 receives the communication permission, it sends data to the slave device 11. After the slave device 11 receives the data, it parses the data. When the master device 10 receives data parsing error, it re-sends data to the slave device 11. After the master device 10 receives data parsing correct, the communication ends.

[0117] Next, taking the household water machine control system 200 as an example, the 485 bus communication method of the present application is introduced. As shown in Figure 10Fig. 1 is a flow diagram of a 485 bus communication method of a household water heater control system 200 according to the present application.

[0118] 1001、When the 485 bus is in an idle state, the end temperature controller 1 and the end temperature controller 2 simultaneously send a data frame to the water temperature controller.

[0119] For example, when the end temperature controller 1 and the end temperature controller 2 do not receive a data frame with correct data analysis from the water temperature controller for 20 ms, the 485 bus is in an idle state. The end temperature controller 1 and the end temperature controller 2 simultaneously send a data frame with a frame header code of "A1" to the water temperature controller. The end temperature controller 1 and the end temperature controller 2 send different data frames with a frame header code of "A1" to the water temperature controller.

[0120] 1002、The water temperature controller allows the end temperature controller 1 and the end temperature controller 2 to send a data frame to the water temperature controller.

[0121] For example, the water temperature controller sends a data frame with a frame header code of "A2" to the end temperature controller 1 and the end temperature controller 2. That is, the water temperature controller allows the end temperature controller 1 and the end temperature controller 2 to send a data frame to the water temperature controller.

[0122] 1003、The end temperature controller 1 and the end temperature controller 2 simultaneously send a data frame to the water temperature controller.

[0123] For example, the end temperature controller 1 and the end temperature controller 2 simultaneously send a data frame with a frame header code of "51" to the water temperature controller. The end temperature controller 1 and the end temperature controller 2 send different data frames with a frame header code of "51" to the water temperature controller.

[0124] 1004、The water temperature controller sends a data frame with incorrect data analysis to n end temperature controllers.

[0125] For example, because the end temperature controller 1 and the end temperature controller 2 simultaneously send a data frame to the water temperature controller, the 485 bus is in conflict, and the water temperature controller analyzes the received data frame incorrectly. The n end temperature controllers are always in a receiving state, and the water temperature controller sends a data frame with a frame header code of "52" to the n end temperature controllers.

[0126] 1005、The end temperature controller 1 and the end temperature controller 2 receive a data frame with incorrect data analysis.

[0127] For example, the end temperature controller 1 and the end temperature controller 2 receive a data frame with a frame header code of "52".

[0128] 1006. Terminal thermostat 1 and terminal thermostat 2 determine the delay time based on their own device address, and send data to the water temperature controller in sequence according to the length of the delay time.

[0129] For example, assume that the device address of terminal thermostat 1 is 1 and the device address of terminal thermostat 2 is 2. Then, the delay time of terminal thermostat 1 is 1ms and the delay time of terminal thermostat 2 is 2ms. Since the delay time of terminal thermostat 1 is less than that of terminal thermostat 2, terminal thermostat 1 first sends a data frame with a header code of "51" to the water temperature controller. When terminal thermostat 1 receives a correct data frame with a header code of "52", terminal thermostat 2 then sends another data frame with a header code of "51" to the water temperature controller.

[0130] 1007. All n terminal thermostats received and correctly parsed data frames sent by the water temperature controller.

[0131] For example, when terminal thermostat 2 receives a data frame with a header code of "52" and the data is correct, all other terminal thermostats also receive data frames with a header code of "52" and the data is correct. That is, when all n terminal thermostats receive data frames with a header code of "52" and the data is correct, step 1008 is executed.

[0132] 1008. Other terminal thermostats besides terminal thermostat 1 and terminal thermostat 2 can send data frames to the water temperature controller.

[0133] For example, if any end thermostat other than end thermostat 1 and end thermostat 2 does not receive a correctly parsed data frame from the water temperature controller for 20 ms, it sends a data frame with a request frame header code of "A1" to the water temperature controller. If any end thermostat other than end thermostat 1 and end thermostat 2 receives a data frame with an allow frame header code of "A2" from the water temperature controller, then the other end thermostats can send a data frame to the water temperature controller again.

[0134] Based on the introduction of the 485 bus communication method, the application further provides a smart home system. The smart home system comprises a plurality of master devices, slave devices and a 485 bus, and the plurality of master devices and slave devices are coupled on the 485 bus. At least two master devices in the plurality of master devices are configured to simultaneously send data to the slave device. The at least two master devices are further configured to determine a delay time for delaying sending data according to the device address of the self device when receiving a data error indication sent by the slave device. The remaining master devices except the at least two master devices in the plurality of master devices are configured to enter a waiting sending state. A first master device with the shortest delay time in the at least two master devices is configured to send data to the slave device again when the first delay time of the self device arrives. The master devices except the first master device in the at least two master devices are configured to send data to the slave device again if a data correct indication is received. The remaining master devices are configured to start sending data to the slave device when a data correct indication is received and the idle time of the 485 bus reaches a preset time period.

[0135] In some embodiments, the delay time corresponding to each master device in the plurality of master devices is equal to the numerical value of the device address of the self device of each master device.

[0136] In some embodiments, any master device in the at least two master devices is configured to send a first communication request to the slave device when it is determined that no data from the slave device is received within a preset time period, and the first communication request is used for any master device to request sending data to the slave device. The slave device is configured to send a first communication response to any master device, and the first communication response is used to indicate that any master device is allowed to communicate with the slave device.

[0137] In some embodiments, the first communication request is sent to the slave device again if the first communication response is not received within a first preset time interval after the first communication request is sent. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a first preset number of times and the first communication response is not received, the first communication request is continued to be sent to the slave device after a second preset time interval. If the number of times that any master device repeatedly sends the first communication request to the slave device reaches a second preset number of times and the first communication response is not received, it is determined that the communication is abnormal.

[0138] In some embodiments, for a second master device of the at least two devices other than the first master device, a second communication request is configured to be sent to the slave device when no data from the slave device is received within a preset time period, the second communication request being used for the second master device to request to send data to the slave device. The slave device is configured to check data received by the slave device, the data received by the slave device including data sent by the second master device, and if the slave device fails to check, send a data error indication to the plurality of master devices. The second master device is configured to determine a second delay time for delaying sending data according to a device address of the device itself, and send the data to the slave device again when the second delay time arrives.

[0139] The smart home system may be, for example, a household water machine control system 200, which has been described above and will not be described here again.

[0140] Although the present application is described in conjunction with various embodiments, it will be understood clearly that many variations, modifications, additions and substitutions are possible, within the scope and spirit of the application, in conjunction with this disclosure, and in light of the foregoing teachings, many alternatives, modifications and variations of the present application will be suggested to those skilled in the art. The disclosure provided in this patent is not intended to be exhaustive or limited to the exact form disclosed. The disclosure provided in this patent is intended to cover any and all modifications within the scope and spirit of the application. Therefore, potential modifications and alternatives are to be tested by those skilled in the art to the extent they stay within the scope of the present application. In the claims, the word "comprising" does not exclude other elements or steps, and the indefinite articles "a" or "an" do not exclude a plurality. A single processor or other unit can fulfill the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to an advantage.

[0141] Although the present application is described in conjunction with specific features and embodiments thereof, it is evident that many alternatives, modifications and variations will be suggested to those skilled in the art in light of the foregoing teachings. Accordingly, it is intended to embrace future changes and modifications to the present application, and it is intended to include all such changes and modifications in the scope of the application. It is therefore intended that this application be construed as including all such changes and modifications as fall within the scope of the application. Obviously, many modifications and variations of the present application are possible in light of this teaching. It is intended that the scope of the application encompass each and every alternative, modification and variation that can fall within the scope of the present application. Accordingly, it should be understood that various changes can be made in the form, details, and / or implementations of the various embodiments of the application without departing from the spirit and scope of the application.

[0142] The above description is only specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A communication method based on a 485 bus, characterized in that, The method is applied to a smart home system, which includes multiple master devices, slave devices, and a 485 bus. The multiple master devices and the slave devices are coupled to the 485 bus. The method includes: At least two of the multiple master devices simultaneously send data to the slave device; When the plurality of master devices receive a data error indication sent by the slave device, at least two master devices each determine a delay time for sending data based on the value of their own device address, and the remaining master devices other than the at least two master devices enter a waiting state; the unit of the delay time is milliseconds; When the first master device with the shortest delay among the at least two master devices reaches its first delay time, it resends data to the slave device. If all the master devices receive the correct data indication, then the master devices other than the first master device among the at least two master devices resend data. Once all the master devices have received a correct data indication and it is determined that the 485 bus idle time has reached a preset time period, the remaining master devices begin to send data to the slave devices.

2. The method according to claim 1, characterized in that, The delay time value for each of the plurality of master devices is equal to the value of the device address of each master device itself.

3. The method according to claim 1 or 2, characterized in that, Before at least two of the plurality of master devices simultaneously send data to the slave device, the method further includes: For any one of the at least two master devices, when the master device determines that it has not received data from the slave device within the preset time period, the master device sends a first communication request to the slave device. The first communication request is used by the master device to request the slave device to send data. The slave device sends a first communication response to any of the master devices, the first communication response being used to indicate that any of the master devices allows communication with the slave device.

4. The method according to claim 3, characterized in that, Before the slave device sends the first communication response to either of the master devices, the method further includes: If any master device does not receive the first communication response within a first preset time interval after sending the first communication request, then any master device sends the first communication request to the slave device again. If any master device repeatedly sends the first communication request to the slave device a first preset number of times and does not receive the first communication response, after a second preset time interval, any master device continues to send the first communication request to the slave device. If any master device repeatedly sends the first communication request to the slave device a second preset number of times and does not receive the first communication response, the master device determines that the communication is abnormal.

5. The method according to claim 1, characterized in that, The at least two master devices, excluding the first master device, retransmit data including: For the second master device other than the first master device among the at least two master devices, the second master device immediately sends a second communication request to the slave device. The second communication request is used by the second master device to request the slave device to send data. The slave device verifies the data received by the slave device, which includes the data sent by the second master device. If the slave device fails to verify the data, the slave device sends a data error indication to the plurality of master devices. The second master device determines a second delay time for sending data based on its own device address, and sends data to the slave device again when the second delay time arrives.

6. A smart home system, characterized in that, The smart home system includes multiple master devices, slave devices, and a 485 bus, wherein the multiple master devices and the slave devices are coupled to the 485 bus; At least two of the plurality of master devices are configured to simultaneously send data to the slave device; The at least two master devices are also configured to determine the delay time for sending data based on the value of their own device address when they receive a data error indication sent by the slave device. Of the plurality of master devices, all but the at least two are configured to enter a waiting-to-send state; the delay time is in milliseconds. The first master device with the shortest delay among the at least two master devices is configured to send data to the slave device again when its first delay time is reached. The master device other than the first master device among the at least two master devices is configured to send data to the slave device again if it receives a correct data indication; The remaining master devices are configured to start sending data to the slave devices when they receive a correct data indication and determine that the 485 bus idle time has reached a preset time period.

7. The smart home system according to claim 6, characterized in that, The delay time value for each of the multiple master devices is equal to the value of the device address of each master device itself.

8. The smart home system according to claim 6 or 7, characterized in that, Any one of the at least two master devices is configured to send a first communication request to the slave device when it is determined that no data has been received from the slave device within the preset time period. The first communication request is used by the master device to request the slave device to send data. The slave device is configured to send a first communication response to any of the master devices, the first communication response being used to indicate that any of the master devices allows communication with the slave device.

9. The smart home system according to claim 8, characterized in that, Each of the master devices is further configured to: If the first communication response is not received within the first preset time interval after the first communication request is sent, the first communication request is sent to the slave device again. If any master device repeatedly sends the first communication request to the slave device a first preset number of times and does not receive the first communication response, it continues to send the first communication request to the slave device after a second preset time interval. If any master device repeatedly sends the first communication request to the slave device a second preset number of times and does not receive the first communication response, a communication anomaly is determined.

10. The smart home system according to claim 6, characterized in that, For the second master device other than the first master device among the at least two master devices, it is configured to send a second communication request to the slave device when it does not receive data from the slave device within the preset time period. The second communication request is used by the second master device to request the slave device to send data. The slave device is configured to verify the data received by the slave device, the data received by the slave device including the data sent by the second master device; if the slave device fails to verify, it sends a data error indication to the plurality of master devices. The second master device is configured to determine a second delay time for sending data based on its own device address, and to send data to the slave device again when the second delay time arrives.

Citation Information

Patent Citations

  • Shared-485 circuit and control method

    WO2023087986A1