Communication method, device, equipment and storage medium for electronic lock

By controlling the analog switch chip to detect and connect to peripheral modules, the problem of insufficient serial communication ports of the main control chip in the electronic lock is solved, multi-module communication is realized, and product functions and usage scenarios are improved.

CN116129557BActive Publication Date: 2025-03-28DESSMANN CHINA MACHINERY & ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211455106.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2025-03-28
Estimated Expiration
2042-11-21

AI Technical Summary

Technical Problem

The existing electronic locks cannot meet the module communication needs due to the few serial communication ports of the main control chip, resulting in the inability to arrange more modules and their functions are limited.

Method used

By controlling the analog switch chip, detecting the enable output pin level status of the peripheral module, identifying whether there is a module that actively pushes information to the main control chip, and communicating and connecting according to requirements, realizing duplex communication between the main control chip and multiple peripheral modules.

Benefits of technology

The purpose of laying multiple modules in the electronic lock is realized, product planning is enriched, product functions is improved, and the use scenarios of product functions is solved, and the scene layout bottleneck problem caused by baud rate curing of the main control chip is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116129557B_ABST
    Figure CN116129557B_ABST
Patent Text Reader

Abstract

The present invention provides a communication method and device, equipment, and storage medium for an electronic lock, the method comprising: sending a first control signal to a first analog switch chip to control an enable input pin to be connected to a first pin; detecting whether a second peripheral module exists in a plurality of first peripheral modules through the level states of a plurality of first pins; if a second peripheral module exists, sending a second control signal to a second analog switch chip to control a first information receiving pin on the second analog switch chip to be connected to a second pin on the second analog switch chip, so that the second peripheral module pushes communication information to a main control chip. The present invention can detect a module that pushes information to a main control chip by controlling the first analog switch chip; and can control the second analog switch chip to communicate and connect the main control chip with a corresponding module as required, so as to achieve the purpose of arranging multiple modules in an electronic lock, enrich product planning, and enhance the use scenarios of product functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic locks, and in particular to a communication method and device, equipment, and storage medium for electronic locks. Background Art

[0002] The main control chip of existing electronic locks is restricted by power consumption and cost, and has few serial communication ports, which cannot meet the needs of module communication. Currently, most of them use a single analog switch or multiplexer, which only supports communication initiated by the main control chip and cannot achieve full-duplex communication between the module and the main control chip. In addition, due to the fixed baud rate of the serial communication port of the main control chip, it will bring bottlenecks to the scene layout when business scenarios and products are constantly expanding, resulting in a decrease in the number of peripheral modules that can be deployed.

[0003] With regard to the problem in the above-mentioned related technologies that the electronic lock cannot be equipped with a large number of modules, resulting in limited functions of the electronic lock, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide a communication method and device, equipment, and storage medium for an electronic lock, so as to overcome the problem in the related art that the electronic lock cannot be equipped with more modules, resulting in limited functions of the electronic lock.

[0005] In order to achieve the above-mentioned object, a first aspect of an embodiment of the present invention provides a communication method for an electronic lock, which is applied to a main control chip of the electronic lock, wherein the main control chip is connected to an enable input pin on a first analog switch chip, and a plurality of enable output pins on the first analog switch chip are connected to a plurality of first peripheral modules in a one-to-one correspondence; the method comprises:

[0006] Sending a first control signal to the first analog switch chip to control the enable input pin to be connected to a first pin, where the first pin is one of the multiple enable output pins;

[0007] Detecting whether there is a second peripheral module in the plurality of first peripheral modules through the level states of the plurality of first pins; the second peripheral module is a first peripheral module for actively pushing communication information to the main control chip;

[0008] If the second peripheral module exists, a second control signal is sent to the second analog switch chip to control the first information receiving pin on the second analog switch chip to be connected to the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; the second pin is one of the multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, and the multiple first information sending pins are connected one-to-one with the multiple first peripheral modules.

