CN117176499A - Communication transmission method, device, system, equipment and medium of master-slave equipment - Google Patents
Communication transmission method, device, system, equipment and medium of master-slave equipment Download PDFInfo
- Publication number
- CN117176499A CN117176499A CN202310900706.2A CN202310900706A CN117176499A CN 117176499 A CN117176499 A CN 117176499A CN 202310900706 A CN202310900706 A CN 202310900706A CN 117176499 A CN117176499 A CN 117176499A
- Authority
- CN
- China
- Prior art keywords
- slave device
- expansion unit
- master
- slave
- communication
- 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.)
- Pending
Links
- 230000006854 communication Effects 0.000 title claims abstract description 343
- 238000004891 communication Methods 0.000 title claims abstract description 342
- 230000005540 biological transmission Effects 0.000 title claims abstract description 109
- 238000000034 method Methods 0.000 title claims abstract description 75
- 230000002093 peripheral effect Effects 0.000 claims abstract description 48
- 238000004590 computer program Methods 0.000 claims description 11
- 235000015429 Mirabilis expansa Nutrition 0.000 description 22
- 244000294411 Mirabilis expansa Species 0.000 description 22
- 235000013536 miso Nutrition 0.000 description 22
- 238000010586 diagram Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 6
- 238000012544 monitoring process Methods 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Information Transfer Systems (AREA)
Abstract
The communication transmission method, device, system, equipment and medium of the master-slave equipment provided by the invention are suitable for the technical field of data transmission. Through setting up of communication extension unit, based on serial peripheral interface bus, the port of master device is connected with the port of the host computer end of communication extension unit corresponds, and the port of slave device is connected with the port of the slave machine end of communication extension unit corresponds, guarantees that a plurality of slaves can link to each other with same host computer, and the host computer still keeps four pins based on serial peripheral interface bus, and the host computer only need an SS line can realize the communication with a plurality of slaves to reduce the pin burden of host computer, be convenient for PCB wiring simultaneously.
Description
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to a method, an apparatus, a system, a device, and a medium for communication transmission between a master device and a slave device.
Background
The serial peripheral interface (Serial Peripheral Interface, SPI) bus is a high-speed, full-duplex, synchronous communication bus, and occupies only four wires at the pins of the chip, thereby saving the pins of the chip, and simultaneously saving space on the layout of the printed circuit board (Printed Circuit Board, PCB), and providing convenience.
The SPI bus operates in a master-slave manner, with this mode of communication typically having one master device and one or more slave devices. The SPI bus is composed of an SPI Clock (SCLK), a master device data output, a Slave device data input (Master Output Slave Input, MISO), a master device data input, a Slave device data output (Master Input Slave Output, MOSI) and a Slave device Select Signal (SS) signal to realize high-speed communication between the master device and the Slave device. When the SPI master device mounts a plurality of slave devices, corresponding SS interfaces which are the same as the number of the slave devices are added according to the number of the slave devices, and the load of chip pins is increased intangibly. If more slave devices are mounted at one time, more wiring and research and development costs are occupied for hardware cost and PCB layout.
Therefore, a need exists for a communication transmission method for a master-slave device.
Disclosure of Invention
The invention aims to provide a communication transmission method, a device, a system, equipment and a medium of master-slave equipment, which ensure that a plurality of slaves can be connected with the same host through the arrangement of a communication expansion unit so as to reduce the pin burden of the host and facilitate PCB wiring.
In order to solve the technical problems, the invention provides a communication transmission method of master equipment and slave equipment, which is applied to master equipment of a master equipment transmission system, wherein the master equipment transmission system comprises the master equipment, slave equipment and a communication expansion unit; based on a serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, and the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of slave devices, and the slave devices are correspondingly connected, and the method comprises:
acquiring address information of target slave equipment, wherein the address information is stored in the communication expansion unit in advance;
transmitting the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information;
and after the communication expansion unit conducts the target slave device, releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
In one aspect, determining that the communication expansion unit turns on the target slave device includes:
And determining that the communication expansion unit conducts the target slave device when the communication expansion unit transmits a first level signal of a data input port of the master device to the target slave device.
In another aspect, determining that the communication expansion unit turns on the target slave device includes:
receiving the address information;
judging whether the address information is the same as the address information of the target slave device stored in the address information base;
if the address information is the same, determining that the address information is correct, and conducting the target slave device.
In another aspect, the establishing a communication connection between the master device and the target slave device includes:
setting a signal of the slave device select signal port to a second level signal;
controlling the communication expansion unit to connect the host end with the slave device selection signal port corresponding to the slave end;
and after a preset clock period, setting the signal of the slave device selection signal port as a third level signal, and establishing connection with the target slave device through the communication expansion unit.
In another aspect, after the establishing the communication connection between the master device and the target slave device, the method further includes:
Setting a signal of the slave device selection signal port from the third level signal to the second level signal;
and controlling the communication expansion unit to block the signal of the target slave device so as to disconnect the target slave device.
In order to solve the technical problems, the invention also provides a communication transmission method of the master-slave device, which is applied to a communication expansion unit of a master-slave device transmission system, wherein the master-slave device transmission system comprises a master device, a slave device and the communication expansion unit; based on a serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, and the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of slave devices, and the slave devices are correspondingly connected, and the method comprises:
receiving address information of a target slave device sent by the master device, wherein the address information is stored in the communication expansion unit in advance;
and turning on the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
In order to solve the technical problem, the invention also provides a communication transmission system of a master device and a slave device, wherein the master device transmission system comprises a master device, a slave device and a communication expansion unit, and the communication transmission system comprises:
based on a serial peripheral interface bus, the port of the main equipment is correspondingly connected with the port of the host end of the communication expansion unit;
the ports of the slave devices are correspondingly connected with the ports of the slave terminals of the communication expansion unit, wherein the number of the slave device selection signal ports in the ports of the slave terminals of the communication expansion unit is the same as that of the slave devices, and the slave devices are correspondingly connected;
the master device is used for acquiring address information of the target slave device, wherein the address information is stored in the communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information; and after the communication expansion unit conducts the target slave device, releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
In order to solve the above technical problem, the present invention further provides a communication transmission apparatus of a master device and a slave device, which is applied to a master device of a master device transmission system, where the master device transmission system includes the master device, a slave device, and a communication expansion unit, and based on a serial peripheral interface bus, ports of the master device are correspondingly connected to ports of a host end of the communication expansion unit, ports of the slave device are correspondingly connected to ports of a slave end of the communication expansion unit, where the number of slave device selection signal ports in ports of the slave end of the communication expansion unit is the same as the number of slave devices, and the apparatus is correspondingly connected, and includes:
The acquisition module is used for acquiring address information of the target slave device, wherein the address information is stored in the communication expansion unit in advance;
a transmitting module, configured to transmit the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information;
and the releasing module is used for releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device after the communication expansion unit is conducted on the target slave device.
In order to solve the above technical problem, the present invention further provides a communication transmission apparatus of a master device, applied to a communication expansion unit of a master device transmission system, where the master device transmission system includes a master device, a slave device, and the communication expansion unit, based on a serial peripheral interface bus, ports of the master device are correspondingly connected with ports of a host end of the communication expansion unit, ports of the slave device are correspondingly connected with ports of a slave end of the communication expansion unit, where the number of slave device selection signal ports in ports of the slave end of the communication expansion unit is the same as the number of slave devices, and the apparatus is correspondingly connected, and includes:
A receiving module, configured to receive address information of a target slave device sent by the master device, where the address information is stored in the communication expansion unit in advance;
and the conduction module is used for conducting the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
In order to solve the technical problem, the present invention further provides a communication transmission device of a master-slave device, including:
a memory for storing a computer program;
and a processor for implementing the steps of the communication transmission method of the master-slave device as described above when executing the computer program.
To solve the above technical problem, the present invention further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the communication transmission method of the master-slave device as described above.
The invention provides a communication transmission method of a master device and a slave device, which is applied to the master device of a master device transmission system and the master device transmission system comprises the master device, the slave devices and a communication expansion unit, wherein based on a serial peripheral interface bus, the ports of the master device are correspondingly connected with the ports of a host end of the communication expansion unit, the ports of the slave device are correspondingly connected with the ports of a slave end of the communication expansion unit, the number of the slave device selection signal ports in the ports of the slave end of the communication expansion unit is the same as the number of the slave devices, and the ports are correspondingly connected, and the method comprises the following steps: acquiring address information of target slave equipment, wherein the address information is stored in a communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit conducts the target slave device according to the address information; after the communication expansion unit turns on the target slave device, the serial peripheral interface bus is released to establish a communication connection between the master device and the target slave device. According to the method, through the arrangement of the communication expansion unit, the plurality of slaves can be connected with the same host, the host still maintains four pins based on the serial peripheral interface bus, and the host can realize communication with the plurality of slaves only by one SS line, so that the pin burden of the host is reduced, and meanwhile, PCB wiring is facilitated.
In addition, the invention also provides a communication transmission method of the master-slave equipment, a communication transmission device, a system, equipment and a medium of the master-slave equipment, which are applied to the communication expansion unit, and have the same beneficial effects as the communication transmission method of the master-slave equipment.
Drawings
For a clearer description of embodiments of the present invention, the drawings that are required to be used in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
Fig. 1 is a flowchart of a communication transmission method of a master device and a slave device applied to a master device according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a master-slave transmission system according to an embodiment of the present invention;
FIG. 3 is a flowchart of a communication expansion unit according to an embodiment of the present invention;
fig. 4 is a timing diagram of a master device configured communication expansion unit according to an embodiment of the present invention;
fig. 5 is a flowchart of a communication transmission method applied to a master device and a slave device of a communication expansion unit according to an embodiment of the present invention;
Fig. 6 is a block diagram of a communication transmission device of a master-slave device according to an embodiment of the present invention;
fig. 7 is a block diagram of another communication transmission apparatus of a master-slave device according to an embodiment of the present invention;
fig. 8 is a block diagram of a communication transmission device of a master-slave device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without making any inventive effort are within the scope of the present invention.
The core of the invention is to provide a communication transmission method, a device, a system, equipment and a medium of master-slave equipment, which ensure that a plurality of slaves can be connected with the same host through the arrangement of a communication expansion unit so as to reduce the pin burden of the host and facilitate the PCB wiring.
In order to better understand the aspects of the present invention, the present invention will be described in further detail with reference to the accompanying drawings and detailed description.
It should be noted that the serial peripheral interface is one of the more widely used interfaces between the microcontroller (Microcontroller Unit, MCU) and the peripheral integrated circuits (Integrated Circuit, IC), such as sensors, analog-to-Digital Converter (ADC), digital-to-AnalogConverter, DAC (Digital-to-AnalogConverter, DAC), shift registers, static Random access memory (Static Random AccessMemory, SRAM), and the like. SPI is a synchronous, full duplex, master-slave interface. Data from the master or slave is synchronized on the rising or falling edge of the clock, and the master and slave can transmit data at the same time. The device that generates the clock signal is called a master, and data transmitted between the master and the slave is synchronized with the clock generated by the master. The SPI interface can have only one master, but can have multiple slaves. The chip select signal from the master is used to select the slave. This is typically an active low signal and when pulled high, the slave disconnects from the master. When multiple slaves are used, the master needs to provide a separate chip select signal for each slave. MOSI and MISO are data lines. The MOSI transmits data from the host to the slave, and the MISO transmits data from the slave to the host, so that data interaction between the host and the slave is realized.
To begin SPI communication, the master selects the slave by enabling the SS signal, and sends a clock signal. The chip select (SS) is typically an active low signal. Thus, the master must send a logical "0" on this signal to select the slave. SPI is a full duplex communication interface, where a master and a slave can send and receive data (data interactions) over MOSI and MISO lines, respectively. During SPI communication, data transmission (serial shift-out to MOSI/MISO) and reception (MISO/MOSI) can occur simultaneously. The serial clock edge synchronizes the shifting and sampling of data. The SPI interface allows the user to flexibly select either rising or falling edge sampling (read operation, input) or shifting (write operation, output). Both read and write operation bytes start with the most significant bit (MostSignificant Bit, MSB).
Fig. 1 is a flowchart of a communication transmission method of a master device and a slave device, where the method is applied to a master device of a master device transmission system, and the master device transmission system includes a master device, a slave device and a communication expansion unit; based on the serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of the slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of the slave devices, and the slave devices are correspondingly connected, and the method comprises the following steps:
S11: acquiring address information of target slave equipment, wherein the address information is stored in a communication expansion unit in advance;
s12: transmitting the address information to the communication expansion unit so that the communication expansion unit conducts the target slave device according to the address information;
s13: after the communication expansion unit turns on the target slave device, the serial peripheral interface bus is released to establish a communication connection between the master device and the target slave device.
Specifically, fig. 2 is a schematic diagram of a master-slave device transmission system provided by the embodiment of the present invention, as shown in fig. 2, a master device and a slave device in fig. 2 are a master device and a slave device, a master end of a communication expansion unit 2 is connected to four interfaces of the master device 1, and a slave end of the communication expansion unit 2 is connected to n slave devices 3. The SCLK, MOSI, MISO interface to which the communication expansion unit 2 and the slave 3 are connected may be shared, or may be separately separated, and fig. 2 is shared. The communication expansion unit 2 is connected to the SS interfaces of the slave 1, the slave 2 and the slave … … slave n via the interfaces SS1, SS2 and … … SSn, respectively. In the SS signal connection process between the master 1 and the slaves 3, the signal acquired by the sensor is given to each of the slaves, and if the SS interfaces of the slaves are shared, the signal of the master is given to the target slave, but since one SS interface is shared, all the slaves receive the signal, so that communication connection to only the target slave cannot be realized, and the plurality of SS interfaces of the slave end of the communication expansion unit are correspondingly set according to the number of the slaves. The master device and the slave device in the communication expansion unit 2 may be provided in one device, or may be provided in different devices, which are collectively called a communication expansion unit.
Address information of a target slave device is acquired, wherein the address information is stored in a communication expansion unit in advance. The address information of the target slave device is the access address of the communication expansion unit, and the target slave device itself does not need address information, but only address information effective in the communication expansion unit for the communication between the master device and the corresponding slave device in the communication process. The address information in the present embodiment is information predefined by the manufacturer itself or predefined by an instruction manual. The invention is applicable to all SPI devices, the number of the slave devices is a plurality, and the addresses of the slave devices 1-4 are 0001, 0010, 0100 and 1000 by taking the serial number addresses of the slave devices 4 in the communication expansion unit as examples. When the host computer and the No. 2 slave computer are communicated, the power is firstly supplied, the communication expansion unit waits for a signal connected with the host computer, and the address of the slave computer to be connected with the host computer is sent to the expansion device. Because the address information of each slave is stored in the expansion device in advance, the communication expansion unit turns on the target slave device according to the address information.
In some embodiments, how the target slave device is logically turned on in hardware includes:
The communication expansion unit is determined to turn on the target slave device when the communication expansion unit transmits a first level signal of the master device data input port to the target slave device.
Specifically, the communication expansion unit transmits a high level to the target slave device at the MISO, and when the communication expansion unit completes the line connection with the slave, sets the MISO to a low level, that is, transmits a connection completion signal.
How to determine the on-target slave device with the communication expansion unit as the execution subject, in some embodiments, determining the communication expansion unit to turn on the target slave device includes:
receiving address information;
judging whether the address information is the same as the address information of the target slave device stored in the address information base;
if the address information is the same, determining that the address information is correct, and switching on the target slave device.
The host first sends address information of the target slave device, for example, the target slave device is slave device No. 2, the address information is 0010, and monitors the MISO signal after the sending is finished. And after receiving the address information, the communication expansion unit compares the address information with the address information of each slave device one by one, if the address information is the same, the communication expansion unit determines that the address information is correct, and conducts the slave device No. 2. The signals of slave nos. 1, 3 and 4 are blocked and maintained until the host completes communication with the target slave.
Fig. 3 is a flowchart of a communication expansion unit according to an embodiment of the present invention, as shown in fig. 3, after power-up, the communication expansion unit waits for a signal connected to a host, and the host sends a slave address to be connected to the communication expansion unit, where the communication expansion unit sends a high level at a MISO. When the communication expansion unit completes the line connection with the slave, the MISO is set to be low level, namely a connection completion signal is sent, and the SPI bus is released after the host receives the signal. The host then connects the communication expansion unit again, at which point the host has substantially achieved a connection with the slave, and after the host has completed communication with the slave, the host releases the bus, and the communication expansion unit disconnects the connection with the slave, awaiting a reconnection with the host.
Specifically, after the communication expansion unit turns on the target slave device, the SPI bus is released, and the communication connection between the master device and the target slave device is subsequently established.
The embodiment of the invention provides a communication transmission method of a master device and a slave device, which is applied to a master device of a master device transmission system and the master device transmission system comprises the master device, the slave devices and a communication expansion unit, wherein the ports of the master device are correspondingly connected with the ports of a host end of the communication expansion unit based on a serial peripheral interface bus, the ports of the slave device are correspondingly connected with the ports of a slave end of the communication expansion unit, the number of slave device selection signal ports in the ports of the slave end of the communication expansion unit is the same as the number of the slave devices, and the ports are correspondingly connected, and the method comprises the following steps: acquiring address information of target slave equipment, wherein the address information is stored in a communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit conducts the target slave device according to the address information; after the communication expansion unit turns on the target slave device, the serial peripheral interface bus is released to establish a communication connection between the master device and the target slave device. According to the method, through the arrangement of the communication expansion unit, the plurality of slaves can be connected with the same host, the host still maintains four pins based on the serial peripheral interface bus, and the host can realize communication with the plurality of slaves only by one SS line, so that the pin burden of the host is reduced, and meanwhile, PCB wiring is facilitated.
Based on the above embodiments, in some embodiments, establishing a communication connection between a master device and a target slave device includes:
setting a signal of the slave device selection signal port to a second level signal;
the control communication expansion unit connects the host end with a slave device selection signal port corresponding to the slave end;
after a preset clock period, the signal of the slave device selection signal port is set to be a third level signal, and connection is established with the target slave device through the communication expansion unit.
It can be understood that after the host sets the SS signal to 1, the communication expansion unit directly connects the host end with the SCLK, MISO, MOSI interface of the slave end, and directly connects the SS interface of the host end with the SS2 interface of the slave end. Waiting for two to three clock cycles (preset clock cycle), the host computer again communicates with the communication expansion unit by pulling down the SS signal, at this time, the host computer and the slave computer 2 are directly connected, the SCLK, MOSI, MISO, SS of the host computer is connected with the slave computer 2 through SCLK, MOSI, MISO, SS at the slave computer end of the communication expansion unit to realize communication, and the communication expansion unit enters a monitoring state to wait for the host computer to complete communication.
In some embodiments, after establishing the communication connection between the master device and the target slave device, further comprising:
Setting a signal of the slave device selection signal port from the third level signal to the second level signal;
the control communication expansion unit blocks the signal of the target slave device to disconnect the connection with the target slave device.
Specifically, after the master completes communication with the slave 2, the SS signal is pulled up, the communication expansion unit detects that the SS signal is pulled up, blocks the SS2 signal, and disconnects the connection channel between the master and the slave. The communication expansion unit enters a monitoring state, waits for the configuration of the communication expansion unit by the host, and enters the process of repeating the above steps.
Fig. 4 is a timing chart of a master device configuration communication expansion unit according to an embodiment of the present invention, where, as shown in fig. 4, the steps include:
the first step: the SCLK, MISO, MOSI interfaces of the 4 slaves are connected with the corresponding interfaces of the slave end of the communication expansion unit, then the 4 slaves are respectively connected with the SS1, SS2, SS3 and SS4 interfaces of the slave end in sequence, and the host is connected with the host end of the communication expansion unit.
And a second step of: the host configures the communication expansion unit with the timing shown in fig. 3. The host firstly transmits the address 0010 of the No. 2 slave, and monitors the MISO signal after the transmission is finished. After receiving the address information, the communication expansion unit turns on the SS2, blocks and holds the SS1, SS3 and SS4 signals until the master completes communication with the slave 2. After the communication expansion unit completes conduction, the MISO signal is set to 0, and the host releases the SPI bus after the host monitors that the MISO signal is set to 0.
And a third step of: after the host sets the SS signal to 1, the communication expansion unit directly connects the host end with the SCLK, MISO, MOSI interface of the slave end, and directly connects the SS interface of the host end with the SS2 interface of the slave end.
Fourth step: waiting for two to three clock cycles, the host computer again communicates with the communication expansion unit by pulling down the SS signal, at this time, the host computer and the slave computer 2 are directly connected, the SCLK, MOSI, MISO, SS of the host computer is connected with the slave computer 2 through SCLK, MOSI, MISO, SS on the slave computer end of the communication expansion unit to realize communication, and the communication expansion unit enters a monitoring state to wait for the host computer to complete communication.
Fifth step: after the host computer completes the communication with the slave computer 2, the SS signal is pulled high, the communication expansion unit detects that the SS signal is pulled high, the SS2 signal is blocked, and the connection channel of the host computer and the slave computer is disconnected.
Sixth step: the communication expansion unit enters a monitoring state, waits for the configuration of the communication expansion unit by the host, and enters a second step to repeat the process.
The communication connection and disconnection process between the master device and the target slave device provided by the embodiment of the invention can realize the communication with a plurality of slaves only by one SS line.
Fig. 5 is a flowchart of a communication transmission method of a master device and a slave device applied to a communication expansion unit, where the method is applied to a communication expansion unit of a master device transmission system and is characterized in that the master device transmission system includes a master device, a slave device and a communication expansion unit, as shown in fig. 5; based on the serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of the slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of the slave devices, and the slave devices are correspondingly connected, and the method comprises the following steps:
S21: receiving address information of a target slave device sent by a master device, wherein the address information is stored in a communication expansion unit in advance;
s22: and switching on the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
The present embodiment may refer to a master device embodiment applied to a master-slave device transmission system, and will not be described herein.
The embodiment of the invention provides a communication transmission method of a master device and a slave device, which is applied to a communication extension unit of a master device transmission system and the slave device transmission system, wherein the master device transmission system comprises a master device, slave devices and the communication extension unit, ports of the master device are correspondingly connected with ports of a host end of the communication extension unit based on a serial peripheral interface bus, ports of the slave device are correspondingly connected with ports of a slave end of the communication extension unit, the number of slave device selection signal ports in the ports of the slave end of the communication extension unit is the same as the number of the slave devices, and the method comprises the following steps of: receiving address information of a target slave device sent by a master device, wherein the address information is stored in a communication expansion unit in advance; and switching on the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device. According to the method, through the arrangement of the communication expansion unit, the plurality of slaves can be connected with the same host, the host still maintains four pins based on the serial peripheral interface bus, and the host can realize communication with the plurality of slaves only by one SS line, so that the pin burden of the host is reduced, and meanwhile, PCB wiring is facilitated.
As shown in fig. 2, a communication transmission system of a master device, the master device transmission system including a master device, a slave device, and a communication expansion unit, includes:
based on the serial peripheral interface bus, the port of the main equipment is correspondingly connected with the port of the host end of the communication expansion unit;
the ports of the slave devices are correspondingly connected with the ports of the slave terminals of the communication expansion units, wherein the number of the slave device selection signal ports in the ports of the slave terminals of the communication expansion units is the same as that of the slave devices, and the slave devices are correspondingly connected;
the master device is used for acquiring address information of the target slave device, wherein the address information is stored in the communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit conducts the target slave device according to the address information; after the communication expansion unit turns on the target slave device, the serial peripheral interface bus is released to establish a communication connection between the master device and the target slave device.
The corresponding connection relationship of the present embodiment may refer to fig. 2, where the master-slave device transmission system provided by the embodiment of the present invention includes a master device, a slave device, and a communication expansion unit, based on a serial peripheral interface bus, ports of the master device are correspondingly connected with ports of a host end of the communication expansion unit, ports of the slave device are correspondingly connected with ports of a slave end of the communication expansion unit, where the number of slave device selection signal ports in ports of the slave end of the communication expansion unit is the same as the number of slave devices, and are correspondingly connected. The method comprises the steps that a master device obtains address information of a target slave device, wherein the address information is stored in a communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit conducts the target slave device according to the address information; after the communication expansion unit turns on the target slave device, the serial peripheral interface bus is released to establish a communication connection between the master device and the target slave device. The communication transmission system ensures that a plurality of slaves can be connected with the same host through the arrangement of the communication expansion unit, the host still maintains four pins based on the serial peripheral interface bus, and the host can realize communication with the slaves only by one SS wire, so that the pin burden of the host is reduced, and meanwhile, the PCB wiring is facilitated.
The invention further discloses a communication transmission device of the master-slave device, which is applied to the master device of the master-slave device transmission system, wherein the master-slave device transmission system comprises the master device, the slave devices and a communication expansion unit, the ports of the master device are correspondingly connected with the ports of the master end of the communication expansion unit, the ports of the slave device are correspondingly connected with the ports of the slave end of the communication expansion unit based on the serial peripheral interface bus, and the number of the slave device selection signal ports in the ports of the slave end of the communication expansion unit is the same as that of the slave devices and correspondingly connected. Fig. 6 is a block diagram of a communication transmission apparatus of a master-slave device according to an embodiment of the present invention. As shown in fig. 6, the communication transmission apparatus of the master-slave device includes:
an obtaining module 11, configured to obtain address information of a target slave device, where the address information is stored in the communication expansion unit in advance;
a transmitting module 12 for transmitting the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information;
and the releasing module 13 is used for releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device after the communication expansion unit turns on the target slave device.
In some embodiments, the transmitting module includes:
and the first determining module is used for determining that the communication expansion unit conducts the target slave device when the communication expansion unit transmits the first level signal of the data input port of the master device to the target slave device.
In some embodiments, the transmitting module includes:
the receiving module is used for receiving the address information;
the judging module is used for judging whether the address information is the same as the address information of the target slave device stored in the address information base, and triggering the second determining module if the address information is the same as the address information of the target slave device stored in the address information base;
and the second determining module is used for determining that the address information is correct and switching on the target slave device.
In some embodiments, the release module comprises:
a first setting module for setting a signal of the slave device selection signal port to a second level signal;
the first control module is used for controlling the communication expansion unit to connect the host end with a slave device selection signal port corresponding to the slave end;
and the second setting module is used for setting the signal of the slave device selection signal port to be a third level signal after a preset clock period, and establishing connection with the target slave device through the communication expansion unit.
In some embodiments, further comprising:
A third setting module for setting the signal of the slave device selection signal port from the third level signal to the second level signal;
and the second control module is used for controlling the communication expansion unit to block the signal of the target slave device so as to disconnect the target slave device.
Since the embodiments of the device portion correspond to the above embodiments, the embodiments of the device portion are described with reference to the embodiments of the method portion, and are not described herein.
For the description of the communication transmission device of the master-slave device provided by the present invention, refer to the above method embodiment, and the present invention is not described herein again, and has the same beneficial effects as the communication transmission method of the master-slave device.
The invention further discloses a communication transmission device of the master device, which is applied to a communication expansion unit of a master device transmission system, the master device transmission system comprises a master device, a slave device and a communication expansion unit, ports of the master device are correspondingly connected with ports of a master end of the communication expansion unit, ports of the slave device are correspondingly connected with ports of a slave end of the communication expansion unit based on a serial peripheral interface bus, and the number of slave device selection signal ports in ports of the slave end of the communication expansion unit is the same as that of the slave device and is correspondingly connected. Fig. 7 is a block diagram of another communication transmission apparatus of a master-slave device according to an embodiment of the present invention. As shown in fig. 7, the communication transmission apparatus of the master-slave device includes:
A receiving module 14 for receiving address information of a target slave device transmitted by a master device, wherein the address information is stored in a communication expansion unit in advance;
and the conduction module 15 is used for conducting the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
For the description of the communication transmission device of another master-slave device provided by the present invention, please refer to the above method embodiment, the present invention is not described herein, and the method has the same advantages as the above method for communication transmission of the master-slave device.
Fig. 8 is a block diagram of a communication transmission device of a master-slave device according to an embodiment of the present invention, as shown in fig. 8, where the apparatus includes:
a memory 21 for storing a computer program;
a processor 22 for implementing the steps of the communication transmission method of the master and slave devices when executing the computer program.
The communication transmission device of the master device and the slave device provided in this embodiment may include, but is not limited to, a tablet computer, a notebook computer, a desktop computer, or the like.
Processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like, among others. The processor 22 may be implemented in hardware in at least one of a digital signal processor (Digital Signal Processor, DSP), a Field programmable gate array (Field-Programmable Gate Array, FPGA), a programmable logic array (Programmable Logic Array, PLA). The processor 22 may also include a main processor, which is a processor for processing data in an awake state, also referred to as a central processor (Central Processing Unit, CPU), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 22 may be integrated with an image processor (Graphics Processing Unit, GPU) for use in responsible for rendering and rendering of content required for display by the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (Artificial Intelligence, AI) processor for processing computing operations related to machine learning.
Memory 21 may include one or more computer-readable storage media, which may be non-transitory. Memory 21 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used for storing a computer program 211, where the computer program is loaded and executed by the processor 22 to implement the relevant steps of the communication transmission method of the master-slave device disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 21 may further include an operating system 212, data 213, and the like, and the storage manner may be transient storage or permanent storage. The operating system 212 may include Windows, unix, linux, among other things. The data 213 may include, but is not limited to, data related to a communication transmission method of the master device and the slave device, and the like.
In some embodiments, the communication transmission device of the master device may further include a display screen 23, an input/output interface 24, a communication interface 25, a power supply 26, and a communication bus 27.
It will be appreciated by those skilled in the art that the structure shown in fig. 8 does not constitute a limitation of the communication transmission device of the master-slave device, and may include more or less components than those illustrated.
The processor 22 implements the communication transmission method of the master-slave device provided in any of the above embodiments by calling the instructions stored in the memory 21.
For the description of the communication transmission device of the master device and the slave device provided by the present invention, refer to the above method embodiment, and the present invention is not repeated herein, and has the same beneficial effects as the communication transmission method of the master device and the slave device.
Further, the present invention also provides a computer readable storage medium having a computer program stored thereon, which when executed by the processor 22 implements the steps of the communication transmission method of the master-slave device as described above.
It will be appreciated that the methods of the above embodiments, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored on a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution, which contributes to the related art, in the form of a software product stored in a storage medium, performing all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only memory (ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
For an introduction to a computer readable storage medium provided by the present invention, please refer to the above method embodiment, the present invention is not described herein, and the method has the same advantages as the above communication transmission method of the master device and the slave device.
The above describes the communication transmission method of the master device and the slave device, the communication transmission device of the master device, the system and the medium provided by the invention in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Claims (11)
1. The communication transmission method of the master equipment and the slave equipment is applied to the master equipment of a master equipment and slave equipment transmission system, and is characterized in that the master equipment and the slave equipment transmission system comprise the master equipment, the slave equipment and a communication expansion unit; based on a serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, and the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of slave devices, and the slave devices are correspondingly connected, and the method comprises:
acquiring address information of target slave equipment, wherein the address information is stored in the communication expansion unit in advance;
transmitting the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information;
and after the communication expansion unit conducts the target slave device, releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
2. The communication transmission method of the master-slave device according to claim 1, wherein determining that the communication expansion unit turns on the target slave device comprises:
And determining that the communication expansion unit conducts the target slave device when the communication expansion unit transmits a first level signal of a data input port of the master device to the target slave device.
3. The communication transmission method of the master-slave device according to claim 1, wherein determining that the communication expansion unit turns on the target slave device comprises:
receiving the address information;
judging whether the address information is the same as the address information of the target slave device stored in the address information base;
if the address information is the same, determining that the address information is correct, and conducting the target slave device.
4. A communication transmission method of a master-slave device according to claim 2 or 3, characterized in that the establishing a communication connection of the master device and the target slave device comprises:
setting a signal of the slave device select signal port to a second level signal;
controlling the communication expansion unit to connect the host end with the slave device selection signal port corresponding to the slave end;
and after a preset clock period, setting the signal of the slave device selection signal port as a third level signal, and establishing connection with the target slave device through the communication expansion unit.
5. The communication transmission method of the master-slave device according to claim 4, further comprising, after the establishment of the communication connection of the master device and the target slave device:
setting a signal of the slave device selection signal port from the third level signal to the second level signal;
and controlling the communication expansion unit to block the signal of the target slave device so as to disconnect the target slave device.
6. The communication transmission method of the master-slave device is applied to a communication expansion unit of a master-slave device transmission system and is characterized in that the master-slave device transmission system comprises a master device, a slave device and the communication expansion unit; based on a serial peripheral interface bus, the port of the master device is correspondingly connected with the port of the host end of the communication expansion unit, and the port of the slave device is correspondingly connected with the port of the slave end of the communication expansion unit, wherein the number of slave device selection signal ports in the port of the slave end of the communication expansion unit is the same as the number of slave devices, and the slave devices are correspondingly connected, and the method comprises:
receiving address information of a target slave device sent by the master device, wherein the address information is stored in the communication expansion unit in advance;
And turning on the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
7. A communication transmission system of a master-slave device, characterized in that the master-slave device transmission system includes a master device, a slave device, and a communication expansion unit, comprising:
based on a serial peripheral interface bus, the port of the main equipment is correspondingly connected with the port of the host end of the communication expansion unit;
the ports of the slave devices are correspondingly connected with the ports of the slave terminals of the communication expansion unit, wherein the number of the slave device selection signal ports in the ports of the slave terminals of the communication expansion unit is the same as that of the slave devices, and the slave devices are correspondingly connected;
the master device is used for acquiring address information of the target slave device, wherein the address information is stored in the communication expansion unit in advance; transmitting the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information; and after the communication expansion unit conducts the target slave device, releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
8. A communication transmission apparatus of a master device and a slave device, applied to a master device of a master-slave device transmission system, wherein the master-slave device transmission system includes the master device, a slave device and a communication expansion unit, ports of the master device are correspondingly connected with ports of a host end of the communication expansion unit based on a serial peripheral interface bus, ports of the slave device are correspondingly connected with ports of a slave end of the communication expansion unit, and the number of slave device selection signal ports in the ports of the slave end of the communication expansion unit is the same as the number of slave devices and is correspondingly connected, the apparatus includes:
the acquisition module is used for acquiring address information of the target slave device, wherein the address information is stored in the communication expansion unit in advance;
a transmitting module, configured to transmit the address information to the communication expansion unit so that the communication expansion unit turns on the target slave device according to the address information;
and the releasing module is used for releasing the serial peripheral interface bus to establish communication connection between the master device and the target slave device after the communication expansion unit is conducted on the target slave device.
9. A communication transmission apparatus of a master-slave device, applied to a communication expansion unit of a master-slave device transmission system, characterized in that the master-slave device transmission system includes a master device, a slave device, and the communication expansion unit, ports of the master device are correspondingly connected with ports of a master end of the communication expansion unit based on a serial peripheral interface bus, ports of the slave device are correspondingly connected with ports of a slave end of the communication expansion unit, wherein the number of slave device selection signal ports in the ports of the slave end of the communication expansion unit is the same as the number of slave devices, and correspondingly connected, the apparatus comprises:
a receiving module, configured to receive address information of a target slave device sent by the master device, where the address information is stored in the communication expansion unit in advance;
and the conduction module is used for conducting the target slave device according to the address information so that the master device releases the serial peripheral interface bus to establish communication connection between the master device and the target slave device.
10. A communication transmission device of a master-slave device, comprising:
a memory for storing a computer program;
A processor for implementing the steps of the communication transmission method of a master-slave device according to any one of claims 1 to 6 when executing said computer program.
11. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the communication transmission method of a master-slave device according to any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310900706.2A CN117176499A (en) | 2023-07-21 | 2023-07-21 | Communication transmission method, device, system, equipment and medium of master-slave equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310900706.2A CN117176499A (en) | 2023-07-21 | 2023-07-21 | Communication transmission method, device, system, equipment and medium of master-slave equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117176499A true CN117176499A (en) | 2023-12-05 |
Family
ID=88934444
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310900706.2A Pending CN117176499A (en) | 2023-07-21 | 2023-07-21 | Communication transmission method, device, system, equipment and medium of master-slave equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117176499A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117520220A (en) * | 2024-01-08 | 2024-02-06 | 湖南恩智测控技术有限公司 | Method, system, device and storage medium for automatically updating data |
-
2023
- 2023-07-21 CN CN202310900706.2A patent/CN117176499A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117520220A (en) * | 2024-01-08 | 2024-02-06 | 湖南恩智测控技术有限公司 | Method, system, device and storage medium for automatically updating data |
CN117520220B (en) * | 2024-01-08 | 2024-04-09 | 湖南恩智测控技术有限公司 | Method, system, device and storage medium for automatically updating data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7451257B2 (en) | Universal serial bus device having logical circuit for conversive and immediate host reset operation | |
CN102339267B (en) | I2C address is changed | |
EP0262429B1 (en) | Data processor having a high speed data transfer function | |
CN101398801B (en) | Method and device for expanding internal integrate circuit bus | |
KR100743491B1 (en) | Universal interface devices and method thereof | |
GB2075310A (en) | Bus extender circuitry for data transmission | |
CN104834620B (en) | Serial peripheral equipment interface SPI bus circuit, implementation method and electronic equipment | |
CN117176499A (en) | Communication transmission method, device, system, equipment and medium of master-slave equipment | |
JP2005209057A (en) | Data communication method | |
CN107643993B (en) | Bus conversion interface, working method of bus conversion interface and communication equipment | |
US9684619B2 (en) | I2C router system | |
CN115470163A (en) | Control method, control device, control equipment and storage medium for DMA transmission | |
CN115033515A (en) | Master-slave SPI communication method | |
US6564279B1 (en) | Method and apparatus facilitating insertion and removal of modules in a computer system | |
CN113132198B (en) | Multi-master-slave SPI (Serial peripheral interface) safety communication device and communication method | |
US6438624B1 (en) | Configurable I/O expander addressing for I/O drawers in a multi-drawer rack server system | |
CN111352879A (en) | Same-address slave machine expansion circuit and method based on multi-path gating | |
CN113641610A (en) | Processor interface circuit, time-sharing multiplexing method of processor interface and electronic equipment | |
CN111737183A (en) | Server and communication fault processing method and system of I2C bus | |
CN115328845B (en) | Four-wire serial peripheral interface communication protocol design method | |
WO2005083577A2 (en) | Integrated circuit with two different bus control units | |
JP2024508592A (en) | USB interface multiplexing method, circuit, electronic equipment and storage medium | |
CN115344105A (en) | Chip with multiplexed interfaces and debugging system of chip | |
CN114185720A (en) | Method, device, equipment and storage medium for server dynamic hot backup | |
CN209029000U (en) | Engineering machinery display screen, engineering machinery and project monitor and control system |
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 |