CN108418739A - A kind of token ring network-building method based on SPI - Google Patents
A kind of token ring network-building method based on SPI Download PDFInfo
- Publication number
- CN108418739A CN108418739A CN201810133097.1A CN201810133097A CN108418739A CN 108418739 A CN108418739 A CN 108418739A CN 201810133097 A CN201810133097 A CN 201810133097A CN 108418739 A CN108418739 A CN 108418739A
- Authority
- CN
- China
- Prior art keywords
- equipment
- token
- spi
- main equipment
- ring network
- 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
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/42—Loop networks
- H04L12/427—Loop networks with decentralised control
- H04L12/433—Loop networks with decentralised control with asynchronous transmission, e.g. token ring, register insertion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/46—Interconnection of networks
- H04L12/4637—Interconnected ring systems
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses a kind of token ring network-building method based on SPI, using SPI as token-ring network communication protocol, there are one main equipments and multiple from equipment in network, all devices export input line group circlewise by SPI, it is all to be provided from equipment SPI clock signals by main equipment, it is all to be provided from the SPI chip selection signals of equipment by main equipment, and all use same chip selection signal, the wheel transfer that token is initiated by main equipment judges whether processing information from equipment according to token ring content.Token ring network-building method of the present invention can only use a chip selection signal and carry out token ring networking from equipment and main equipment by multiple, to carry out exchange of token, realization can be in communication with each other between equipment, the pin burden of main equipment in SPI communication is reduced, the microcontroller not abundant especially suitable on piece pin resource carries out networking.
Description
Technical field
The invention belongs to Communication in embedded system technical fields, and in particular to a kind of token ring network-building method based on SPI.
Background technology
SPI (Serial Peripheral Interface) is Serial Peripheral Interface (SPI), be a kind of full duplex, high speed it is logical
Believe that agreement, most of embedded chip all have the function of SPI, only take up four lines, saved the pin of chip, is one kind ten
Divide efficient and universal communication mode.
Token-ring network refers to that communication node is physically connected into loop configuration, the data packet for being referred to as token by one
The sequential delivery on the torus knot point set, each node judge whether to need to receive or change token data, connect if necessary
It receives or changes, otherwise continue token being transferred to subsequent node, so that token directed annular on torus knot point set is moved
It is dynamic.
Tradition in the case of multi-computer communication, SPI use master slave communication mode, a main equipment can connect it is multiple from
Equipment is each required for individual chip selection signal from equipment, as soon as when needing to from equipment transmission data, will correspond to
Chip select pin drag down.Such communication mode has apparent drawback:First, if communicated between equipment, need
By main equipment, the burden of main equipment is increased;Second, need multiple pins to control the different chip selection signals from equipment, this
The pin use of main device is set to be restricted.
Invention content
In view of above-mentioned, the present invention provides a kind of token ring network-building method based on SPI can reduce main in SPI communication
The pin of equipment is born so that can be in communication with each other between equipment.
A kind of token ring network-building method based on SPI, is implemented as follows:
First, make main equipment with it is all from equipment pass through SPI input and output pins and connect circularize, i.e., previous equipment
Output pin is connected with the input pin of the latter equipment;When making all SPI clock pins from equipment with the SPI of main equipment
Clock pin is connected, i.e., provides unified clock by main equipment;Make all SPI chip select pins from equipment with the SPI pieces of main equipment
Select pin to be connected, i.e., it is all to receive the same chip selection signal from equipment, it only exists complete selected or does not choose two states entirely;
Then, the token transfer action often taken turns is initiated by main equipment, selects to receive as needed after being connected to token from equipment
Or it changes token data and token is pushed to the latter equipment.
Further, when system initialization, main equipment is responsible for initializing token, while being deposited being sent from the SPI of equipment
0 is written in device.
Further, main equipment starts token transfer, due to one according to the transmission rate request of system with certain frequency
Complete token data length is likely larger than SPI single data transfer sizes, therefore needs multiple SPI transmission that could complete a wheel and enable
Board transmits.
Further, each round token shifts, and is both needed to first drag down its chip select pin by main equipment, initiates active data and pass
It is defeated.
Further, for main equipment, if system just initializes, first round token is not sent out also completely, main equipment then root
It, will be in next partial write SPI transmitter registers for needing to send according to the issued part size of token;If token is whole
It sends out, then main equipment is consistent with from equipment operation;For from equipment, then directly by the last round of token received from input pin
Data are put into SPI transmitter registers after necessary modification and are sent.
Token ring network-building method of the present invention can only use a chip selection signal by multiple from equipment and main equipment into playing drinking games
Board ring networking, to carry out exchange of token, realization can be in communication with each other between equipment, reduce drawing for main equipment in SPI communication
Foot is born, and the microcontroller not abundant especially suitable on piece pin resource carries out networking.
Description of the drawings
Fig. 1 is the physical arrangement schematic diagram of SPI token-ring networks.
Fig. 2 is the data transmission schematic diagram of SPI token-ring networks.
Specific implementation mode
In order to more specifically describe the present invention, below in conjunction with the accompanying drawings and specific implementation mode is to technical scheme of the present invention
It is described in detail.
The present invention is based on the token ring network-building method of SPI, makes main equipment and pass through SPI input-output lines from equipment and connect into
The output of annular, previous equipment is connected with the input of the latter equipment;By from the SPI clock line of equipment all with main equipment
SPI clock line is connected, and clock is uniformly provided by main equipment;It will all draw from the chip select pin of equipment with the choosing of the SPI pieces of main equipment
Foot is connected, all to only have all selected from equipment and all do not choose two states.
When system initialization, 0 is written in all SPI transmitter registers from equipment, main equipment, which is responsible for initialization, to be enabled
Board;Main equipment starts token transfer according to token-ring network transmission rate request, with certain frequency, because of a complete token
Possible data length is more than SPI single data transfer sizes, so needing multiple SPI transmission that could complete a wheel token transmission;
Each round token shifts, and all drags down chip select pin by main equipment first, initiates active data transmission.
For main equipment, if system just initializes, first round token is not sent out also completely, then issued according to token
Part size, will be in next partial write SPI transmitter registers for needing to send.If token is all sent out, with from
Equipment operation is consistent;For from equipment, then directly by the last round of data received from input line by necessary modification (if
Need to other node transmission data) after be put into SPI transmitter registers and sent, if one needs to handle and enable from equipment
Board data, then it must be before main equipment initiates next round transfer, by DSR.
Following embodiment uses KL02 platforms, and SPI token ring networkings are realized using above-mentioned technical proposal.
(1) one is devised first, physics networking is carried out to multiple KL02 development boards, as shown in Figure 1;By all KL02's
SDI is connected with the SDO of previous KL02, and all SCLK from KL02 are connected with the SCLK of master control KL02, by all from KL02
CS be connected with the CS of master control KL02.
(2) the transmission section core code of master control KL02 is as follows:
(3) as follows from the transmission section core code of KL02:
It is the transmission instance of data below, as shown in Fig. 2, system is made of 1 main equipment and 10 from equipment, from equipment
Number is incremented by since 1, and SPI is sent as unit of 2 bytes.
Token amounts to 6 bytes, and the first byte representation target is from device number, and second byte representation source is from device number, such as
Fruit no data transmits, then is all 0xff, rear 4 bytes are the data to be transmitted.
For main equipment, when system just initializes, ring_len is 6 in above-mentioned code, so 3 times passing
Defeated data source is all some byte of starting token, rather than the data that a upper node-node transmission comes.When the number of transmissions is big
After 3 times, whole system is transmitted into normal token ring.
Assuming that certain node serial number is 2, want to send the node that 4 byte datas are 6 to number, it is first always to latter node
Full 0 data are sent, until it receives primary non-zero SPI data, here it is preceding 2 bytes of token, if target device number
It is inconsistent with this node and be 0xff, then it represents that token is occupied, can not transmission data, this node only needs token is untouched
It is motionless to hand on;If target device number is 0xff, it is revised as 0x0602, then by data portion in latter 2 times
SPI is sent out when transmitting.
The node for being 6 for number, it sends full 0 data to latter node always first, until it receive it is primary non-zero
SPI data, here it is preceding 2 bytes of token, including target device number and source device, it finds that target device number is exactly for oneself
Oneself, just makes the two bytes into 0xffff and is sent to subsequent node, indicate that token is idle, then in rear 2 SPI communications,
The remaining data portion of token is obtained, and is handled.
The above-mentioned description to embodiment can be understood and applied the invention for ease of those skilled in the art.
Person skilled in the art obviously easily can make various modifications to above-described embodiment, and described herein general
Principle is applied in other embodiment without having to go through creative labor.Therefore, the present invention is not limited to the above embodiments, ability
Field technique personnel announcement according to the present invention, the improvement made for the present invention and modification all should be in protection scope of the present invention
Within.
Claims (5)
1. a kind of token ring network-building method based on SPI, it is characterised in that:
First, make main equipment with it is all from equipment pass through SPI input and output pins and connect circularize, i.e., the output of previous equipment
Pin is connected with the input pin of the latter equipment;All SPI clock pins from equipment are made to draw with the SPI clocks of main equipment
Foot is connected, i.e., provides unified clock by main equipment;All SPI chip select pins from equipment are made to draw with the choosing of the SPI pieces of main equipment
Foot is connected, i.e., all to receive the same chip selection signal from equipment, only exists complete selected or does not choose two states entirely;
Then, the token transfer action often taken turns is initiated by main equipment, selects to receive or repair as needed after being connected to token from equipment
Change token data and token is pushed to the latter equipment.
2. token ring network-building method according to claim 1, it is characterised in that:When system initialization, main equipment is responsible for just
Beginningization token, while being written 0 in the SPI transmitter registers from equipment.
3. token ring network-building method according to claim 1, it is characterised in that:Main equipment is wanted according to the transmission rate of system
It asks, token transfer is started with certain frequency, since to be likely larger than SPI single data transmissions big for a complete token data length
It is small, therefore need multiple SPI transmission that could complete a wheel token transmission.
4. token ring network-building method according to claim 1, it is characterised in that:Each round token shifts, and is both needed to first by leading
Equipment drags down its chip select pin, initiates active data transmission.
5. token ring network-building method according to claim 1, it is characterised in that:For main equipment, if system just initializes,
First round token is not sent out also completely, and main equipment is then according to the issued part size of token, by next portion for needing to send
Divide in write-in SPI transmitter registers;If token is all sent out, main equipment is consistent with from equipment operation;For from equipment, then
Directly last round of be put into after necessary modification in SPI transmitter registers from the token data received in input pin is sent out
It send.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810133097.1A CN108418739A (en) | 2018-02-09 | 2018-02-09 | A kind of token ring network-building method based on SPI |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810133097.1A CN108418739A (en) | 2018-02-09 | 2018-02-09 | A kind of token ring network-building method based on SPI |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108418739A true CN108418739A (en) | 2018-08-17 |
Family
ID=63127136
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810133097.1A Pending CN108418739A (en) | 2018-02-09 | 2018-02-09 | A kind of token ring network-building method based on SPI |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108418739A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111970448A (en) * | 2020-08-27 | 2020-11-20 | 上海艾为电子技术股份有限公司 | Optical anti-shake drive circuit, drive system, control method of drive system, and electronic device |
CN112882979A (en) * | 2021-03-15 | 2021-06-01 | 广东拓斯达科技股份有限公司 | Communication system and method |
CN113612817A (en) * | 2021-07-09 | 2021-11-05 | 浙江浙大中控信息技术有限公司 | Decentralized multi-bin intelligent networking system and method |
EP4135270A4 (en) * | 2020-04-10 | 2023-06-07 | Fuji Corporation | Communication system and work apparatus |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020126029A1 (en) * | 2001-03-08 | 2002-09-12 | Grale Trenton John | Programmable test modulator for selectively generating test signals of delta-sigma order N |
CN102420736A (en) * | 2010-09-27 | 2012-04-18 | 罗伯特·博世有限公司 | Serial ring communication arrangement and corresponding method |
EP2645638A1 (en) * | 2012-03-29 | 2013-10-02 | Robert Bosch Gmbh | Communication system with chain or ring topology |
CN103368803A (en) * | 2012-03-29 | 2013-10-23 | 罗伯特·博世有限公司 | Communication configuration and method for debugging, respectively for programming one or more participants of the communication configuration |
CN103368802A (en) * | 2012-03-29 | 2013-10-23 | 罗伯特·博世有限公司 | Communication device and method for configuring programmable hardware |
US20160098371A1 (en) * | 2014-10-07 | 2016-04-07 | Infineon Technologies Ag | Serial peripheral interface daisy chain communication with an in-frame response |
-
2018
- 2018-02-09 CN CN201810133097.1A patent/CN108418739A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020126029A1 (en) * | 2001-03-08 | 2002-09-12 | Grale Trenton John | Programmable test modulator for selectively generating test signals of delta-sigma order N |
CN102420736A (en) * | 2010-09-27 | 2012-04-18 | 罗伯特·博世有限公司 | Serial ring communication arrangement and corresponding method |
EP2645638A1 (en) * | 2012-03-29 | 2013-10-02 | Robert Bosch Gmbh | Communication system with chain or ring topology |
CN103368803A (en) * | 2012-03-29 | 2013-10-23 | 罗伯特·博世有限公司 | Communication configuration and method for debugging, respectively for programming one or more participants of the communication configuration |
CN103368802A (en) * | 2012-03-29 | 2013-10-23 | 罗伯特·博世有限公司 | Communication device and method for configuring programmable hardware |
US20160098371A1 (en) * | 2014-10-07 | 2016-04-07 | Infineon Technologies Ag | Serial peripheral interface daisy chain communication with an in-frame response |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP4135270A4 (en) * | 2020-04-10 | 2023-06-07 | Fuji Corporation | Communication system and work apparatus |
CN111970448A (en) * | 2020-08-27 | 2020-11-20 | 上海艾为电子技术股份有限公司 | Optical anti-shake drive circuit, drive system, control method of drive system, and electronic device |
CN111970448B (en) * | 2020-08-27 | 2022-04-22 | 上海艾为电子技术股份有限公司 | Optical anti-shake drive circuit, drive system, control method of drive system, and electronic device |
CN112882979A (en) * | 2021-03-15 | 2021-06-01 | 广东拓斯达科技股份有限公司 | Communication system and method |
WO2022193444A1 (en) * | 2021-03-15 | 2022-09-22 | 广东拓斯达科技股份有限公司 | Communication system and method |
CN113612817A (en) * | 2021-07-09 | 2021-11-05 | 浙江浙大中控信息技术有限公司 | Decentralized multi-bin intelligent networking system and method |
CN113612817B (en) * | 2021-07-09 | 2023-11-21 | 浙江中控信息产业股份有限公司 | Decentralizing intelligent networking system and method for multiple bins |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108418739A (en) | A kind of token ring network-building method based on SPI | |
CN106462516A (en) | Dynamically adjustable multi-line bus shared by multi-protocol devices | |
CN104322033B (en) | The physical link of the first agreement is controlled using the expanded function structure of second protocol | |
US7647441B2 (en) | Communications system and method with multilevel connection identification | |
CN105051706B (en) | The equipment of operation for the low-power PHY with PCIE protocol stacks, method and system | |
US11720512B2 (en) | Unified systems and methods for interchip and intrachip node communication | |
CN103827841B (en) | The I/O connector of configurable bandwidth | |
CN107209739A (en) | Voltage mode and current-mode device enumeration | |
CN104104412B (en) | A kind of power line network system based on DMA and the means of communication thereof | |
CN107819659B (en) | Intelligent cascade communication network based on SPI | |
JP2015073275A (en) | Method for automatically setting id in uart ring communication | |
CN106953853A (en) | A kind of network-on-chip gigabit Ethernet resource node and its method of work | |
CN112765079A (en) | SPI bus control method suitable for various different devices | |
CN106330324A (en) | Control method and device | |
CN104133792B (en) | RSB communication method and RSB communication system | |
CN101939734A (en) | Method and system for wireless USB transfer of isochronous data using bulk data transfer type | |
CN104572556B (en) | Multistage serial expanded circuit | |
CN105550157B (en) | A kind of Fractal Tree structured communication structure, method, control device and intelligent chip | |
Szecówka et al. | USB receiver/transmitter for FPGA implementation | |
CN114780462B (en) | Communication link switching control circuit, communication link and server | |
CN112817895B (en) | Communication method based on GPIO | |
CN108153698A (en) | Data interactive method | |
JPS58107743A (en) | Data transfer system | |
CN111818699B (en) | Control method and control circuit of RGB-LED light source | |
WO2024098869A1 (en) | Communication method and apparatus |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180817 |