[0009] The communication method for an electronic lock provided by the present invention can detect a module that actively pushes information to a main control chip by controlling a first analog switch chip; and can communicatively connect the main control chip with a corresponding peripheral module as required by controlling a second analog switch chip, so as to achieve the purpose of arranging multiple modules in the electronic lock, enrich the product planning, and enhance the usage scenarios of product functions.

[0010] Optionally, in a possible implementation manner of the first aspect, detecting whether there is a second peripheral module in a plurality of first peripheral modules by using level states of a plurality of the first pins includes:

[0011] If the level state of at least one of the first pins is a preset state, the first peripheral module corresponding to the at least one of the first pins is determined as a second peripheral module.

[0012] The communication method for an electronic lock provided by the present invention can realize the communication mode sent by the peripheral module by identifying the level state of the enable output pin of the peripheral module and determining whether the peripheral module has a request to actively push information to the main control chip, thereby solving the problem that the current communication mode that is mostly adopted is through a single analog switch or multiplexer, which only supports the communication mode initiated by the main control chip and cannot realize the duplex communication between the module and the main control chip.

[0013] Optionally, in a possible implementation manner of the first aspect, the method further includes:

[0014] A third control signal is sent to the first analog switch chip to control the connection between the square wave signal input pin on the first analog switch chip and the third pin on the first analog switch chip, wherein the third pin represents one of the multiple square wave signal output pins on the first analog switch chip, so as to identify the first baud rate of the second peripheral module through the signal state of the third pin; the square wave signal input pin is connected to the main control chip, and the multiple square wave signal output pins are connected to the multiple first peripheral modules in a one-to-one correspondence.

[0015] Optionally, in a possible implementation manner of the first aspect, after identifying the first baud rate of the second peripheral module through the signal state of the third pin, the method further includes:

[0016] Determine whether the first baud rate is the same as a preset baud rate, where the preset baud rate is the baud rate of the serial port communication of the main control chip;

[0017] If they are not the same, a mapping relationship between the first baud rate and the second peripheral module is established.

[0018] Optionally, in a possible implementation manner of the first aspect, controlling the first information receiving pin on the second analog switch chip to be connected to the second pin on the second analog switch chip includes:

[0019] Determining whether the first baud rate of the second peripheral module is the same as the preset baud rate;

[0020] If they are the same, controlling the first information receiving pin to be connected to the second pin;

[0021] If they are not the same, the preset baud rate of the main control chip is adjusted according to the first baud rate corresponding to the second peripheral module in the mapping relationship to make the baud rate of the second peripheral module the same as that of the main control chip, and then the first information receiving pin is controlled to be connected to the second pin.

[0022] The communication method for an electronic lock provided by the present invention identifies the baud rate of a peripheral module through a square wave signal output pin, establishes a mapping relationship between the first baud rate and the second peripheral module when it is determined that the first baud rate of the second peripheral module is different from the baud rate of the main control chip, and adjusts the baud rate of the main control chip according to the second baud rate corresponding to the second peripheral module in the mapping relationship, which can enrich product planning and improve the use scenarios of product functions, thereby solving the problem that the main control chip of the existing smart door lock will cause a scene layout bottleneck when the business scenarios and products are constantly expanded due to the baud rate solidification.

[0023] Optionally, in a possible implementation manner of the first aspect, the method further includes:

[0024] When there is preset communication information to be actively pushed to the third peripheral module, the third peripheral module is the first peripheral module that receives the preset communication information, then a fourth control signal is sent to the second analog switch chip to control the second information sending pin on the second analog switch chip to be connected to the fourth pin, and the fourth pin represents one of the multiple second information receiving pins on the second analog switch chip, so that the main control chip pushes the preset communication information to the third peripheral module; the second information sending pin is connected to the main control chip, and the multiple second information receiving pins are connected one-to-one with multiple first peripheral modules.

[0025] The communication method for an electronic lock provided by the present invention can realize communication between the main control chip and multiple peripheral modules by controlling the second analog switch chip to connect the information sending pin of the main control chip with the information receiving pin of the peripheral module, or connect the information receiving pin of the main control chip with the information sending pin of the peripheral module, thereby solving the problem that the main control chip of the existing electronic lock is restricted by power consumption and cost, has few serial communication ports, and cannot meet the module communication requirements.

