CN109481946B - Bus master-slave equipment determining method and system, medium and bus equipment - Google Patents

Bus master-slave equipment determining method and system, medium and bus equipment Download PDF

Info

Publication number
CN109481946B
CN109481946B CN201811347725.2A CN201811347725A CN109481946B CN 109481946 B CN109481946 B CN 109481946B CN 201811347725 A CN201811347725 A CN 201811347725A CN 109481946 B CN109481946 B CN 109481946B
Authority
CN
China
Prior art keywords
bus
master
equipment
slave
signal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811347725.2A
Other languages
Chinese (zh)
Other versions
CN109481946A (en
Inventor
赵家亮
高超
李斌
刘松
舒勤茂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Putao Technology Co Ltd
Original Assignee
Shanghai Putao Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Putao Technology Co Ltd filed Critical Shanghai Putao Technology Co Ltd
Priority to CN201811347725.2A priority Critical patent/CN109481946B/en
Publication of CN109481946A publication Critical patent/CN109481946A/en
Application granted granted Critical
Publication of CN109481946B publication Critical patent/CN109481946B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63HTOYS, e.g. TOPS, DOLLS, HOOPS OR BUILDING BLOCKS
    • A63H33/00Other toys
    • A63H33/04Building blocks, strips, or similar building parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides a method and a system for determining master and slave devices of a bus, a medium and bus devices thereof, comprising the following steps: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; the first condition comprises that no master confirmation signal is received from the bus within the time indicated by the preset delay information of the self device, and no master declaration signal is received from the bus, wherein the master declaration signal indicates that the bus currently has a bus master. The invention sends the master equipment confirmation signal according to the expiration of the preset delay time of each bus equipment, each bus equipment has different preset delay time, thereby generating the bus master equipment according to the length of the delay time without conflict, and generating new bus master equipment or bus slave equipment under the condition that newly added bus equipment and the bus master equipment are offline.

Description

Bus master-slave equipment determining method and system, medium and bus equipment
Technical Field
The present invention relates to electronic blocks, and more particularly, to a method and system for determining bus master/slave devices, and a medium and a bus device thereof.
Background
Traditional granule building blocks can form the electron technology building blocks after combining electron technology, can communicate in order to realize control and function controlled between these electron technology building blocks to these a plurality of building blocks realize high-level function on the whole, and control and controlled itself also be one of playing method for children, can obtain many enjoyment and the achievement after realizing the control link from it.
Because of the control and control, the building blocks must have different roles, so as to realize the control relationship. The controller is called a master and the controlled is called a slave. The master device controls one or more slave devices, which implement functions under the control of the master device.
Patent document CN2537081Y discloses an intellectual toy brick, wherein the whole toy brick contains a master module as a master device and a slave module as a slave device, thereby forming a master-slave control relationship. Patent document CN105913741A also sets a master device and a slave device, and implements a building block type training mode, which solves the problem of how to not affect the normal operation of other devices when a local device is damaged as compared with an integrated device. Patent document CN107754349A discloses an intelligent building block, which is provided with a master module and a slave module, wherein the master module includes a master display unit, a master wireless communication unit, a master CPU unit, and a master NFC unit, and the slave module is responsible for receiving data distributed by the master module and uploading a module number near the slave module to the master module.
The defects in the prior art are as follows: the role relationship between the master module and the slave module is preset and can not be changed, and once the master module is damaged, disconnected or not accessed, the slave module can not work.
Disclosure of Invention
In view of the defects in the prior art, the present invention aims to provide a bus master-slave device determination method and system, and a medium and a bus device thereof.
The invention provides a bus master-slave device determination method, which comprises the following steps:
a master-slave determination step: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition comprises any one of the following conditions:
condition a: the method comprises the steps that a master device confirmation signal is not received from a bus within the time indicated by delay information preset by self equipment; or alternatively
Condition B: and in the time indicated by the preset delay information of the self device, a master confirmation signal is not received from the bus, and a master declaration signal is not received from the bus, wherein the master declaration signal indicates that the bus currently has a bus master.
Preferably, the method comprises the following steps:
A main device detection step: judging whether a master declaration signal is received from the bus; if receiving a main equipment declaration signal, determining self equipment as bus slave equipment; otherwise, entering the master-slave determination step to continue execution.
Preferably, the master-slave determining step includes:
a time delay information obtaining step: and obtaining the preset delay information according to the ID information of the self equipment.
Preferably, the relationship between the ID information of the bus device and the time indicated by the delay information is a one-to-one correspondence.
Preferably, the master-slave determining step is performed by a power-on trigger.
The invention provides a bus master-slave device determining system, which comprises:
a master-slave determination module: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition includes any one of the following conditions:
condition a: the method comprises the steps that a master device confirmation signal is not received from a bus within the time indicated by delay information preset by self equipment; or
Condition B: and in the time indicated by the preset delay information of the self device, a master confirmation signal is not received from the bus, and a master declaration signal is not received from the bus, wherein the master declaration signal indicates that the bus currently has a bus master.
Preferably, it comprises:
a master device detection module: judging whether a master declaration signal is received from the bus; if receiving a main equipment declaration signal, determining self equipment as bus slave equipment; otherwise, entering the master-slave determining module to continue execution.
Preferably, the master-slave determination module comprises:
a delay information obtaining module: and obtaining the preset delay information according to the ID information of the self equipment.
Preferably, the relationship between the ID information of the bus device and the time indicated by the delay information is a one-to-one correspondence.
Preferably, the master-slave determination module is executed by a power-on trigger.
Preferably, the transmission cycle of the master announcement signal is less than the time indicated by the preset delay information.
According to the present invention, there is provided a computer-readable storage medium having stored thereon a computer program for implementing the steps of the bus master slave device determining method when executed by a processor.
According to the present invention, there is provided a bus device comprising a controller, wherein the controller comprises the bus master-slave device determination system or the computer-readable storage medium storing a computer program.
Compared with the prior art, the invention has the following beneficial effects:
the invention sends the master equipment confirmation signal according to the expiration of the preset delay time of each bus equipment, each bus equipment has different preset delay time, thereby generating the bus master equipment according to the length of the delay time without conflict, and generating new bus master equipment or bus slave equipment under the condition that newly added bus equipment and the bus master equipment are offline.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
fig. 1 is a flowchart of steps of a bus master-slave device determining method according to the present invention.
Fig. 2 is a schematic structural diagram of a bus master-slave device determination system according to the present invention.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that it would be obvious to those skilled in the art that various changes and modifications can be made without departing from the spirit of the invention. All falling within the scope of the present invention.
The invention provides a bus master-slave device determination method, which comprises the following steps:
a main device detection step: judging whether a master declaration signal is received from the bus; if receiving a main equipment declaration signal, determining self equipment as bus slave equipment; otherwise, entering the master-slave determination step to continue execution.
A master-slave determination step: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition comprises condition B: and in the time indicated by the preset delay information of the self device, a master confirmation signal is not received from the bus, and a master declaration signal is not received from the bus, wherein the master declaration signal indicates that the bus currently has a bus master. The master-slave determining step includes: a time delay information obtaining step: and obtaining the preset delay information according to the ID information of the self equipment. The relationship between the ID information of the bus device and the time indicated by the delay information is a one-to-one correspondence. The master-slave determining step is performed by a power-up trigger. The transmission period of the main equipment declaration signal is less than the time indicated by the preset delay information.
Specifically, the bus master-slave device determining method provided by the present invention, especially a bus master-slave device determining method in a bus device, the bus device realizes the identification of the role relationship of the bus device itself as a master device or a slave device through the bus master-slave device determining method, and performs adaptive communication with a master device or a slave device which is used by other bus devices.
Suppose there are three bus devices and one power source, wherein these bus devices and power source are all building blocks, and therefore are respectively recorded as: building blocks A, B, C and power supply building blocks. Building blocks A, building blocks B, building blocks C, power supply building blocks between electric connection, power supply building blocks was in the off-state this moment, and building blocks A, building blocks B, building blocks C all are in the power failure state. After the power supply is switched on to the power supply building block, building block A, building block B and building block C are powered on, and because building block A, building block B and building block C all access on same bus, a master device and two slave devices need to be set, if the power supply building block is not preset as a slave device, three slave devices need to be set, and the power supply building block is preset as a slave device for example for explanation.
Firstly, block a, block B, and block C each respectively determine whether a master assertion signal is received from the bus, where the master assertion signal indicates that the bus currently has a bus master. And entering the master-slave determining step to continue execution because no master device exists at the moment of power-on and no master device naturally sends out a master device declaration signal.
Then, the building block a, the building block B, and the building block C do not receive the master acknowledge signal from the bus within the time indicated by the delay information preset by the own device, and do not receive the master assert signal from the bus, and transmit the master acknowledge signal indicating the own device as the bus master to the bus. Specifically, it is assumed that the time indicated by the preset delay information in block a, block B, and block C is TA, TB, and TC, respectively, where TB is the shortest time, TA is the second shortest time, and TC is the longest time. After power-on, TB time first, block B transmits a master acknowledge signal to the bus indicating its own device as a bus master and determines it as a bus master. When both block a and block C receive the master acknowledge signal sent by block B indicating block B as the bus master, the times TA and TC still do not come, so that block a and block C determine as bus slaves.
Thus, neither block a nor block C will send a master acknowledge signal instructing the device itself to act as a bus master. Thus, it is determined that block B acts as a bus master and blocks a and C act as bus slaves. Block B, acting as a bus master, will periodically signal the bus to a master assertion to inform other bus devices accessing the bus that a bus master is present.
Further, when a new bus device is connected to the bus, if block D is assumed, it is first determined whether a master assertion signal from the bus is received, and as a result, a master assertion signal from block B is received, so that block D determines its own device as a bus slave.
Further, when block B is removed, block B is taken off the bus, and there is no bus master to periodically send a master assertion signal. And the building blocks A, C and D on the bus judge whether the master declaration signal from the bus is received or not, and the master declaration signal is not received, and the master-slave determining step is carried out continuously until bus master equipment appears. The bus slave device periodically judges whether a master declaration signal is received from the bus, and discovers the offline of the bus master device. The master assertion signal may be a heartbeat signal, a control signal, or a data signal, and is periodically issued by the bus master.
In a variant, the master detection step may be omitted, the first condition comprising condition a: and the master equipment confirmation signal is not received from the bus within the time indicated by the delay information preset by the self equipment. Then, the building block a, the building block B and the building block C can also realize the determination of the bus master device and the bus slave device through the master-slave determination step.
In the bus master-slave device determination system provided by the invention, a person skilled in the art can understand the bus master-slave device determination method as a specific embodiment of the bus master-slave device determination system, and the bus master-slave device determination system can be realized by executing the step flow of the bus master-slave device determination method. Specifically, the bus master-slave device determination system provided by the invention comprises:
a master-slave determination module: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition includes any one of the following conditions:
condition a: the method comprises the steps that a master device confirmation signal is not received from a bus within the time indicated by delay information preset by self equipment; or
Condition B: and in the time indicated by the preset delay information of the self device, a master confirmation signal is not received from the bus, and a master declaration signal is not received from the bus, wherein the master declaration signal indicates that the bus currently has a bus master.
A master device detection module: judging whether a master device declaration signal from a bus is received; if receiving a main device declaration signal, determining self devices as bus slave devices; otherwise, entering the master-slave determination module to continue execution.
Preferably, the master-slave determination module comprises:
a delay information obtaining module: and obtaining the preset delay information according to the ID information of the self equipment.
The ID information of the bus equipment and the time indicated by the delay information are in one-to-one correspondence. The master-slave determination module is executed by power-on triggering. The transmission period of the main device declaring signal is less than the time indicated by the preset delay information.
According to the present invention, there is provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the bus master slave device determining method.
The bus device provided by the invention is characterized by comprising a controller, wherein the controller comprises the bus master-slave device determination system or the computer readable storage medium storing the computer program. In a preferred embodiment, the bus device is an intelligent building block.
Those skilled in the art will appreciate that, in addition to implementing the systems, apparatus, and various modules thereof provided by the present invention in purely computer readable program code, the same procedures can be implemented entirely by logically programming method steps such that the systems, apparatus, and various modules thereof are provided in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system, the device and the modules thereof provided by the present invention can be considered as a hardware component, and the modules included in the system, the device and the modules thereof for implementing various programs can also be considered as structures in the hardware component; modules for performing various functions may also be considered to be both software programs for performing the methods and structures within hardware components.
The foregoing description has described specific embodiments of the present invention. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes or modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention. The embodiments and features of the embodiments of the present application may be combined with each other arbitrarily without conflict.

Claims (12)

1. A method for determining a master device and a slave device of a bus, comprising:
a master-slave determination step: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition comprises:
condition B: the method comprises the steps that no master equipment confirmation signal is received from a bus within the time indicated by delay information preset by self equipment, and no master equipment declaration signal is received from the bus, wherein the master equipment declaration signal indicates that bus master equipment currently exists in the bus;
the bus master and slave devices are all building blocks;
the method comprises the following steps:
a main device detection step: judging whether a master device declaration signal from a bus is received; if receiving a main device declaration signal, determining self devices as bus slave devices; otherwise, entering the master-slave determination step to continue execution.
2. A bus master slave device determination method according to claim 1, wherein said master slave determination step comprises:
a time delay information obtaining step: and obtaining the preset delay information according to the ID information of the self equipment.
3. The bus master-slave device determination method according to claim 1, wherein the relationship between the ID information of the bus device and the time indicated by the delay information is a one-to-one relationship.
4. A bus master slave device determination method according to claim 1, characterized in that said master slave determination step is performed by a power-on trigger.
5. The bus master-slave device determination method as claimed in claim 1, wherein the master assertion signal is transmitted with a period less than a time indicated by the preset delay information.
6. A bus master slave device determination system, comprising:
a master-slave determination module: if the first condition is met, transmitting a master equipment confirmation signal which indicates the self equipment as the bus master equipment to the bus; otherwise, determining the self equipment as the bus slave equipment; wherein the first condition comprises
Condition B: the method comprises the steps that no master equipment confirmation signal is received from a bus within the time indicated by delay information preset by self equipment, and no master equipment declaration signal is received from the bus, wherein the master equipment declaration signal indicates that bus master equipment currently exists in the bus;
The bus master and slave devices are all building blocks;
the method comprises the following steps:
a master device detection module: judging whether a master declaration signal is received from the bus; if receiving a main equipment declaration signal, determining self equipment as bus slave equipment; otherwise, entering the master-slave determining module to continue execution.
7. The bus master-slave device determination system of claim 6, wherein the master-slave determination module comprises:
a delay information obtaining module: and obtaining the preset delay information according to the ID information of the self equipment.
8. The bus master-slave device determination system according to claim 6, wherein the relationship between the ID information of the bus device and the time indicated by the delay information is a one-to-one relationship.
9. A bus master slave device determination system according to claim 6, wherein the master slave determination module is executed by a power-on trigger.
10. The bus master slave determination system as claimed in claim 6, wherein the master assertion signal is transmitted with a period less than the time indicated by the predetermined delay information.
11. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 4.
12. A bus device comprising a controller, wherein the controller comprises the bus master slave device determination system of any one of claims 6 to 10, or the computer readable storage medium of claim 11 having a computer program stored thereon.
CN201811347725.2A 2018-11-13 2018-11-13 Bus master-slave equipment determining method and system, medium and bus equipment Active CN109481946B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811347725.2A CN109481946B (en) 2018-11-13 2018-11-13 Bus master-slave equipment determining method and system, medium and bus equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811347725.2A CN109481946B (en) 2018-11-13 2018-11-13 Bus master-slave equipment determining method and system, medium and bus equipment

Publications (2)

Publication Number Publication Date
CN109481946A CN109481946A (en) 2019-03-19
CN109481946B true CN109481946B (en) 2022-07-15

Family

ID=65694771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811347725.2A Active CN109481946B (en) 2018-11-13 2018-11-13 Bus master-slave equipment determining method and system, medium and bus equipment

Country Status (1)

Country Link
CN (1) CN109481946B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1336598A (en) * 2001-09-07 2002-02-20 清华大学 Quasi-synchronous master-slave remote education information management system and its implementation method
CN106776436A (en) * 2017-01-12 2017-05-31 烽火通信科技股份有限公司 A kind of high-speed serial bus structure and its communication means suitable for multiple spot interconnection
CN107754349A (en) * 2017-12-04 2018-03-06 成都伟嘉斯特科技有限公司 Intelligent building blocks
CN108351851A (en) * 2015-09-11 2018-07-31 思睿逻辑国际半导体有限公司 More equipment of multiple equipment synchronize
CN108536636A (en) * 2018-04-02 2018-09-14 郑州云海信息技术有限公司 A kind of master-slave negotiation sequential machine based on PECI buses
CN108563593A (en) * 2018-04-12 2018-09-21 四川升华电源科技有限公司 A kind of host determination method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1336598A (en) * 2001-09-07 2002-02-20 清华大学 Quasi-synchronous master-slave remote education information management system and its implementation method
CN108351851A (en) * 2015-09-11 2018-07-31 思睿逻辑国际半导体有限公司 More equipment of multiple equipment synchronize
CN106776436A (en) * 2017-01-12 2017-05-31 烽火通信科技股份有限公司 A kind of high-speed serial bus structure and its communication means suitable for multiple spot interconnection
CN107754349A (en) * 2017-12-04 2018-03-06 成都伟嘉斯特科技有限公司 Intelligent building blocks
CN108536636A (en) * 2018-04-02 2018-09-14 郑州云海信息技术有限公司 A kind of master-slave negotiation sequential machine based on PECI buses
CN108563593A (en) * 2018-04-12 2018-09-21 四川升华电源科技有限公司 A kind of host determination method and device

Also Published As

Publication number Publication date
CN109481946A (en) 2019-03-19

Similar Documents

Publication Publication Date Title
US10067895B2 (en) Systems and methods for asynchronous toggling of I2C data line
WO2017143762A1 (en) Terminal, crash reset control circuit and method
TW201923606A (en) I3C in-band interrupts directed to multiple execution environments
CN102193610A (en) Power management method and related power management system
US20150312868A1 (en) Node device and method for communication
CN201562158U (en) Multi-robot synchronous control system
US20170153680A1 (en) Power Management System and Method
JP2006040293A (en) Device for setting data transfer rate of serial ata interface and its method
CN107077188A (en) Interconnection wakes up response circuit and method
CN105637433A (en) Control device and control method
JP2016518095A5 (en)
CN109395418B (en) Bus master-slave equipment determining method and system, medium thereof and bus equipment
CN103281261A (en) Ethernet communication method and Ethernet communication system
US9910819B2 (en) Two-wire serial interface and protocol
KR20060114270A (en) Master device, control method thereof and electronic apparatus having master device
TW201908984A (en) Accelerated i3c stop initiated by a third party
CN105183509A (en) Apparatus and method for realizing shutdown of system power after soft-off
CN109481946B (en) Bus master-slave equipment determining method and system, medium and bus equipment
US20160357194A1 (en) Method of controlling inverters
US9720489B2 (en) System comprising a main electrical unit and a peripheral electrical unit
CN102445981B (en) Data transmission system and data transmission method
US20140082392A1 (en) Semiconductor device and communication method
CN103945252A (en) Electronic equipment awakening method and device, Bluetooth module and electronic equipment
JP2007166196A (en) Communication terminal device, its starting method and communication system
CN104077185A (en) Shared device switching method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant