Method for setting device address, electronic device and chip
By detecting the magnetic field information of the slave unit in the IIC and I3C bus systems and setting a unique device address, the communication problem caused by the use of the same address by multiple slave units is solved, and normal communication between the master unit and the slave unit is realized.
Patent Information
- Application Number
- CN202510540735.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-25
AI Technical Summary
In IIC and I3C bus systems, multiple slave units use the same device address, which makes the host units indistinguishable, thereby affecting communication.
By receiving the address setting command of the host unit, the driving coil generates a magnetic field, and uses the magnetic field sensor to detect the magnetic field information, and set the device address of the slave unit according to the magnetic field information, so that it is different from the addresses of other slave units.
Ensure the uniqueness of the device address of each slave unit, solve the problem of device address conflict, and ensure the normal communication between the host unit and the slave unit.
Smart Images

Figure CN120448313A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of communications, and in particular to a method for setting a device address, an electronic device, and a chip. Background Art
[0002] Currently, master-slave buses, such as the IIC (Inter-Integrated Circuit) bus and the I3C (Improved Inter-Integrated Circuit) bus, support multiple slave units. A master unit connected to the bus distinguishes these slave devices by their device addresses, thereby communicating with the corresponding slave devices over the bus. However, if multiple slave units on the bus use the same device address, the master unit cannot distinguish the slave units by device address, thus affecting communication between the master and slave units. Summary of the Invention
[0003] In view of this, an embodiment of the present application provides a method for setting a device address to at least partially solve the above-mentioned problem.
[0004] An embodiment of the present application provides a method for setting a device address for a slave unit of an electronic device, wherein the electronic device includes a host unit and multiple slave units, each of the slave units being connected to at least one coil; the method includes: receiving an address setting instruction sent by the host unit, driving one or more connected coils to generate a magnetic field according to the address setting instruction, and detecting magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by each slave unit driving the corresponding coil is different; and setting the device address of the slave unit itself according to the magnetic field information, so that the device address of the slave unit itself is different from the device addresses of other slave units.
[0005] In a possible implementation manner, the magnetic field information includes magnetic field direction and / or magnetic field intensity.
[0006] In one possible implementation, the slave unit of the electronic device includes a first slave unit and a second slave unit having the same original device address; the magnetic field information includes a magnetic field direction, the first connection end of the first slave unit is connected to the first connection end of the first coil, and the second connection end of the first slave unit is connected to the second connection end of the first coil; the first connection end of the second slave unit is connected to the second connection end of the second coil, and the second connection end of the second slave unit is connected to the first connection end of the second coil, and the winding direction of the first coil from the first connection end to the second connection end is the same as the winding direction of the second coil from the first connection end to the second connection end.
[0007] In one possible implementation, the slave unit of the electronic device includes a first slave unit and a second slave unit having the same original device address; the magnetic field information includes a magnetic field direction, the first connection end of the first slave unit is connected to the first connection end of the first coil, and the second connection end of the first slave unit is connected to the second connection end of the first coil; the first connection end of the second slave unit is connected to the first connection end of the second coil, and the second connection end of the second slave unit is connected to the second connection end of the second coil, and the winding direction of the first coil from the first connection end to the second connection end is opposite to the winding direction of the second coil from the first connection end to the second connection end.
[0008] In one possible implementation, setting the device address of the slave unit itself based on the magnetic field information includes: determining the setting parameters corresponding to the magnetic field information based on the magnetic field information and preset mapping information; wherein the mapping information is used to indicate the correspondence between the magnetic field information and the setting parameters, and different magnetic field information corresponds to different setting parameters; and setting the device address based on the determined setting parameters.
[0009] In a possible implementation, setting the device address according to the determined setting parameter includes: setting a predetermined number of bits of data in the original device address as the determined setting parameter.
[0010] In a possible implementation, the direction of the magnetic field includes a first direction and a second direction, and the first direction and the second direction are opposite.
[0011] In one possible implementation, the electronic device includes a motor, and the coil is used to drive a magnet in the motor to move; the driving of one or more connected coils to generate a magnetic field according to the address setting instruction, and detecting magnetic field information of the generated magnetic field through a magnetic field sensor, includes: outputting a first current to the coil according to the address setting instruction to drive the coil to generate a first magnetic field, wherein the first magnetic field is used to make the movement of the magnet reach a maximum stroke; detecting the first magnetic field through the magnetic field sensor to obtain a detection signal corresponding to the first magnetic field; outputting a second current to the coil to drive the coil to generate a second magnetic field, wherein the direction of the second current is the same as the direction of the first current, the current value of the second current is different from the current value of the first current, and the second magnetic field is also used to make the movement of the magnet reach the maximum stroke; detecting the second magnetic field through the magnetic field sensor to obtain a detection signal corresponding to the second magnetic field; performing a difference operation on the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field to obtain a difference signal, and determining the magnetic field information based on the difference signal.
[0012] In one possible implementation, the output end of the magnetic field sensor is connected to a signal amplification circuit and an analog-to-digital conversion circuit; the detecting the first magnetic field by the magnetic field sensor to obtain a detection signal corresponding to the first magnetic field includes: detecting the first magnetic field by the magnetic field sensor to obtain an initial detection signal output by the magnetic field sensor, amplifying the initial detection signal by the signal amplification circuit to obtain an amplified signal corresponding to the initial detection signal, and performing analog-to-digital conversion on the amplified signal by the analog-to-digital conversion circuit to obtain a detection signal corresponding to the first magnetic field.
[0013] An embodiment of the present application also provides a method for setting a device address, which is used for a host unit of an electronic device, wherein the electronic device includes the host unit and multiple slave units, each of the slave units being connected to at least one coil; the method includes: sending an address setting instruction to multiple slave units with the same device address, so that when the slave unit receives the address setting instruction sent by the host unit, it drives one or more connected coils to generate a magnetic field according to the address setting instruction, and detects the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by each slave unit driving the corresponding coil is different; and according to the magnetic field information, setting the device address of the slave unit itself, so that the device address of the slave unit itself is different from the device addresses of other slave units.
[0014] In one possible implementation, the method further includes: obtaining preset device address setting information; the device address setting information includes the device address set for each of the slave units; sending an authentication instruction to multiple slave units with the same device address based on the set device address, and determining the slave unit corresponding to each of the set device addresses based on the response of each slave unit.
[0015] An embodiment of the present application also provides a method for setting a device address. An electronic device includes a host unit and multiple slave units, each of which is connected to at least one coil; the host unit is used to send an address setting instruction to multiple slave units with the same device address; the slave unit is used to receive the address setting instruction sent by the host unit, drive one or more connected coils to generate a magnetic field according to the address setting instruction, and detect the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by each slave unit driving the corresponding coil is different; according to the magnetic field information, the device address of the device is set to make its own device address different from the device addresses of other slave units.
[0016] An embodiment of the present application also provides a chip for executing the method described in any of the above embodiments.
[0017] In an embodiment of the present application, the method for setting a device address can be used for a slave unit of an electronic device, so that the slave unit receives an address setting instruction sent by a host unit, drives one or more connected coils to generate a magnetic field according to the address setting instruction, and detects the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein, the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different. According to the magnetic field information, the device address of the slave unit itself is set so that the device address of the slave unit itself is different from the device addresses of other slave units. The difference in the magnetic field information of the coils connected to different slave units can be used to enable the slave unit to set its own device address, ensuring the uniqueness of the device address of each slave unit, thereby solving the problem of the same device address of the slave units, enabling the host unit to distinguish the slave units by the device address, and ensuring normal communication between the host unit and the slave unit. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0019] Figure 1This is a flowchart of a method for setting a device address provided in an optional embodiment of the present application;
[0020] Figure 2 This is a schematic diagram of the magnetic field direction of a coil generating a magnetic field provided in an optional embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a first slave unit and a first coil provided in an optional embodiment of the present application;
[0022] Figure 4 is a schematic diagram of a second slave unit and a second coil provided in an optional embodiment of the present application;
[0023] Figure 5 is a schematic diagram of another second slave unit and a second coil provided in an optional embodiment of the present application;
[0024] Figure 6 is a schematic diagram of another first slave unit and a first coil provided in an optional embodiment of the present application;
[0025] Figure 7 is a schematic diagram of another second slave unit and a second coil provided in an optional embodiment of the present application;
[0026] Figure 8 This is a schematic structural diagram of a motor provided in an optional embodiment of the present application;
[0027] Figure 9 This is a schematic structural diagram of a motor provided in an optional embodiment of the present application;
[0028] Figure 10 This is an optional embodiment of the present application. Figure 1 Flowchart of the steps of detecting magnetic field information in step 110;
[0029] Figure 11 This is an optional embodiment of the present application. Figure 1 Flowchart of step 120 in FIG. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present application.
[0031] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a," "an," and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0032] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information without departing from the scope of this application. Depending on the context, the word "if" as used herein may be interpreted as "when...", "when...", or "in response to determining."
[0033] An embodiment of the present application provides a method for setting a device address for a slave unit of an electronic device to at least partially address the above-mentioned problem. Specifically, the electronic device includes a master unit and multiple slave units, and the master unit and the slave units can communicate via an IIC bus or an I3C bus. Each slave unit is connected to at least one coil, and the slave unit can output current to the coil, thereby driving the coil to generate a magnetic field.
[0034] like Figure 1 As shown, the method for setting the device address provided in the embodiment of the present application includes:
[0035] S110. Receive an address setting instruction sent by the host unit, drive one or more connected coils to generate a magnetic field according to the address setting instruction, and detect magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different.
[0036] When the host unit communicates with the slave unit, it can determine whether there are multiple slave units with the same device address. If there are multiple slave units with the same device address, the host unit can send an address setting instruction to the slave unit with the same device address, so that the slave unit enters the address setting state. The address setting instruction may include current direction information, and the current direction information is used to indicate the direction of the current output by the slave unit to the coil. In the embodiment of the present application, the current direction information of the address setting instruction indicates that each slave unit with the same device address outputs current in the same direction to the coil. For example, the first connection terminal of the slave unit can be connected to one end of the coil, and the second connection terminal of the slave unit can be connected to the other end of the coil. The current direction information can indicate that the slave unit outputs current from the first connection terminal and receives current from the second connection terminal, or outputs current from the second connection terminal and receives current from the first connection terminal.
[0037] The slave unit can output current to one or more coils connected thereto to drive the current generated by one or more coils.
[0038] Magnetic field sensors include magnetoresistive sensors, Hall effect sensors, and fluxgate sensors, which can be used to detect information such as the strength and direction of the magnetic field. The specific usage of various magnetic field sensors can refer to the relevant technology and will not be described in detail here. The coils connected to the slave unit can correspond one-to-one with the magnetic field sensors, so that the magnetic field information of a coil is detected by a corresponding magnetic field sensor. The magnetic field sensor can be integrated into the slave unit or set outside the slave unit and connected to the slave unit. As long as the slave unit can control the magnetic field sensor to detect the magnetic field information of the coil, when the magnetic field sensor is set outside the slave unit, the analog-to-digital conversion circuit can be electrically connected to the slave unit.
[0039] In addition, the magnetic field sensor can be located inside or outside the coil, and this is not limited in the present embodiment. The positional relationship between the magnetic field sensor and the coil corresponding to each slave unit can be the same or different.
[0040] In some optional embodiments, the magnetic field information includes the magnetic field direction and / or the magnetic field strength. Specifically, as a feasible implementation method, the magnetic field information includes the magnetic field direction, and the magnetic field directions of the magnetic fields generated by the corresponding coils driven by each slave unit are different, so that the slave units can be distinguished by the magnetic field directions of the magnetic fields generated by the coils driven by the slave units. As another feasible implementation method, the magnetic field information includes the magnetic field strength, and the magnetic field strength of the magnetic fields generated by the corresponding coils driven by each slave unit are different, so that the slave units can be distinguished by the magnetic field strength of the magnetic fields generated by the coils driven by the slave units. As another feasible implementation method, the magnetic field information includes the magnetic field direction and magnetic field strength, and each slave unit drives the corresponding coil to generate a different combination of the magnetic field direction and magnetic field strength of the magnetic field, so that the slave units can be distinguished by the magnetic field direction and magnetic field strength of the magnetic field generated by the coil driven by the slave unit. In addition, two slave units with the same device address can be set to drive the coils connected to generate different magnetic field directions and magnetic field strengths. At this time, the slave units are distinguished by the magnetic field direction and magnetic field strength of the coil connected to the slave unit. Compared with distinguishing the slave units only by the magnetic field direction or magnetic field strength of the coil connected to the slave unit, there are more effective reference bases, which is conducive to improving the accuracy of distinguishing the slave units.
[0041] In an embodiment of the present application, the magnetic field information includes the magnetic field direction and / or the magnetic field strength. The magnetic field direction and the magnetic field strength are both quantifiable physical properties of the magnetic field. The magnetic field information includes the magnetic field direction and / or the magnetic field strength, which helps to reduce the difficulty of obtaining the magnetic field information.
[0042] In some optional embodiments, the direction of the magnetic field includes a first direction and a second direction, and the first direction and the second direction are opposite.
[0043] The magnetic field generated by each coil can be used as a reference to determine the direction of the magnetic field with respect to that coil. Figure 2 A coil 100 connected to a slave unit is shown, wherein the first connection end 111 and the second connection end 112 of the coil 100 are used to connect to the slave unit, and the first connection end 111 is connected to the first end 121 of the coil, and the second connection end 112 of the coil is connected to the second end 122 of the coil. Figure 2 As shown, the central axis Z of the coil is parallel to the first direction 131 and the second direction 132, the first direction 131 is the direction from the first end 121 of the coil to the second end 122 of the coil along the central axis Z of the coil, and the second direction 132 is the direction from the second end 122 of the coil to the first end 121 of the coil along the central axis Z of the coil. Alternatively, the first direction can be the direction from the second end of the coil to the first end of the coil along the central axis Z of the coil, and the second direction can be the direction from the first end of the coil to the second end of the coil along the central axis Z of the coil. That is, the coil 100 can be used as the reference for the magnetic field direction of the coil 100, and two relative directions parallel to the central axis of the coil 100 are set as the first direction and the second direction. The magnetic field directions of each coil in this application (such as the first coil and the second coil below) can be defined with reference to the above embodiments, and will not be described in detail.
[0044] Because the magnetic field inside a coil points from the south pole to the north pole, and outside the coil, it points from the north pole to the south pole. Therefore, when a magnetic field sensor is located outside the corresponding coil, the direction of the magnetic field it detects may be exactly opposite to the direction of the magnetic field inside the coil relative to the coil's ends. Therefore, the magnetic field direction of each coil should be the same as the direction of the magnetic field inside the coil or the direction of the magnetic field outside the coil. If some magnetic field sensors are located inside the coil they detect, and some are located outside the coil they detect, then when the slave unit detects magnetic field information from the coil's magnetic field using the magnetic field sensors, it can determine the direction of the coil's magnetic field based on the position of the magnetic field sensors relative to the coil (inside / outside the coil) and the detection signals obtained by the magnetic field sensors, thereby unifying the determined magnetic field direction to the direction of the magnetic field inside / outside the coil. Alternatively, if all magnetic field sensors are located inside or outside the coil they detect, the slave unit can directly determine the direction of the coil's magnetic field based on the detection signals obtained by the magnetic field sensors.
[0045] The magnetic field information of the magnetic field generated by the magnetic field sensor includes: detecting whether the magnetic field direction of the magnetic field is the first direction or the second direction by the magnetic field sensor. The magnetic field of the magnetic field sensor detects the magnetic field of the coil and obtains a corresponding detection signal. Based on the detection signal, it can be determined whether the magnetic field direction of the magnetic field is the first direction or the second direction. For example, if the value of the detection signal is positive, the magnetic field direction of the coil is the first direction; if the value of the detection signal is negative, the magnetic field direction of the coil is the second direction. Alternatively, if the value of the detection signal is a signal value 1 representing a high level, the magnetic field direction of the coil is the first direction; if the value of the detection signal is a signal value 0 representing a low level, the magnetic field direction of the coil is the second direction. Of course, the steps of the following embodiment can also be performed to obtain a detection signal corresponding to the first magnetic field and a detection signal corresponding to the second magnetic field by the magnetic field sensor, and then obtain a difference signal by difference calculation, and determine the magnetic field direction based on the difference signal. The specific process can be referred to the description of the following embodiment and will not be repeated here.
[0046] In the embodiment of the present application, the direction of the magnetic field includes a first direction and a second direction, and the first direction and the second direction are opposite. The magnetic field sensor can be used to detect whether the magnetic field direction of the magnetic field is the first direction or the second direction, and the direction of the magnetic field can be determined without placing other directions within the range of the coil magnetic field direction, which greatly reduces the complexity of detecting the coil magnetic field direction.
[0047] In some optional embodiments, the slave unit of the electronic device may include a first slave unit and a second slave unit having the same original device address, the first slave unit being connected to the first coil, and the second slave unit being connected to the second coil. The first slave unit and the second slave unit may each execute the method for setting the device address provided in the embodiments of the present application.
[0048] Optionally, under the drive of the first slave unit and the second slave unit, the magnetic field information of the magnetic field generated by the first coil and the second coil may include the direction of the magnetic field. By arranging the winding direction of the coil and the connection relationship between the coil and the slave unit, etc., the magnetic field directions of the first coil and the second coil can be made different when the directions of the output currents of the first slave unit and the second slave unit are the same.
[0049] like Figure 3 and Figure 4As shown, in some optional embodiments, the first connection end 211 of the first slave unit 210 is connected to the first connection end 231 of the first coil 230, the second connection end 212 of the first slave unit 210 is connected to the second connection end 232 of the first coil 230, the first connection end 221 of the second slave unit 220 is connected to the second connection end 242 of the second coil 240, and the second connection end 222 of the second slave unit 220 is connected to the first connection end 241 of the second coil 240. The winding direction of the first coil 230 from the first connection end 231 to the second connection end 232 is the same as the winding direction of the second coil 240 from the first connection end 241 to the second connection end 242. The winding direction of the coil can be understood as the spiral direction of the coil wire along the coil bobbin or magnetic core, usually expressed as clockwise or counterclockwise. Figure 3 The winding direction of the first coil 230 from the first connection end 231 to the second connection end 232 is clockwise. Figure 4 The winding direction of the second coil 240 from the first connection end 241 to the second connection end 242 is also clockwise. In the embodiment of the present application, when the first slave unit 210 and the second slave unit 220 output current in the same direction, for example, the direction of the output current of the first slave unit 210 and the second slave unit 220 is both output from the first connection end and input from the second connection end, the direction of the magnetic field inside the first coil 230 and the direction of the magnetic field inside the second coil 240 are opposite, and the magnetic field direction of each coil, such as the first coil 230 and the second coil 240, can be the direction of the magnetic field inside the coil.
[0050] In an embodiment of the present application, when the slave unit of the electronic device includes a first slave unit and a second slave unit with the same original device address, the magnetic field information may only include the direction of the magnetic field, by setting the first connection end of the first slave unit to be connected to the first connection end of the first coil, and the second connection end of the first slave unit to be connected to the second connection end of the first coil; the first connection end of the second slave unit to be connected to the second connection end of the second coil, and the second connection end of the second slave unit to be connected to the first connection end of the second coil, the winding direction of the first coil from the first connection end to the second connection end is the same as the winding direction of the second coil from the first connection end to the second connection end. By setting the connection method between the coil and the slave unit to be different, when the current direction of the first slave unit and the second slave unit is the same, it is simple and convenient to realize that the magnetic field directions of the first coil and the second coil are opposite, that is, the magnetic field information of each slave unit driving the corresponding coil to generate a magnetic field is different, which is conducive to the practical application of the method for setting the device address of the present application.
[0051] like Figure 3 and Figure 5As shown, in some other optional embodiments, the first connection end 211 of the first slave unit 210 is connected to the first connection end 231 of the first coil 230, the second connection end 212 of the first slave unit 210 is connected to the second connection end 232 of the first coil 230, the first connection end 221 of the second slave unit 220 is connected to the first connection end 241 of the second coil 240, and the second connection end 222 of the second slave unit 220 is connected to the second connection end 242 of the second coil 240. The winding direction of the first coil 230 from the first connection end 231 to the second connection end 232 is opposite to the winding direction of the second coil 240 from the first connection end 241 to the second connection end 242. For example, the winding direction of the first coil 230 from the first connection end 231 to the second connection end 232 is clockwise, and the winding direction of the second coil 240 from the first connection end 241 to the second connection end 242 is counterclockwise. In an embodiment of the present application, when the directions of the output currents of the first slave unit 210 and the second slave unit 220 are the same, for example, the directions of the output currents of the first slave unit 210 and the second slave unit 220 are both output from the first connection end and input from the second connection end, the direction of the magnetic field inside the first coil 230 and the direction of the magnetic field inside the second coil 240 are opposite, and the direction of the magnetic field of each coil such as the first coil 230 and the second coil 240 can be the direction of the magnetic field inside the coil.
[0052] In an embodiment of the present application, the first connection end of the first slave unit is connected to the first connection end of the first coil, and the second connection end of the first slave unit is connected to the second connection end of the first coil; the first connection end of the second slave unit is connected to the first connection end of the second coil, and the second connection end of the second slave unit is connected to the second connection end of the second coil. The winding direction of the first coil from the first connection end to the second connection end is opposite to the winding direction of the second coil from the first connection end to the second connection end. By setting the winding directions of the coils to be different, when the current directions of the first slave unit and the second slave unit are the same, it is simple and convenient to achieve opposite magnetic field directions of the first coil and the second coil, that is, to achieve different magnetic field information for each slave unit driving the corresponding coil to generate a magnetic field, which is conducive to the practical application of the method for setting the device address of the present application.
[0053] In some other optional embodiments, under the driving of the first slave unit and the second slave unit, the magnetic field information of the magnetic field generated by the first coil and the second coil may include magnetic field strength, such as Figure 6 and Figure 7 As shown, by setting the number of turns of the first coil 230 and the second coil 240 to be different, the magnetic field strengths of the first coil 230 and the second coil 240 can be different when the first slave unit 210 and the second slave unit 220 output currents in the same direction.
[0054] In some optional embodiments, the electronic device may include a motor, and the coil is used to drive the movement of the magnet in the motor. The motor included in the electronic device may be Figure 8 or Figure 9 The linear motor 300 shown in FIG. 3 may include a coil, a reed 320, a magnet 330, and a controlled object 340. The coil may include a first coil 311 and a second coil 312. The controlled object 340 may be a mass block having a certain mass. The magnet 330 may drive the controlled object 340 to move under the drive of the magnetic field of the first coil 311 or the second coil 312. The main control unit may be a main control chip of the linear motor, such as a microprocessor MCU, and the slave unit may be a driver chip connected to the coil of the linear motor. Under the control of the main control chip, the driver chip can drive the coil to generate an alternating magnetic field by outputting a current that changes direction to the coil connected thereto, thereby driving the magnet 330 to drive the controlled object 340 to reciprocate, causing the linear motor 300 to vibrate. The specific structure of the linear motor 300 can refer to the relevant technology and will not be described in detail here.
[0055] Figure 8 The linear motor 300 includes a first coil 311 and a second coil 312. The first coil 311 and the second coil 312 are driven by a first driver chip 351 and a second driver chip 352 to generate a magnetic field. The first driver chip 351 and the second driver chip 352 can be a first slave unit and a second slave unit, respectively. The first driver chip 351 and the second driver chip 352 can be integrated with a magnetic field sensor, that is, Figure 8 In the embodiment of the present invention, the first slave unit and the second slave unit are connected to the first coil 311 or the second coil 312 respectively, and magnetic field sensors are integrated in the first slave unit and the second slave unit.
[0056] Figure 9In the embodiment, the linear motor 300 includes two first coils 311 and two second coils 312. The two first coils 311 are connected to the same first driving chip 351, and are driven by the first driving chip 351 to generate a magnetic field. The two second coils 312 are connected to the same second driving chip 352, and are driven by the second driving chip 352 to generate a magnetic field. Each first coil 311 is provided with a first magnetic field sensor 361 for detecting the magnetic field information of the first coil 311, and each second coil 312 is provided with a second magnetic field sensor 362 for detecting the magnetic field information of the second coil 312. The first driving chip 351 and the second driving chip 352 can be the first slave unit and the second slave unit respectively. The two first magnetic field sensors 361 are both provided outside the first driving chip 351, and the first driving chip 351 is respectively connected to the two first magnetic field sensors 361. The two second magnetic field sensors 362 are both provided outside the second driving chip 352, and the second driving chip 352 is respectively connected to the two second magnetic field sensors 362, that is, Figure 9 In the embodiment, each slave unit is connected to two coils, and the slave unit is connected to a magnetic field sensor disposed externally thereto. It should be understood that the wiring diagrams of the various components in the drawings of this application are merely schematic illustrations of the connection relationships, and that two components connected by a wiring diagram may be connected by a single wire or multiple wires. For example, the first driver chip 351 and the first coil 311 may be connected by at least two wires, and the first driver chip 351 and the first magnetic field sensor 361 may be connected by at least two wires.
[0057] In an embodiment of the present application, the slave unit can drive the motor's own coil to generate a corresponding magnetic field, and detect the magnetic field information of the magnetic field through a magnetic field sensor to set its own device address, thereby solving the problem of device address conflict of the slave unit. When the electronic device includes a motor, it can minimize the modification of the original structure of the electronic device and reduce the cost of the slave unit setting its own device address.
[0058] When an electronic device includes the above-mentioned linear motor, such as Figure 10 As shown, one or more connected coils are driven to generate a magnetic field according to an address setting instruction, and magnetic field information of the generated magnetic field is detected by a magnetic field sensor, including:
[0059] S111 . Output a first current to the coil according to the address setting instruction, driving the coil to generate a first magnetic field, where the first magnetic field is used to enable the movement of the magnet to reach a maximum stroke.
[0060] The coil driven by the slave unit can be one or more. It should be noted that the stroke of the magnet movement can be a stroke moving in the direction close to the coil, or a stroke moving in the direction close to the coil, and the first current corresponding to the maximum stroke of these two strokes is different. The address setting instruction may include current direction information indicating the direction and current value of the first current and the second current below. The current values of the first current and the second current can be set according to the current output to the coil by the slave unit when the stroke of the magnet moving in the direction close to the coil / away from the coil increases to the maximum value, and the current values of the first current and the second current can be greater than or equal to the current value of the current.
[0061] S112 . Detect the first magnetic field using a magnetic field sensor to obtain a detection signal corresponding to the first magnetic field.
[0062] When there are multiple coils, one magnetic field sensor detects the first magnetic field generated by one coil. The detection signal corresponding to the first magnetic field is the signal obtained by the magnetic field sensor from detecting the first magnetic field. The detection signal corresponding to the first magnetic field can be used to indicate the magnetic field strength and direction of the first magnetic field.
[0063] S113. Output a second current to the coil to drive the coil to generate a second magnetic field, wherein the direction of the second current is the same as the direction of the first current, the current value of the second current is different from the current value of the first current, and the second magnetic field is also used to make the movement stroke of the magnet reach the maximum stroke.
[0064] The direction of the second current is the same as the direction of the first current, and the current value of the second current is different from the current value of the first current, so that the magnetic field direction of the second magnetic field is the same as the magnetic field direction of the first magnetic field, but the magnetic field strength is different. The current value of the second current can be greater than or less than the first current. The absolute value of the difference between the second current and the first current can be greater than a predetermined threshold value so that the difference in strength between the second magnetic field and the first magnetic field is more obvious. The predetermined threshold value can be set based on an experiment to detect the difference in strength between the second magnetic field and the first magnetic field, or can be set based on the experience or needs of those skilled in the art, and this application does not limit this.
[0065] S114 . Detect the second magnetic field using a magnetic field sensor to obtain a detection signal corresponding to the second magnetic field.
[0066] The detection signal corresponding to the second magnetic field is the signal obtained by the magnetic field sensor when detecting the second magnetic field. The detection signal corresponding to the second magnetic field can be used to indicate the magnetic field strength and direction of the second magnetic field. The maximum travel of the magnet under the influence of the first and second magnetic fields is the same, meaning that the travel of the magnet remains unchanged in both cases. Because the magnet's magnetic field has the same effect on the magnetic field sensor when the travel remains unchanged, the error caused by the magnet's magnetic field in the detection signal corresponding to the second magnetic field is the same as the error in the detection signal corresponding to the first magnetic field.
[0067] S115 , performing a difference operation on the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field to obtain a difference signal, and determining magnetic field information according to the difference signal.
[0068] By subtracting the detection signal corresponding to the first magnetic field from the detection signal corresponding to the second magnetic field, the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field can be differenced, so that the error caused by the magnetic field of the magnet in the detection signal corresponding to the second magnetic field is offset by the error caused by the magnetic field of the magnet in the detection signal corresponding to the first magnetic field, and the influence of the magnetic field of the magnet in the difference signal is removed, so that the magnetic field information of the coil magnetic field can be accurately indicated through the difference signal.
[0069] It should be noted that the magnitude of the difference signal can indicate the magnetic field strength of the magnetic field, and the positive or negative sign of the difference signal can indicate the magnetic field direction of the magnetic field, thereby determining magnetic field information based on the difference signal. Optionally, a positive difference signal indicates that the magnetic field direction of the coil is in the first direction, and a negative difference signal indicates that the magnetic field direction of the coil is in the second direction. Alternatively, a positive difference signal indicates that the magnetic field direction of the coil is in the second direction, and a negative difference signal indicates that the magnetic field direction of the coil is in the first direction.
[0070] In an embodiment of the present application, the electronic device includes a motor, and the coil is used to drive the movement of the magnet in the motor. A first current can be output to the coil according to the address setting instruction, driving the coil to generate a first magnetic field, and the first magnetic field is used to make the stroke of the magnet reach the maximum stroke. The first magnetic field is detected by a magnetic field sensor to obtain a detection signal corresponding to the first magnetic field, and a second current is output to the coil to drive the coil to generate a second magnetic field, wherein the direction of the second current is the same as the direction of the first current, the current value of the second current is different from the current value of the first current, and the second magnetic field is also used to make the stroke of the magnet reach the maximum stroke. The second magnetic field is detected by a magnetic field sensor to obtain a detection signal corresponding to the second magnetic field, the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field are differenced to obtain a difference signal, and the magnetic field information is determined based on the difference signal. When the stroke of the magnet reaches the maximum stroke, a detection signal corresponding to the first magnetic field can be obtained, and when the stroke of the magnet remains at the maximum stroke, a detection signal corresponding to the second magnetic field can be obtained, so that the errors caused by the magnet in the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field are the same. Therefore, by performing a difference operation on the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field, the error caused by the magnet can be removed, and a difference signal with a smaller error can be obtained, so that more accurate magnetic field information can be determined based on the difference signal.
[0071] In some optional embodiments, the output end of the magnetic field sensor is connected to a signal amplification circuit and an analog-to-digital conversion circuit. Specifically, the output end of the magnetic field sensor is connected to the signal amplification circuit, and the signal amplification circuit is connected to the analog-to-digital conversion circuit. Detecting the first magnetic field by the magnetic field sensor to obtain a detection signal corresponding to the first magnetic field includes:
[0072] The first magnetic field is detected by a magnetic field sensor to obtain an initial detection signal output by the magnetic field sensor, the initial detection signal is amplified by a signal amplification circuit to obtain an amplified signal corresponding to the initial detection signal, and the amplified signal is converted from analog to digital by an analog-to-digital conversion circuit to obtain a detection signal corresponding to the first magnetic field.
[0073] Similar to the magnetic field sensor, the signal amplification circuit and the analog-to-digital conversion circuit can be integrated in the slave unit or be arranged outside the slave unit. When the signal amplification circuit and the analog-to-digital conversion circuit are arranged outside the slave unit, the analog-to-digital conversion circuit can be electrically connected to the input end of the slave unit.
[0074] The signal amplification circuit may include an electronic component such as an operational amplifier for amplifying the signal, thereby amplifying the initial detection signal. Optionally, the signal amplification circuit may be a PGA (Programmable Gain Amplifier) circuit. The analog-to-digital conversion circuit may include an analog-to-digital converter to perform analog-to-digital conversion on the amplified signal through the analog-to-digital converter. As a feasible implementation method, other suitable circuit units may be connected between the magnetic field sensor, the signal amplification circuit, and the analog-to-digital conversion circuit, such as a noise reduction unit for noise reduction, etc., which is not limited in the embodiments of the present application.
[0075] The process of detecting the second magnetic field using the magnetic field sensor and obtaining a detection signal corresponding to the second magnetic field can be similar to the above. Specifically, the second magnetic field can be detected using the magnetic field sensor to obtain an initial detection signal corresponding to the second magnetic field output by the magnetic field sensor. This initial detection signal can be amplified using a signal amplification circuit to obtain an amplified signal corresponding to the initial detection signal. This amplified signal can then be converted to digital using an analog-to-digital conversion circuit to obtain a detection signal corresponding to the second magnetic field.
[0076] In an embodiment of the present application, the output end of the magnetic field sensor is connected to a signal amplification circuit and an analog-to-digital conversion circuit. The signal amplification circuit amplifies the initial detection signal output by the magnetic field sensor to obtain an amplified signal corresponding to the initial detection signal. The analog-to-digital conversion circuit then performs analog-to-digital conversion on the amplified signal to obtain a detection signal corresponding to the first magnetic field. The signal amplification circuit can significantly improve the strength and recognizability of the obtained signal, enhancing the ability to detect weak magnetic fields. The analog-to-digital conversion circuit then converts the detection signal corresponding to the first magnetic field into a digital signal, facilitating subsequent various operations and processing on the detection signal.
[0077] S120 . Setting the device address of the slave unit itself according to the magnetic field information, so that the device address of the slave unit itself is different from the device addresses of other slave units.
[0078] Because each slave unit drives a corresponding coil generating a magnetic field with different magnetic field information, each slave unit sets its own address so that its device address uniquely corresponds to the magnetic field information of the coil it drives, thereby making its own device address different from the device addresses of other slave units. It should be understood that the method of the embodiment of the present application is applied to a slave unit, and the device address set by the slave unit in step S120 is the device address of the slave unit itself.
[0079] like Figure 11 As shown, in some optional embodiments, setting the device address of the slave unit itself according to the magnetic field information includes:
[0080] S121. Determine setting parameters corresponding to the magnetic field information according to the magnetic field information and preset mapping information; wherein the mapping information is used to indicate the corresponding relationship between the magnetic field information and the setting parameters, and different magnetic field information corresponds to different setting parameters.
[0081] The mapping information may be a mapping table including the correspondence between different magnetic field information and setting parameters. For example, each item of magnetic field information and its corresponding setting parameter in the mapping table may be located in the same row of the mapping table, and different magnetic field information may be located in different rows of the mapping table. Based on the determined mapping information, the setting parameters located in the same row as the mapping information may be retrieved in the mapping table, and the retrieved setting parameters may be determined as the device parameters corresponding to the magnetic field direction. If the magnetic field information is not included in the mapping table, the setting parameters corresponding to the magnetic field information may be obtained by interpolation based on the magnetic field information and setting parameters included in the mapping table. Of course, the mapping information may also be information in other suitable forms, which is not limited in the embodiments of the present application.
[0082] S122: Set the device address according to the determined setting parameters.
[0083] As a feasible implementation manner, different setting parameters may be different addresses, so that the setting parameters may be set as the device address according to the setting parameters.
[0084] In an embodiment of the present application, the setting parameters corresponding to the magnetic field information are determined based on the magnetic field information and the preset mapping information, and the device address is set according to the determined setting parameters, wherein the mapping information is used to indicate the correspondence between the magnetic field information and the setting parameters, and different magnetic field information corresponds to different setting parameters. The magnetic field information can be combined with the preset mapping information to quickly determine the setting parameters for the device address. The process does not require complex calculations, which is conducive to improving the efficiency of setting the device address.
[0085] In some optional embodiments, setting the device address according to the determined setting parameter includes: setting a predetermined number of bits of data in the original device address as the determined setting parameter.
[0086] The original device address of the slave unit itself may be the original address set when the slave unit is manufactured. Usually, the original addresses of slave units of the same model are the same.
[0087] For example, if the original device address of the slave unit itself is 7'h60, the predetermined number of bits is the last bit, and the setting parameter determined according to the magnetic field information is 1, then the device address of the slave unit in the embodiment of the present application can be set to 7'h61. If the original device address of the slave unit itself is 7'h60, the predetermined number of bits is the last two bits of the data, and the setting parameter determined according to the magnetic field information is 2'b10, then the device address of the slave unit in the embodiment of the present application can be set to 7'h62. In 7'h60, 7 indicates that the data bit width is 7 bits (binary bit number), h indicates that the data base (Base) is hexadecimal, 60 means that the value of the data in hexadecimal is 60, and 7'h60 is actually 1100000 (the value in binary). In 2'b10, 2 indicates that the data bit width is 2 bits, b indicates that the data base is binary, and 10 means that the value of the data in binary is 10. Modify the last two digits of 7'h60 to 2'b10, that is, modify the last two digits of 1100000 to 10, and get 1100010, which is 62 in hexadecimal, and get 7'h62.
[0088] It should be noted that there may be setting parameters that are the same as the data of a predetermined number of bits in the original device address, that is, the device address set according to the setting parameters may still be the original device address of the slave unit itself. Correspondingly, other setting parameters are different from the data of a predetermined number of bits in the original device address of the slave unit itself, so that the device addresses set by each slave unit according to the setting parameters are different.
[0089] The slave unit of the embodiment of the present application can directly set a predetermined number of bits of data in its own original device address to the determined setting parameters, avoiding complete replacement of the entire original device address, thereby retaining other parts of the original device address while adjusting the device address, and reducing the computational complexity of the slave unit in setting its own device address.
[0090] In an embodiment of the present application, the method for setting a device address can be used for a slave unit of an electronic device, so that the slave unit receives an address setting instruction sent by a host unit, drives one or more connected coils to generate a magnetic field according to the address setting instruction, and detects the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein, the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different. According to the magnetic field information, the device address of the slave unit itself is set so that the device address of the slave unit itself is different from the device addresses of other slave units. The difference in the magnetic field information of the coils connected to different slave units can be used to enable the slave unit to set its own device address, ensuring the uniqueness of the device address of each slave unit, thereby solving the problem of the same device address of the slave units, enabling the host unit to distinguish the slave units by the device address, and ensuring normal communication between the host unit and the slave unit.
[0091] The present application also provides a method for setting a device address for a host unit of an electronic device, wherein the electronic device includes a host unit and multiple slave units, each of which is connected to at least one coil. The method for setting a device address includes:
[0092] An address setting instruction is sent to multiple slave units with the same device address, so that when the slave unit receives the address setting instruction sent by the master unit, it drives one or more connected coils to generate a magnetic field according to the address setting instruction, and detects the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different; based on the magnetic field information, the device address of the slave unit itself is set so that the device address of the slave unit itself is different from the device addresses of other slave units.
[0093] The method for setting the device address of the host unit of an electronic device provided in the embodiment of the present application is based on the same inventive concept as the aforementioned method for setting the device address of the slave unit of an electronic device and can achieve the same effect. The specific implementation process can be found in the description in the embodiment of the method for setting the device address of the slave unit of an electronic device, and will not be repeated here.
[0094] In some optional embodiments, the method for setting the device address further includes:
[0095] Acquire preset device address setting information; the device address setting information includes the device address set for each slave unit.
[0096] Exemplarily, the mapping information of the above embodiment may include the correspondence between each magnetic field direction and each setting parameter. The host unit can determine all possible device addresses of the slave unit based on the various setting parameters included in the mapping information of the above embodiment to obtain the device address set for each slave unit. The process of determining the device address of the slave unit based on the setting parameters can refer to the above-mentioned embodiment of the surface mapping information and will not be repeated here.
[0097] An authentication instruction is sent to multiple slave units with the same device address according to the set device address, and a slave unit corresponding to each set device address is determined according to the response of each slave unit.
[0098] Optionally, the authentication instruction may include a set device address. If the device address included in the authentication instruction is the same as the set device address of the slave unit that received the authentication instruction, the slave unit may send a response instruction to the host unit in response to the authentication instruction. Otherwise, the slave unit may not respond to the authentication instruction. The host unit may determine whether the slave unit corresponds to the device address in the authentication instruction based on whether the slave unit sends a response instruction. Of course, the host unit may also determine the slave unit corresponding to each set device address through other appropriate authentication instructions, and the embodiments of the present application are not limited to this.
[0099] In an embodiment of the present application, the method for setting a device address further includes obtaining preset device address setting information, wherein the device address setting information includes the device address set for each slave unit. An authentication instruction is sent to multiple slave units with the same device address based on the set device address, and the slave unit corresponding to each set device address is determined based on the response of each slave unit. This allows the host unit to quickly locate and identify the device address set for each slave unit based on the preset device address setting information, so that the host unit can communicate with the slave unit based on the set device address.
[0100] An embodiment of the present application further provides an electronic device, including a host unit and multiple slave units, each slave unit being connected to at least one coil.
[0101] The master unit is used to send address setting instructions to multiple slave units with the same device address.
[0102] The slave unit is used to receive an address setting instruction sent by the host unit, drive one or more connected coils to generate a magnetic field according to the address setting instruction, and detect the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different; and according to the magnetic field information, set its own device address so that its own device address is different from the device addresses of other slave units.
[0103] An embodiment of the present application also provides a chip for executing the method for setting the device address in any of the above embodiments.
[0104] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0105] Those skilled in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.
[0106] The above implementation methods are only used to illustrate the embodiments of the present application, and are not intended to limit the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present application, and the scope of patent protection of the embodiments of the present application should be defined by the claims.
Claims
1. A method for setting a device address, for a slave unit of an electronic device, characterized in that: The electronic device comprises a master unit and a plurality of slave units, each of the slave units being connected to at least one coil; The method comprises: receiving an address setting instruction sent by the master unit, driving one or more connected coils to generate a magnetic field according to the address setting instruction, and detecting magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by each slave unit driving the corresponding coil is different; The device address of the slave unit itself is set according to the magnetic field information, so that the device address of the slave unit itself is different from the device addresses of other slave units.
2. The method according to claim 1, characterized in that The magnetic field information includes magnetic field direction and / or magnetic field strength.
3. The method according to claim 2, characterized in that The slave units of the electronic device include a first slave unit and a second slave unit having the same original device address; The magnetic field information includes the direction of the magnetic field. The first connection end of the first slave unit is connected to the first connection end of the first coil, and the second connection end of the first slave unit is connected to the second connection end of the first coil; the first connection end of the second slave unit is connected to the second connection end of the second coil, and the second connection end of the second slave unit is connected to the first connection end of the second coil. The winding direction of the first coil from the first connection end to the second connection end is the same as the winding direction of the second coil from the first connection end to the second connection end.
4. The method according to claim 2, characterized in that The slave units of the electronic device include a first slave unit and a second slave unit having the same original device address; The magnetic field information includes the direction of the magnetic field. The first connection end of the first slave unit is connected to the first connection end of the first coil, and the second connection end of the first slave unit is connected to the second connection end of the first coil; the first connection end of the second slave unit is connected to the first connection end of the second coil, and the second connection end of the second slave unit is connected to the second connection end of the second coil. The winding direction of the first coil from the first connection end to the second connection end is opposite to the winding direction of the second coil from the first connection end to the second connection end.
5. The method according to claim 1, wherein The step of setting the device address of the slave unit according to the magnetic field information includes: Determining, based on the magnetic field information and preset mapping information, setting parameters corresponding to the magnetic field information; wherein the mapping information is used to indicate a correspondence between the magnetic field information and the setting parameters, and different magnetic field information corresponds to different setting parameters; The device address is set according to the determined setting parameters.
6. The method according to claim 5, characterized in that Setting the device address according to the determined setting parameters includes: The data of a predetermined number of bits in the original device address is set as the determined setting parameter.
7. The method according to claim 2, characterized in that The magnetic field direction includes a first direction and a second direction, and the first direction and the second direction are opposite to each other.
8. The method according to claim 1, characterized in that The electronic device includes a motor, and the coil is used to drive a magnet in the motor to move; The step of driving one or more connected coils to generate a magnetic field according to the address setting instruction, and detecting magnetic field information of the generated magnetic field by a magnetic field sensor, includes: outputting a first current to the coil according to the address setting instruction to drive the coil to generate a first magnetic field, wherein the first magnetic field is used to enable the movement of the magnet to reach a maximum stroke; detecting the first magnetic field by a magnetic field sensor to obtain a detection signal corresponding to the first magnetic field; outputting a second current to the coil to drive the coil to generate a second magnetic field, wherein the direction of the second current is the same as the direction of the first current, the current value of the second current is different from the current value of the first current, and the second magnetic field is also used to cause the movement stroke of the magnet to reach the maximum stroke; detecting the second magnetic field by a magnetic field sensor to obtain a detection signal corresponding to the second magnetic field; A difference operation is performed on the detection signal corresponding to the first magnetic field and the detection signal corresponding to the second magnetic field to obtain a difference signal, and the magnetic field information is determined according to the difference signal.
9. The method according to claim 8, characterized in that The output end of the magnetic field sensor is connected to a signal amplification circuit and an analog-to-digital conversion circuit; The detecting the first magnetic field by a magnetic field sensor to obtain a detection signal corresponding to the first magnetic field includes: The first magnetic field is detected by a magnetic field sensor to obtain an initial detection signal output by the magnetic field sensor, the initial detection signal is amplified by the signal amplification circuit to obtain an amplified signal corresponding to the initial detection signal, and the amplified signal is converted from analog to digital by an analog-to-digital conversion circuit to obtain a detection signal corresponding to the first magnetic field.
10. A method for setting a device address, used for a host unit of an electronic device, characterized in that: The electronic device comprises the master unit and a plurality of slave units, each of the slave units being connected to at least one coil; The method comprises: An address setting instruction is sent to a plurality of slave units having the same device address, so that when the slave units receive the address setting instruction sent by the host unit, they drive one or more connected coils to generate a magnetic field according to the address setting instruction, and detect the magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by the corresponding coil driven by each slave unit is different; and according to the magnetic field information, the device address of the slave unit itself is set so that the device address of the slave unit itself is different from the device addresses of other slave units.
11. The method according to claim 10, characterized in that The method further includes: acquiring preset device address setting information; the device address setting information includes the device address set by each of the slave units; An authentication instruction is sent to the plurality of slave units having the same device address according to the set device address, and the slave unit corresponding to each set device address is determined according to the response of each slave unit.
12. An electronic device, characterized in that: The method comprises a master unit and a plurality of slave units, each of the slave units being connected to at least one coil; The host unit is configured to send an address setting instruction to the plurality of slave units having the same device address; The slave unit is used to receive an address setting instruction sent by the host unit, drive one or more connected coils to generate a magnetic field according to the address setting instruction, and detect magnetic field information of the generated magnetic field through a magnetic field sensor; wherein the magnetic field information of the magnetic field generated by each slave unit driving the corresponding coil is different; and set its own device address according to the magnetic field information so that its own device address is different from the device addresses of other slave units.
13. A chip, characterized in that: Used to perform the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method for establishing communication connection and terminals
CN107801252A
Slave unit address modification method, chip and electronic equipment
CN116599934A
Address setting module for e.g. input / output field bus component used in automatic control engineering application, has magnetic addressing device which provides magnetic coded network address for electrical / electronic device
DE102011076554A1