[0026] Optionally, in a possible implementation of the first aspect, the electronic lock is a smart door lock.

[0027] A second aspect of an embodiment of the present invention provides a communication device for an electronic lock, characterized in that it includes:

[0028] A first sending module is used to send a first control signal to the first analog switch chip to control the enable input pin to be connected to the first pin, where the first pin is one of multiple enable output pins; the main control chip is connected to the enable input pin on the first analog switch chip, and the multiple enable output pins on the first analog switch chip are connected to multiple first peripheral modules in a one-to-one correspondence;

[0029] A module detection module, used for detecting whether there is a second peripheral module in a plurality of first peripheral modules through the level states of a plurality of the first pins; the second peripheral module is a first peripheral module used for actively pushing communication information to the main control chip;

[0030] The second sending module is used to send a second control signal to the second analog switch chip if the second peripheral module exists, so as to control the first information receiving pin on the second analog switch chip to be connected with the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; the second pin is one of multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, and the multiple first information sending pins are connected one-to-one with multiple first peripheral modules.

[0031] According to a third aspect of an embodiment of the present invention, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0032] According to a fourth aspect of an embodiment of the present invention, a readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the steps of the method of the first aspect of the present invention and various possible designs of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 This is a flow chart of a communication method for an electronic lock according to Embodiment 1 of the present invention.

[0035] Figure 2 is a schematic diagram of a first analog switch chip.

[0036] Figure 3 This is a schematic diagram of the main control chip of the electronic lock.

[0037] Figure 4 A schematic diagram of arranging multiple peripheral modules.

[0038] Figure 5 is a schematic diagram of a second analog switch chip.

[0039] Figure 6 A schematic diagram of switching multiple peripheral modules.

[0040] Figure 7 This is a principle block diagram of a communication device for an electronic lock according to Embodiment 2 of the present invention.

[0041] Figure 8 This is a structural diagram of the computer device in Example 3 of the present invention. DETAILED DESCRIPTION

[0042] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. 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.

[0043] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0044] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0045] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0046] Example 1

[0047] This embodiment provides a communication method for an electronic lock, which is applied to a main control chip of the electronic lock, such as Figure 1 As shown, the communication method includes the following steps but is not limited to step S100 to step S200.

[0048] S100: Send a first control signal to the first analog switch chip to control the enable input pin to be connected to the first pin, where the first pin is one of multiple enable output pins; the main control chip is connected to the enable input pin on the first analog switch chip, and the multiple enable output pins on the first analog switch chip are connected one-to-one with multiple first peripheral modules.

[0049] Specifically, the first analog switch chip is as follows: Figure 2 As shown in "U2", it includes an enable input pin (e.g. Figure 2"Uart_En_I nput") with multiple enable output pins (such as Figure 2 The enable input pin of the first analog switch chip is connected to the enable input pin of the main control chip, for example Figure 2 "Uart_En_I nput" and Figure 3 The multiple enable output pins of the first analog switch chip are connected to the enable output pins of the multiple first peripheral modules in a one-to-one correspondence, for example Figure 2 "M1_En_Output" and Figure 4 "M1_En_Output" connection, Figure 2 In "M2_En_Output" and Figure 4 "M2_En_Output" connection, Figure 2 In "M3_En_Output" and Figure 4 "M3_En_Output" connection, Figure 2 In "M4_En_Output" and Figure 4 In the "M4_En_Output" connection, there is no limit on the number of enable output pins of the first analog switch chip, and it can be set according to actual conditions.

[0050] S200: Detecting whether there is a second peripheral module in the plurality of first peripheral modules through the level states of the plurality of first pins; the second peripheral module is a first peripheral module for actively pushing communication information to the main control chip.

[0051] Step S200 includes the following steps:

[0052] S210: If the level state of at least one first pin is a preset state, determine the first peripheral module corresponding to the at least one first pin as the second peripheral module.

[0053] Specifically, the preset level can be a high level or a low level. When the level of the enable output pin of any one or more first peripheral modules is the preset level, the main control chip can obtain the preset level signal through "the connection between the enable output pin of the first peripheral module and the enable output pin of the first analog switch, and the connection between the enable output pin of the first analog switch and the enable input pin of the main control chip". Therefore, it can be determined that the first peripheral module or multiple first peripheral modules have a request to actively push communication information to the main control chip, and then the first peripheral module that outputs the preset level signal can be determined as the second peripheral module.

[0054] The communication method for an electronic lock provided by the present invention can realize the communication mode sent by the peripheral module by identifying the level state of the enable output pin of the peripheral module and determining whether the peripheral module has a request to actively push information to the main control chip, thereby solving the problem that the current communication mode that is mostly adopted is through a single analog switch or multiplexer, which only supports the communication mode initiated by the main control chip and cannot realize the duplex communication between the module and the main control chip.

[0055] S300: If there is a second peripheral module, a second control signal is sent to the second analog switch chip to control the first information receiving pin on the second analog switch chip to be connected to the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; the second pin is one of the multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, and the multiple first information sending pins are connected one-to-one with the multiple first peripheral modules.

[0056] Specifically, the second analog switch chip is as follows: Figure 5 As shown in "U3", it includes a first information receiving pin (eg Figure 5 "Uart_RX") and multiple first information sending pins (such as Figure 5 The first information receiving pin of the first analog switch chip is connected to the information receiving pin of the main control chip, for example Figure 5 In the "Uart_RX" Figure 3 The first information sending pin of the first analog switch chip is connected to the information sending pin of the first peripheral module, for example Figure 5 In "M1_Uart_TX" and Figure 4 "M1_Uart_TX" connection, Figure 5 In "M2_Uart_TX" and Figure 4 "M2_Uart_TX" connection, Figure 5 In "M3_Uart_TX" and Figure 4 "M3_Uart_TX" connection, Figure 5 In "M4_Uart_TX" and Figure 4 In the "M4_Uart_TX" connection, the number of information sending pins of the second analog switch chip is not limited and can be set according to actual conditions. The model of the first analog switch chip and the second analog switch chip can be 74hc4052.

[0057] Specifically, when using the first analog switch chip (eg Figure 2After the second peripheral module is determined by detecting the level state of the first target enable output pin, the second analog switch chip (e.g. Figure 5 By connecting the first information receiving pin of the second analog switch chip to the second pin (the second pin corresponds to the second peripheral module), the information receiving pin of the main control chip and the information sending pin of the second peripheral module can be connected, thereby achieving the purpose of the second peripheral module actively pushing communication information to the main control chip.

[0058] More specifically, considering that the main control chip of the existing electronic lock generally adopts a single-channel serial communication (for example Figure 5 The "Uart_RX" (information receiving pin) and "Uart_TX" (information sending pin) in the embodiment can only realize a one-to-one communication mode between the main control chip and the peripheral module, and cannot meet the communication requirements of multiple peripheral modules and the main control chip in actual application scenarios. Therefore, the present invention designs an analog switch chip, such as Figure 6 As shown, it can be understood as a single-pole multi-throw analog switch chip for switching, which can make the original single-channel serial communication simulate multi-channel serial communication, so as to use the analog switch to switch the serial communication pin of the corresponding peripheral module according to the actual situation, and connect the serial communication pin of the peripheral module with the serial communication pin of the main control chip, that is, the information sending pin of the peripheral module is connected to the information receiving pin of the main control chip, or the information receiving pin of the peripheral module is connected to the information sending pin of the main control chip, so as to perform full-duplex communication information transmission between the main control chip and the corresponding peripheral module.

[0059] Preferably, the method also includes: sending a third control signal to the first analog switch chip to control the connection between the square wave signal input pin on the first analog switch chip and the third pin on the first analog switch chip, the third pin representing one of the multiple square wave signal output pins on the first analog switch chip, so as to identify the first baud rate of the second peripheral module through the signal state of the third pin; the square wave signal input pin is connected to the main control chip, and the multiple square wave signal output pins are connected one-to-one with the multiple first peripheral modules.

[0060] Specifically, the first analog switch chip is as follows: Figure 2 As shown in "U2", it also includes a square wave signal input pin (for example Figure 2 "Uart_Band_I nput") and multiple square wave signal output pins (such as Figure 2 The square wave signal input pin on the first analog switch chip is connected to the square wave signal input pin on the main control chip, for example Figure 2 "Uart_Band_Input" and Figure 3 The plurality of square wave signal output pins on the first analog switch chip are connected to the square wave signal output pins of the plurality of first peripheral modules in a one-to-one correspondence, for example Figure 2 "M1_Band_Output" and Figure 4 "M1_Band_Output" connection, Figure 2 In "M2_Band_Output" and Figure 4 "M2_Band_Output" connection, Figure 2 In "M3_Band_Output" and Figure 4 "M3_Band_Output" connection, Figure 2 In "M4_Band_Output" and Figure 4 In the "M4_Band_Output" connection, there is no limit on the number of square wave signal output pins of the first analog switch chip, and they can be set according to actual conditions.

[0061] Specifically, the baud rate indicates the number of code symbols transmitted per unit time. It is a measure of the symbol transmission square wave signal. It is expressed by the number of times the carrier modulation state changes per unit time. The baud rate refers to the number of symbols transmitted per unit time.

[0062] Specifically, since the square wave signal input pin of the first analog switch chip is connected to the square wave signal input pin of the main control chip, and the square wave signal output pin of the first analog switch chip is connected to the square wave signal output pin of the first peripheral module, the main control chip can connect the square wave signal input pin of the first analog switch chip to the first target square wave signal output pin of the first analog switch chip (the square wave signal output pin corresponds to the second peripheral module) through the first analog switch chip to identify the baud rate of the second peripheral module.

[0063] Preferably, after identifying the first baud rate of the second peripheral module through the signal state of the third pin, it also includes: judging whether the first baud rate is the same as the preset baud rate, the preset baud rate is the baud rate of the serial port communication of the main control chip; if they are not the same, establishing a mapping relationship between the first baud rate and the second peripheral module; if they are the same, sending a control signal to the second analog switch chip to control the first information receiving pin on the second analog switch chip to be connected with the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip.

[0064] Preferably, controlling the first information receiving pin on the second analog switch chip to be connected to the second pin on the second analog switch chip comprises:

[0065] Determine whether the first baud rate of the second peripheral module is the same as the preset baud rate; if they are the same, control the first information receiving pin to be connected to the second pin; if they are not the same, adjust the preset baud rate of the main control chip according to the first baud rate corresponding to the second peripheral module in the mapping relationship, so that the baud rate of the second peripheral module is the same as that of the main control chip, and then control the first information receiving pin to be connected to the second pin.

[0066] Specifically, since serial communication is to be realized between the main control chip and the peripheral module, the baud rates set by the information receiving / sending pins must be the same, otherwise serial communication cannot be realized. Therefore, in order to prevent the main control chip and the peripheral module from being unable to communicate due to the inconsistent baud rates set by the information receiving / sending pins of the two when serial communication is needed, affecting the user experience, the present invention identifies the first baud rate of the second peripheral module through the signal state of the third pin, and when the first baud rate of the second peripheral module is different from the baud rate of the main control chip, a mapping relationship between the first baud rate and the second peripheral module is established, so that when the second peripheral module needs to push information with the main control chip in the future, the baud rate of the main control chip can be adjusted according to the mapping relationship, thereby realizing the information transmission between the second peripheral module and the main control chip.

[0067] The communication method for an electronic lock provided by the present invention identifies the baud rate of a peripheral module through a square wave signal output pin, establishes a mapping relationship between the first baud rate and the second peripheral module when it is determined that the first baud rate of the second peripheral module is different from the baud rate of the main control chip, and adjusts the baud rate of the main control chip according to the second baud rate corresponding to the second peripheral module in the mapping relationship, which can enrich product planning and improve the use scenarios of product functions, thereby solving the problem that the main control chip of the existing smart door lock will cause a scene layout bottleneck when the business scenarios and products are constantly expanded due to the baud rate solidification.

[0068] Preferably, the method also includes: when there is preset communication information to be actively pushed to the third peripheral module, the third peripheral module is the first peripheral module that receives the preset communication information, then a fourth control signal is sent to the second analog switch chip to control the second information sending pin on the second analog switch chip to be connected to the fourth pin, and the fourth pin represents one of the multiple second information receiving pins on the second analog switch chip, so that the main control chip pushes the preset communication information to the third peripheral module; the second information sending pin is connected to the main control chip, and the multiple second information receiving pins are connected one-to-one with the multiple first peripheral modules.

[0069] Specifically, in actual application scenarios, when the main control chip needs to actively push information to the target peripheral module, the second analog switch chip can be controlled to connect the second information sending pin of the second analog switch chip with the fourth pin, so as to achieve the purpose of the main control chip pushing communication information to the target peripheral module through the second information sending pin and the fourth pin.

[0070] The communication method for an electronic lock provided by the present invention can realize communication between the main control chip and multiple peripheral modules by controlling the second analog switch chip to connect the information sending pin of the main control chip with the information receiving pin of the peripheral module, or connect the information receiving pin of the main control chip with the information sending pin of the peripheral module, thereby solving the problem that the main control chip of the existing electronic lock is restricted by power consumption and cost, has few serial communication ports, and cannot meet the module communication requirements.

[0071] Preferably, the electronic lock comprises a smart door lock.

[0072] Preferably, the method further comprises: inspecting the plurality of peripheral modules in sequence through the first analog switch chip and the second analog switch chip, Figure 6 The details are as follows:

[0073] Step 1: When inspecting peripheral module 1, the main control chip will control the first analog switch chip to connect the enable input pin of the main control chip with the enable output pin of peripheral module 1, and judge whether peripheral module 1 has a request to actively report communication information to the main control chip according to the level state of the enable output pin. If yes, the second analog switch chip will be controlled to connect the information receiving pin of the main control chip with the information sending pin of peripheral module 1, so that the peripheral module 1 actively reports communication information to the main control chip;

[0074] Step 2: When inspecting peripheral module 1, if the main control chip actively sends communication information to peripheral module 1, the second analog switch chip is controlled to connect the information sending pin of the main control chip with the information receiving pin of peripheral module 1, so that the main control chip actively transmits communication information to peripheral module 1.

[0075] Step 3: Before controlling the second analog switch chip to connect the information receiving pin of the main control chip with the information sending pin of the peripheral module 1, or connecting the information sending pin of the main control chip with the information receiving pin of the peripheral module 1, it also includes: the main control chip will control the first analog switch chip to connect the square wave signal input pin of the main control chip with the square wave signal output pin of the peripheral module 1, and judge whether the baud rate of the peripheral module 1 is the same as the baud rate of the main control chip according to the signal state of the square wave signal output pin of the peripheral module 1. If they are not the same, the baud rate of the main control chip needs to be adjusted according to the baud rate of the peripheral module 1, thereby realizing full-duplex communication between the peripheral module and the main control chip.

[0076] After executing the above steps 1 to 3, the main control chip will switch to peripheral module 2 for inspection, and then repeat the above steps 1 to 3; in this way, all peripheral modules are inspected in turn. After inspecting peripheral module n, continue to inspect peripheral module 1, and continuously and repeatedly inspect all peripheral modules.

[0077] The communication method for an electronic lock provided by the present invention can detect a module that actively pushes information to a main control chip by controlling a first analog switch chip; and can communicatively connect the main control chip with a corresponding peripheral module as required by controlling a second analog switch chip, so as to achieve the purpose of arranging multiple modules in the electronic lock, enrich the product planning, and enhance the usage scenarios of product functions.

[0078] Example 2

[0079] This embodiment provides a communication device for an electronic lock, such as Figure 7 As shown, including:

[0080] A first sending module is used to send a first control signal to the first analog switch chip to control the enable input pin to be connected to the first pin, the first pin is one of the multiple enable output pins; the main control chip is connected to the enable input pin on the first analog switch chip, and the multiple enable output pins on the first analog switch chip are connected to the multiple first peripheral modules in a one-to-one correspondence;

[0081] A module detection module, used for detecting whether there is a second peripheral module in a plurality of first peripheral modules through the level states of a plurality of first pins; the second peripheral module is a first peripheral module used for actively pushing communication information to the main control chip;

[0082] The second sending module is used to send a second control signal to the second analog switch chip if there is a second peripheral module, so as to control the first information receiving pin on the second analog switch chip to be connected with the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; the second pin is one of the multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, and the multiple first information sending pins are connected one-to-one with the multiple first peripheral modules.

[0083] Preferably, the module detection module includes:

[0084] The module detection unit is used to determine the first peripheral module corresponding to the at least one first pin as the second peripheral module if the level state of the at least one first pin is a preset state.

[0085] Preferably, the communication device for the electronic lock further comprises:

[0086] The third sending module is used to send a third control signal to the first analog switch chip to control the square wave signal input pin on the first analog switch chip to be connected to the third pin on the first analog switch chip, where the third pin represents one of multiple square wave signal output pins on the first analog switch chip, so as to identify the first baud rate of the second peripheral module through the signal state of the third pin; the square wave signal input pin is connected to the main control chip, and the multiple square wave signal output pins are connected one-to-one with the multiple first peripheral modules.

[0087] Preferably, the communication device for the electronic lock further comprises:

[0088] The mapping relationship establishing module is used to determine whether the first baud rate is the same as the preset baud rate, the preset baud rate is the baud rate of the serial port communication of the main control chip; if they are not the same, a mapping relationship between the first baud rate and the second peripheral module is established.

[0089] Preferably, the second sending module includes:

[0090] A baud rate determination unit, used to determine whether the first baud rate of the second peripheral module is the same as the preset baud rate;

[0091] A first control unit, used for controlling the first information receiving pin to be connected to the second pin if they are the same;

[0092] The second control unit is used to adjust the preset baud rate of the main control chip according to the first baud rate corresponding to the second peripheral module in the mapping relationship if they are not the same, so that the baud rate of the second peripheral module is the same as that of the main control chip, and then control the first information receiving pin to be connected with the second pin.

[0093] Preferably, the communication device for the electronic lock further comprises:

[0094] The fourth sending module is used to send a fourth control signal to the second analog switch chip when there is preset communication information to be actively pushed to the third peripheral module, and the third peripheral module is the first peripheral module that receives the preset communication information, so as to control the second information sending pin on the second analog switch chip to be connected with the fourth pin, and the fourth pin represents one of the multiple second information receiving pins on the second analog switch chip, so that the main control chip pushes the preset communication information to the third peripheral module; the second information sending pin is connected to the main control chip, and the multiple second information receiving pins are connected one-to-one with the multiple first peripheral modules.

[0095] Preferably, the electronic lock is a smart door lock.

[0096] Example 3

[0097] The present invention also provides a computer device, such as Figure 8 As shown, it includes a memory and a processor, the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the communication method for the electronic lock provided by the above-mentioned various embodiments is implemented.

[0098] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the communication method for an electronic lock provided in the above-mentioned various embodiments is implemented.

[0099] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0100] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0101] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0103] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.

Claims

1. A communication method for an electronic lock, characterized in that: A main control chip applied to an electronic lock, the main control chip is connected to an enable input pin on a first analog switch chip, and a plurality of enable output pins on the first analog switch chip are connected one-to-one with a plurality of first peripheral modules; the method comprises: Sending a first control signal to the first analog switch chip to control the enable input pin to be connected to a first pin, where the first pin is one of the multiple enable output pins; Detecting whether there is a second peripheral module in the plurality of first peripheral modules through the level states of the plurality of first pins; the second peripheral module is a first peripheral module for actively pushing communication information to the main control chip; If the second peripheral module exists, a second control signal is sent to the second analog switch chip to control the connection between the first information receiving pin on the second analog switch chip and the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; the second pin is one of the multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, the multiple first information sending pins are connected one-to-one with the multiple first peripheral modules, and the first analog switch chip and the second analog switch chip are single-pole multi-throw analog switch chips for switching.

2. The communication method for an electronic lock according to claim 1, characterized in that: The detecting whether there is a second peripheral module in a plurality of first peripheral modules by using the level states of the plurality of first pins includes: If the level state of at least one of the first pins is a preset state, the first peripheral module corresponding to the at least one of the first pins is determined as a second peripheral module.

3. The communication method for an electronic lock according to claim 1 or 2, characterized in that: The method further comprises: A third control signal is sent to the first analog switch chip to control the connection between the square wave signal input pin on the first analog switch chip and the third pin on the first analog switch chip, wherein the third pin represents one of the multiple square wave signal output pins on the first analog switch chip, so as to identify the first baud rate of the second peripheral module through the signal state of the third pin; the square wave signal input pin is connected to the main control chip, and the multiple square wave signal output pins are connected to the multiple first peripheral modules in a one-to-one correspondence.

4. The communication method for an electronic lock according to claim 3, characterized in that: After identifying the first baud rate of the second peripheral module by the signal state of the third pin, the method further includes: Determine whether the first baud rate is the same as a preset baud rate, where the preset baud rate is the baud rate of the serial port communication of the main control chip; If they are not the same, a mapping relationship between the first baud rate and the second peripheral module is established.

5. The communication method for electronic lock according to claim 4, characterized in that: The controlling the first information receiving pin on the second analog switch chip to be connected with the second pin on the second analog switch chip comprises: Determining whether the first baud rate of the second peripheral module is the same as the preset baud rate; If they are the same, controlling the first information receiving pin to be connected to the second pin; If they are not the same, the preset baud rate of the main control chip is adjusted according to the first baud rate corresponding to the second peripheral module in the mapping relationship to make the baud rate of the second peripheral module the same as that of the main control chip, and then the first information receiving pin is controlled to be connected to the second pin.

6. The communication method for electronic lock according to claim 1 or 2, characterized in that: The method further comprises: When there is preset communication information to be actively pushed to the third peripheral module, the third peripheral module is the first peripheral module that receives the preset communication information, then a fourth control signal is sent to the second analog switch chip to control the second information sending pin on the second analog switch chip to be connected to the fourth pin, and the fourth pin represents one of the multiple second information receiving pins on the second analog switch chip, so that the main control chip pushes the preset communication information to the third peripheral module; the second information sending pin is connected to the main control chip, and the multiple second information receiving pins are connected one-to-one with multiple first peripheral modules.

7. The communication method for an electronic lock according to claim 1, characterized in that: The electronic lock is a smart door lock.

8. A communication device for an electronic lock, characterized in that: include: A first sending module is used to send a first control signal to the first analog switch chip to control the enable input pin to be connected to the first pin, where the first pin is one of multiple enable output pins; the main control chip is connected to the enable input pin on the first analog switch chip, and the multiple enable output pins on the first analog switch chip are connected to the multiple first peripheral modules in a one-to-one correspondence; A module detection module, used for detecting whether a second peripheral module exists in a plurality of first peripheral modules according to the level states of a plurality of the first pins; The second peripheral module is a first peripheral module for actively pushing communication information to the main control chip; a second sending module, configured to send a second control signal to the second analog switch chip if the second peripheral module exists, so as to control the first information receiving pin on the second analog switch chip to be connected with the second pin on the second analog switch chip, so that the second peripheral module pushes communication information to the main control chip; The second pin is one of the multiple first information sending pins on the second analog switch chip, the first information receiving pin is connected to the main control chip, the multiple first information sending pins are connected one-to-one with the multiple first peripheral modules, and the first analog switch chip and the second analog switch chip are single-pole multi-throw analog switch chips for switching.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, wherein: When the processor executes the computer program, the steps of the communication method for an electronic lock according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the communication method for an electronic lock according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Terminal equipment, line connection method and device and storage medium

    CN111897762A

  • Master control device capable of flexibly switching audio modes, control method and medium

    CN115334408A