WO2012155674A1 - Concurrent access method and system and interface device - Google Patents

Concurrent access method and system and interface device Download PDF

Info

Publication number
WO2012155674A1
WO2012155674A1 PCT/CN2012/072858 CN2012072858W WO2012155674A1 WO 2012155674 A1 WO2012155674 A1 WO 2012155674A1 CN 2012072858 W CN2012072858 W CN 2012072858W WO 2012155674 A1 WO2012155674 A1 WO 2012155674A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
port
interface device
slave
output
Prior art date
Application number
PCT/CN2012/072858
Other languages
French (fr)
Chinese (zh)
Inventor
周武
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012155674A1 publication Critical patent/WO2012155674A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices

Abstract

Provided are a concurrent access method and system, and an interface device. The concurrent access system comprises: a master apparatus (1), an interface device (3) and a plurality of slave apparatuses (5). The master apparatus (1) is connected to the interface device (3) through a data bus (2). The interface device (3) is connected to the respective slave apparatuses (5) through a plurality of series peripheral interface (SPI) buses (4). The master apparatus (1) is configured to: convert serial data of the plurality of slave apparatuses (5) into parallel data according to the clock cycle, and then output the parallel data to the interface device (3) through the data bus (2); and output chip select data for selecting the plurality of slave apparatuses (5) to the interface device (3) through the data bus (2). The interface device (3) is configured to convert the parallel data and the chip select data into level signals, and then output the level signals to a corresponding slave apparatus (5) through a corresponding SPI bus (4). The provided concurrent access method and system and interface device can improve the access efficiency when a plurality of apparatuses is connected to the SPI interface.

Description

一种并发访问方法、 系统及接口装置 技术领域  Concurrent access method, system and interface device
本发明涉及嵌入式系统设计领域, 更具体的说, 是一种在现有 SPI技 术上, 实现嵌入式 CPU对一组从设备进行并发访问的方法、 系统及接口装 置。 背景技术  The present invention relates to the field of embedded system design, and more particularly to a method, system and interface device for implementing concurrent access of a set of slave devices by an embedded CPU in the existing SPI technology. Background technique
串行外围设备接口 (Serial Peripheral Interface, SPI )是一种应用于电 子技术领域的串行传输接口, 目前在嵌入式系统的设计中有广泛的应用。 通常的 SPI接口是由 4种逻辑信号组成, 分别为: 时钟信号 (SCLK ); 主 设备输出、从设备输入信号( MOSI );主设备输入、从设备输出信号( MISO ); 片选信号 ( SS )。 SPI接口传输数据的原理是: 主设备在时钟信号 ( SCLK ) 驱动下通过 MOSI给从设备发送数据, 同时在 MISO上采集从设备传输给 主设备的数据,通过 SS可以输出片选信号实现从设备的多选一。其中, SPI 接口的串行时钟频率通常在 l~70MHz。  The Serial Peripheral Interface (SPI) is a serial transmission interface used in the field of electronic technology. It is widely used in the design of embedded systems. The usual SPI interface consists of four kinds of logic signals: clock signal (SCLK); master device output, slave device input signal (MOSI); master device input, slave device output signal (MISO); chip select signal (SS) ). The principle of transmitting data on the SPI interface is as follows: The master device transmits data to the slave device through the MOSI under the driving of the clock signal (SCLK), and collects the data transmitted from the device to the master device on the MISO, and can output the chip select signal through the SS to implement the slave device. Choose one more. Among them, the serial clock frequency of the SPI interface is usually l~70MHz.
很多设计中, 系统中会存在多个从设备, 主设备需要通过 SPI对一组 相同的从设备进行访问。 一种典型的应用场景是主 CPU ( Host CPU )通过 SPI接口对一组处理数据的芯片进行寄存器配置和状态轮询等操作。在通常 的 SPI接口设计中, Host CPU可以对相应从设备输出片选信号, 选中之后 单独进行数据传输, 完成之后选择下一个, 直到所有从设备都被遍历一次。 假设 SPI时钟频率为 Fsclk, SPI上挂接的设备数为 N, —次传输的比特数 为 Nb, 总共传输花费的时间估算有 N*(l/Fsclk)*Nb。 实际应用中, 当设备 组的数量比较庞大, 访问比较频繁时, 系统在 SPI访问上的时间花销会显 得非常巨大,特别是对那种使用 Host CPU的 10管脚产生 SPI时序的设计, 对系统性能会有比较明显的影响。 In many designs, there are multiple slave devices in the system, and the master device needs to access a group of identical slave devices through the SPI. A typical application scenario is that the main CPU (Host CPU) performs register configuration and status polling on a set of chips that process data through the SPI interface. In the usual SPI interface design, the Host CPU can output the chip select signal to the corresponding slave device, select the data transfer separately, and select the next one after the completion, until all the slave devices are traversed once. Assuming that the SPI clock frequency is Fsclk, the number of devices attached to the SPI is N, the number of bits transmitted is Nb, and the total transmission time is estimated to be N*(l/Fsclk)*Nb. In practical applications, when the number of device groups is large and the access is frequent, the time spent on the SPI access will be very large, especially for the design of the SPI timing using the 10-pin of the Host CPU. There will be a significant impact on system performance.
尽管 SPI接口的访问频率可以到 70MHz左右,但不能通过无限提高 SPI 的时钟频率来提高访问效率, 因为实际运行的频率会受到诸多条件限制, 运行的频率通常会在 10MHz以下。 基于这个问题, 开发一种并发的 SPI访 问系统就显得很有必要。 发明内容  Although the access frequency of the SPI interface can be around 70MHz, it is not possible to increase the access efficiency by infinitely increasing the clock frequency of the SPI, because the actual operating frequency is limited by many conditions, and the running frequency is usually below 10MHz. Based on this problem, it is necessary to develop a concurrent SPI access system. Summary of the invention
本发明的目的在于提供一种并发访问方法、 系统及接口装置, 以提高 SPI接口上挂接多个设备时的访问效率。  It is an object of the present invention to provide a concurrent access method, system and interface device for improving access efficiency when multiple devices are attached to an SPI interface.
为实现上述目的, 本发明提供技术方案如下:  To achieve the above object, the present invention provides the following technical solutions:
一种并发访问系统, 包括主设备、 接口装置和多个从设备, 所述主设 备通过数据总线与所述接口装置连接, 所述接口装置通过多条 SPI 总线分 别与每个从设备连接, 其中:  A concurrent access system includes a master device, an interface device, and a plurality of slave devices, wherein the master device is connected to the interface device through a data bus, and the interface device is respectively connected to each slave device through a plurality of SPI buses, wherein :
所述主设备用于, 将所述多个从设备的串行数据按照时钟周期转换为 并行数据后, 通过所述数据总线输出到所述接口装置, 以及, 将用于对所 述多个从设备进行选择的片选数据通过所述数据总线输出到所述接口装 置;  The master device is configured to convert serial data of the plurality of slave devices into parallel data according to a clock cycle, output to the interface device through the data bus, and The chip selection data selected by the device is output to the interface device through the data bus;
所述接口装置用于, 将所述并行数据和所述片选数据转换为电平信号 后, 通过相应的 SPI总线输出到相应的从设备。  The interface device is configured to convert the parallel data and the chip select data into a level signal, and then output to a corresponding slave device through a corresponding SPI bus.
上述的并发访问系统, 其中:  The above concurrent access system, wherein:
所述接口装置还用于, 从所述 SPI 总线上采集各从设备输出的电平信 号, 并将所述电平信号转换为输入数据;  The interface device is further configured to: collect a level signal output by each slave device from the SPI bus, and convert the level signal into input data;
所述主设备还用于, 通过所述数据总线从所述接口装置中获取所述输 入数据, 并将多个时钟周期的所述输入数据转换为各从设备的串行数据。  The master device is further configured to acquire the input data from the interface device through the data bus, and convert the input data of a plurality of clock cycles into serial data of each slave device.
上述的并发访问系统, 其中, 所述接口装置包括:  In the above concurrent access system, the interface device includes:
多个 MOSI端口, 每个 MOSI端口与一个从设备的 MOSI端口连接; 多个 MISO端口, 每个 MISO端口与一个从设备的 MIS0端口连接; 多个 SS端口, 每个 SS端口与一个从设备的 SS端口连接; Multiple MOSI ports, each MOSI port is connected to a slave device's MOSI port; Multiple MISO ports, each MISO port is connected to a slave device's MIS0 port; multiple SS ports, each SS port is connected to a slave device's SS port;
输出寄存器, 用于存储所述并行数据, 其每个比特位对应一个从设备; 输入寄存器, 用于存储所述输入数据, 其每个比特位对应一个从设备; 片选寄存器, 用于存储所述片选数据, 其每个比特位对应一个从设备; 逻辑转换单元, 用于将所述并行数据转换为电平信号后通过 MOSI端 口输出, 将所述片选数据转换为电平信号后通过 SS端口输出, 将从 MISO 端口采集的电平信号转换为所述输入数据。  An output register, configured to store the parallel data, each bit corresponding to a slave device; an input register, configured to store the input data, each bit corresponding to a slave device; a chip select register, for storing The chip selection data, each bit corresponding to a slave device; a logic conversion unit, configured to convert the parallel data into a level signal, output through the MOSI port, convert the chip select data into a level signal, and then pass The SS port output converts the level signal acquired from the MISO port to the input data.
上述的并发访问系统, 其中, 所述主设备包括提供时钟信号的 SCLK 端口, 所述 SCLK端口与每个从设备的 SCLK端口连接。  In the above concurrent access system, the master device includes an SCLK port that provides a clock signal, and the SCLK port is connected to an SCLK port of each slave device.
上述的并发访问系统,其中: 所述接口装置包括提供时钟信号的 SCLK 端口, 所述 SCLK端口与每个从设备的 SCLK端口连接, 所述时钟信号由 所述主设备通过所述数据总线传输到所述接口装置的 SCLK端口。  The concurrent access system, wherein: the interface device includes an SCLK port that provides a clock signal, the SCLK port is connected to an SCLK port of each slave device, and the clock signal is transmitted by the master device through the data bus to The SCLK port of the interface device.
上述的并发访问系统, 其中, 所述主设备为 CPU, 所述接口装置为 The concurrent access system, wherein the master device is a CPU, and the interface device is
CPLD。 CPLD.
一种接口装置, 与主设备通过数据总线连接, 用于主设备对多个从设 备的并发访问, 所述接口装置包括:  An interface device is connected to a master device through a data bus, and is used for concurrent access of the master device to the plurality of slave devices, where the interface device includes:
多个 MOSI端口, 每个 MOSI端口与一个从设备的 MOSI端口连接; 多个 SS端口, 每个 SS端口与一个从设备的 SS端口连接;  Multiple MOSI ports, each MOSI port is connected to a slave device's MOSI port; multiple SS ports, each SS port is connected to a slave device's SS port;
输出寄存器, 用于存储所述主设备通过所述数据总线输出的多个从设 备的并行数据, 其每个比特位对应一个从设备;  An output register, configured to store parallel data of the plurality of slave devices output by the master device through the data bus, each bit corresponding to a slave device;
片选寄存器, 用于存储所述主设备通过所述数据总线输出的用于对多 个从设备进行选择的片选数据, 其每个比特位对应一个从设备;  a chip select register, configured to store chip select data output by the master device through the data bus for selecting a plurality of slave devices, each bit corresponding to a slave device;
逻辑转换单元, 用于将所述并行数据转换为电平信号后通过 MOSI端 口输出, 将所述片选数据转换为电平信号后通过 SS端口输出。 上述的接口装置, 其中, 还包括: And a logic conversion unit, configured to convert the parallel data into a level signal and output through the MOSI port, convert the chip select data into a level signal, and output the signal through the SS port. The above interface device, further comprising:
多个 MISO端口, 每个 MISO端口与一个从设备的 MISO端口连接; 输入寄存器, 用于存储输入数据, 其每个比特位对应一个从设备; 所述逻辑转换单元还用于: 将从 MISO端口采集的电平信号转换为所 述输入数据。  a plurality of MISO ports, each MISO port is connected to a slave device's MISO port; an input register for storing input data, each bit corresponding to a slave device; the logic conversion unit is further configured to: The acquired level signal is converted to the input data.
上述的接口装置, 其中, 还包括:  The above interface device, further comprising:
提供时钟信号的 SCLK端口, 所述 SCLK端口与每个从设备的 SCLK 端口连接, 所述时钟信号由所述主设备通过所述数据总线传输到所述接口 装置的 SCLK端口。  An SCLK port is provided for the clock signal, the SCLK port being coupled to the SCLK port of each slave device, the clock signal being transmitted by the master device over the data bus to the SCLK port of the interface device.
一种并发访问方法, 应用于包括主设备、 接口装置和多个从设备的系 统中, 所述主设备通过数据总线与所述接口装置连接, 所述接口装置通过 多条 SPI总线分别与每个从设备连接, 所述方法包括:  A concurrent access method is applied to a system including a master device, an interface device, and a plurality of slave devices, wherein the master device is connected to the interface device through a data bus, and the interface device separately and each through multiple SPI buses Connected from the device, the method includes:
所述主设备将所述多个从设备的串行数据按照时钟周期转换为并行数 据后, 通过所述数据总线输出到所述接口装置, 并将用于对所述多个从设 备进行选择的片选数据通过所述数据总线输出到所述接口装置;  The master device converts the serial data of the plurality of slave devices into parallel data according to a clock cycle, outputs the data to the interface device through the data bus, and selects the plurality of slave devices for selection. Chip selection data is output to the interface device through the data bus;
所述接口装置将所述并行数据和所述片选数据转换为电平信号后, 通 过相应的 SPI总线输出到相应的从设备。  The interface device converts the parallel data and the chip select data into a level signal, and outputs the same to the corresponding slave device through the corresponding SPI bus.
上述的并发访问方法, 其中, 还包括:  The above concurrent access method, wherein, the method further includes:
所述接口装置从所述 SPI 总线上采集各从设备输出的电平信号, 并将 所述电平信号转换为输入数据;  The interface device collects a level signal output by each slave device from the SPI bus, and converts the level signal into input data;
所述主设备通过所述数据总线从所述接口装置中获取所述输入数据, 并将多个时钟周期的所述输入数据转换为各从设备的串行数据。  The master device acquires the input data from the interface device through the data bus, and converts the input data of a plurality of clock cycles into serial data of each slave device.
与现有的 SPI传输方法相比, 本发明在主设备和从设备之间增加了一 接口装置, 所述接口装置通过数据总线与所述主设备连接, 并通过多条 SPI 总线分别与每个从设备连接, 充分利用了主设备数据总线的宽度优势和运 算能力, 使得主设备能够通过所述接口装置对一组从设备进行并发的访问, 访问效率得到了显著的提高。 本发明同时也保留了对单个从设备的访问能 力, 适合多种应用场景的需要。 附图说明 Compared with the existing SPI transmission method, the present invention adds an interface device between the master device and the slave device, and the interface device is connected to the master device through a data bus, and each of the plurality of SPI buses is connected to each other. From the device connection, make full use of the width advantage and operation of the main device data bus The computing power enables the master device to concurrently access a group of slave devices through the interface device, and the access efficiency is significantly improved. The invention also retains the access capability to a single slave device, and is suitable for various application scenarios. DRAWINGS
图 1是本发明的并发访问系统的结构示意图;  1 is a schematic structural view of a concurrent access system of the present invention;
图 2是本发明的并发访问系统的一个具体实例示意图;  2 is a schematic diagram of a specific example of a concurrent access system of the present invention;
图 3是图 2所示的并发访问系统的工作流程示意图;  3 is a schematic diagram showing the workflow of the concurrent access system shown in FIG. 2;
图 4是图 2所示的并发访问系统中数据转换方式示意图。 具体实施方式  4 is a schematic diagram of a data conversion manner in the concurrent access system shown in FIG. 2. detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图及具 体实施例对本发明进行详细描述。  The present invention will be described in detail below with reference to the drawings and specific embodiments.
通过分析 CPU对数据处理芯片组的访问特点, 可以发现, CPU的访问 需求大都是批量且并发的。 也就是说, CPU总是在同一时间需要对所有的 数据处理芯片发起相同的操作。 例如在某个时间, CPU需要发起一个对所 有芯片的状态轮询操作, 然后根据这个读到的状态, 决定是否需要接着读 芯片传输出来的数据。 如果能将这些批量且并发的访问放在一个 SPI访问 周期里进行, 将会极大提高访问效率, 本发明实施例就是根据这个理论来 设计的。  By analyzing the access characteristics of the CPU to the data processing chipset, it can be found that the CPU access requirements are mostly batch and concurrent. In other words, the CPU always needs to initiate the same operation for all data processing chips at the same time. For example, at some time, the CPU needs to initiate a status polling operation for all chips, and then, based on the status read, determines whether it needs to read the data transmitted by the chip. If these batch and concurrent accesses can be placed in an SPI access cycle, the access efficiency will be greatly improved, and the embodiment of the present invention is designed according to this theory.
图 1是本发明实施例的并发访问系统的结构示意图, 参照图 1 , 并发访 问系统包括: 主设备 1、 接口装置 3和多个从设备 5 , 主设备 1通过数据总 线 2与接口装置 3连接, 接口装置 3通过多条 SPI总线 4分别与每个从设 备 5连接。  1 is a schematic structural diagram of a concurrent access system according to an embodiment of the present invention. Referring to FIG. 1, a concurrent access system includes: a main device 1, an interface device 3, and a plurality of slave devices 5, and the master device 1 is connected to the interface device 3 through a data bus 2. The interface device 3 is connected to each slave device 5 via a plurality of SPI buses 4, respectively.
主设备 1可以是 CPU或者微控制器等, 从设备 5是通过 SPI与主设备 1 通信的外围芯片, 接口装置 3 可以采用可编程逻辑器件 (Complex Programmable Logic Device, CPLD ) 实现, 在应用中也可以采用微处理器、 数字信号处理芯片等具有可编程功能的芯片加上适当的外围辅助电路来代 替 CPLD。 The master device 1 may be a CPU or a microcontroller, etc., the slave device 5 is a peripheral chip that communicates with the master device 1 through the SPI, and the interface device 3 may employ a programmable logic device (Complex) Programmable Logic Device (CPLD) implementation, in the application can also use microprocessors, digital signal processing chips and other programmable chips plus appropriate peripheral auxiliary circuits instead of CPLD.
主设备 1 中包括数据转换模块、 片选信号产生模块和时钟信号产生模 块。 数据转换模块能够将多个从设备 5 的串行数据按照时钟周期转换为并 行数据,还能够将多个时钟周期的各从设备 5的输入数据转换为各从设备 5 的串行数据; 片选信号产生模块能够产生用于对多个从设备 5进行选择的 片选数据; 时钟信号产生模块用于产生时钟信号。 主设备 1 支持数据访问 总线, 能够通过数据总线 2将并行数据和片选数据发送到接口装置 3 , 并通 过数据总线 2从接口装置中 4获取各从设备 5的输入数据。  The main device 1 includes a data conversion module, a chip selection signal generation module, and a clock signal generation module. The data conversion module is capable of converting serial data of the plurality of slave devices 5 into parallel data according to a clock cycle, and is also capable of converting input data of each slave device 5 of the plurality of clock cycles into serial data of each slave device 5; The signal generation module is capable of generating chip select data for selecting a plurality of slave devices 5; the clock signal generation module is configured to generate a clock signal. The master device 1 supports a data access bus, and can transmit parallel data and chip select data to the interface device 3 via the data bus 2, and acquire input data of each slave device 5 from the interface device 4 via the data bus 2.
接口装置 3提供一组寄存器供主设备 1访问, 并提供逻辑转换单元来 完成数据信号(包括并行数据和片选数据)到电平信号的逻辑转换, 以及, 完成从 MISO信号线上采集到的电平信号转换为输入数据的工作, 实现寄 存器的比特位与 SPI的 MISO或 MOSI或 SS信号线状态进行透传。 其中, 寄存器的每一个比特对应一个从设备 5。  The interface device 3 provides a set of registers for access by the master device 1 and provides a logic conversion unit to perform logic conversion of the data signals (including parallel data and chip select data) to the level signals, and to complete the acquisition from the MISO signal line. The level signal is converted into input data, and the bit of the register is transparently transmitted with the MISO or MOSI or SS signal line state of the SPI. Wherein each bit of the register corresponds to a slave device 5.
接口装置 3通过多条 SPI总线 4分别与每个从设备 5连接, 每条 SPI 总线 4均具有 MISO信号线、 MOSI信号线和 SS信号线。 每个从设备 5均 具有 MISO端口、 MOSI端口、 SS端口和 SCLK端口。 相应地, 接口装置 3还包括: 多个 MOSI端口,每个 MOSI端口与一个从设备 5的 MOSI端口 连接; 多个 MISO端口 , 每个 MISO端口与一个从设备 5的 MISO端口连 接; 多个 SS端口, 每个 SS端口与一个从设备 5的 SS端口连接。  The interface device 3 is connected to each of the slave devices 5 via a plurality of SPI buses 4, each of which has an MISO signal line, a MOSI signal line, and an SS signal line. Each slave device 5 has a MISO port, a MOSI port, an SS port, and an SCLK port. Correspondingly, the interface device 3 further comprises: a plurality of MOSI ports each connected to a MOSI port of a slave device 5; a plurality of MISO ports, each MISO port being connected to a MISO port of a slave device 5; Port, each SS port is connected to an SS port of device 5.
如果时钟信号直接由主设备 1输出到从设备 5 ,则所有从设备 5的 SCLK 端口均与主设备 1的 SCLK端口连接; 如果时钟信号是由主设备 1控制接 口装置 3输出到从设备 5 , 则接口装置 3还包括一个 SCLK端口, 所有从设 备 5的 SCLK端口均与接口装置 3的 SCLK端口连接。 上述并发访问系统的一个基本工作流程如下: If the clock signal is directly output from the master device 1 to the slave device 5, the SCLK ports of all the slave devices 5 are connected to the SCLK port of the master device 1; if the clock signal is output from the master device 1 control interface device 3 to the slave device 5, The interface device 3 further includes an SCLK port, and all of the SCLK ports of the slave device 5 are connected to the SCLK port of the interface device 3. A basic workflow for the above concurrent access system is as follows:
主设备将用于对多个从设备进行选择的片选数据通过数据总线输出到 接口装置;  The master device outputs chip selection data for selecting a plurality of slave devices to the interface device through the data bus;
主设备将多个从设备的串行数据按照时钟周期转换为并行数据后, 通 过数据总线输出到接口装置;  The master device converts serial data of the plurality of slave devices into parallel data according to a clock cycle, and outputs the data to the interface device through the data bus;
接口装置将并行数据和片选数据转换为电平信号后, 通过相应的 SPI 总线输出到相应的从设备;  The interface device converts the parallel data and the chip select data into a level signal, and outputs the same to the corresponding slave device through the corresponding SPI bus;
接口装置从 SPI 总线上采集各从设备输出的电平信号, 并将电平信号 转换为输入数据;  The interface device collects the level signal output by each slave device from the SPI bus, and converts the level signal into input data;
主设备通过数据总线从接口装置中获取输入数据, 并将多个时钟周期 的输入数据转换为各从设备的串行数据。  The master device acquires input data from the interface device through the data bus, and converts input data of a plurality of clock cycles into serial data of each slave device.
图 2是本发明的并发访问系统的一个具体实例示意图。 参照图 2, 在本 具体实例中, 主设备为 CPU,接口装置为 CPLD, CPU通过数据总线(Host Bus )与 CPLD连接, CPLD提供给 CPU三组 SPI逻辑转换寄存器,分别为: 输出寄存器 DataOutReg_N ( RAV ) (用于存储并行数据)、 输入寄存器 DataInReg_N ( RO ) (用于存储输入数据 )和片选寄存器 SSReg_N ( RAV ) (用于存储片选数据)。能够并行访问的 SPI从设备数由 CPU数据总线位宽 W (也是寄存器的位宽)和每组寄存器的寄存器数目 N决定, 为 N*W, 其 中, N与 W均为大于 1的整数。 寄存器组的一个比特位, 分别组合成为数 据信号 DataOutReg[0:(N*W-l)], DataInReg[0:(N*W-l)] , SSReg[0:(N*W-l)], 每个比特位分别对应一个从设备的相应 SPI信号线。  2 is a schematic diagram of a specific example of the concurrent access system of the present invention. Referring to FIG. 2, in the specific example, the master device is a CPU, the interface device is a CPLD, and the CPU is connected to the CPLD through a data bus (Host Bus), and the CPLD provides three sets of SPI logic conversion registers to the CPU, respectively: an output register DataOutReg_N ( RAV ) (for storing parallel data), input register DataInReg_N ( RO ) (for storing input data) and chip select register SSReg_N ( RAV ) (for storing chip select data). The number of SPI slaves that can be accessed in parallel is determined by the CPU data bus bit width W (which is also the bit width of the register) and the number of registers N of each set of registers, which is N*W, where N and W are integers greater than one. One bit of the register set is combined into a data signal DataOutReg[0:(N*Wl)], DataInReg[0:(N*Wl)], SSReg[0:(N*Wl)], each bit respectively Corresponds to the corresponding SPI signal line of a slave device.
CPLD提供逻辑转换,将 DataOutReg[0:(N*W-l)]的每个 bit位转换成高 低电平, 输出到每个从设备对应的 MOSI上; 将从设备的 MISO上的电平 值采集输入到 DataInReg[0:(N*W-l)]的每个 bit位上; 将 SSReg[0:(N*W-l)] 的每个 bit位转换成高低电平, 输出到每个从设备对应的 SS上。 CPU通过通用输入输出 ( GPIO )端口或者控制 CPLD产生统一的 SPI 时钟信号, 输出到从设备。 The CPLD provides a logic conversion, converting each bit of DataOutReg[0:(N*Wl)] into a high and low level, and outputting it to the corresponding MOSI of each slave device; collecting the input value of the level value on the MISO of the device To each bit of DataInReg[0:(N*Wl)]; convert each bit of SSReg[0:(N*Wl)] into a high and low level, and output it to the SS corresponding to each slave device. . The CPU generates a unified SPI clock signal through the general-purpose input/output (GPIO) port or controls the CPLD, and outputs it to the slave device.
图 3是图 2所示的并发访问系统的工作流程示意图。 参照图 3, 包括如 下步驟:  FIG. 3 is a schematic diagram of the workflow of the concurrent access system shown in FIG. Referring to Figure 3, the following steps are included:
步驟 301: 当 CPU发起一个并发访问时, 将原始数据序列 D转换为数 据序列 B;  Step 301: When the CPU initiates a concurrent access, converting the original data sequence D into a data sequence B;
本步驟中, 数据转换方式如图 4所示, 图中变量说明如下:  In this step, the data conversion method is shown in Figure 4. The variables in the figure are as follows:
D: 需要传输的原始数据;  D: raw data that needs to be transmitted;
Wd: 需要传输的原始数据的 bit长度;  Wd: the bit length of the original data to be transmitted;
B: 转换后的数据;  B: converted data;
N: CPLD每个寄存器组中寄存器的数量;  N: the number of registers in each register group of the CPLD;
W: CPU到 CPLD数据总线的位宽 (也是 CPLD寄存器的位宽)。  W: Bit width of the CPU to CPLD data bus (also the bit width of the CPLD register).
步驟 302: CPU将片选信号组合成 N个 W位宽的数字, 通过数据总线 写入 SSReg寄存器组对应的每个寄存器中, 以选定要访问的从设备;  Step 302: The CPU combines the chip select signals into N W bit wide numbers, and writes each register corresponding to the SSReg register group through the data bus to select the slave device to be accessed;
步驟 303: CPU将在一个时钟周期需要发送到从设备组的数据 Bn, 通 过数据总线写入 DataOutReg寄存器组对应的每个寄存器中; Step 303: The CPU needs to send the data B n to the slave device group in one clock cycle, and writes each register corresponding to the DataOutReg register group through the data bus;
步驟 304: CPU输出一个时钟信号, 数据 被并行地送到从设备, 同 时从设备传回来的数据也被采集进入 DatalnReg寄存器组;  Step 304: The CPU outputs a clock signal, and the data is sent to the slave device in parallel, and the data returned from the device is also collected into the DatalnReg register group.
本步驟中, 数据 Bn被并行地送到从设备是指, CPLD将数据 Bn的每个 bit值转换为并行的电平信号, 输出到每个从设备对应的 MOSI信号线上。 In this step, the data B n is sent to the slave device in parallel, and the CPLD converts each bit value of the data B n into a parallel level signal, and outputs it to the MOSI signal line corresponding to each slave device.
本步驟中, CPLD还在时钟驱动下采集所有 MISO的电平信号,将电平 信号转换为输入数据后存入 DatalnReg寄存器组, 以供 CPU读取。  In this step, the CPLD also collects all MISO level signals under clock drive, converts the level signals into input data and stores them in the DatalnReg register set for the CPU to read.
步驟 305: CPU从 DatalnReg寄存器组中读入一组数据, 完成一个时钟 周期的数据传输;  Step 305: The CPU reads a set of data from the DatalnReg register group to complete data transmission of one clock cycle;
步驟 306: 判断是否传输完成, 若是, 进入步驟 307, 若否, 返回步驟 303, 执行对下一组数据 Bn+1的操作; Step 306: Determine whether the transmission is completed. If yes, go to step 307. If no, return to the step. 303. Perform an operation on the next set of data B n+1 ;
步驟 307: CPU对 SSReg寄存器组进行设置, 使所有片选无效; 步驟 308: CPU对每次读到的 DataInReg[0:(N*W-l)]比特位进行拆分组 合, 得到各从设备传到 CPU的二进制数据, 组合方式为图 4所示方式的逆 过程, 这里不做赘述。  Step 307: The CPU sets the SSReg register group to invalidate all the chip selects. Step 308: The CPU splits and combines each read DataInReg[0:(N*Wl)] bit to obtain the slave devices. The binary data of the CPU is combined in the reverse process of the mode shown in Figure 4, and will not be described here.
至此, CPU完成了对各从设备的并发访问。  At this point, the CPU completes concurrent access to each slave device.
与现有的 SPI传输方法相比, 本发明实施例在主设备和从设备之间增 加了一接口装置, 所述接口装置通过数据总线与所述主设备连接, 并通过 多条 SPI 总线分别与每个从设备连接, 充分利用了主设备数据总线的宽度 优势和运算能力, 使得主设备能够通过所述接口装置对一组从设备进行并 发的访问, 访问效率得到了显著的提高。 本发明实施例同时也保留了对单 个从设备的访问能力, 适合多种应用场景的需要。  Compared with the existing SPI transmission method, the embodiment of the present invention adds an interface device between the master device and the slave device, and the interface device is connected to the master device through a data bus, and is respectively connected to the master device through multiple SPI buses. Each slave device is connected to take full advantage of the width advantage and computing power of the master device data bus, so that the master device can concurrently access a group of slave devices through the interface device, and the access efficiency is significantly improved. The embodiment of the present invention also retains the access capability to a single slave device, which is suitable for various application scenarios.
最后应当说明的是, 以上实施例仅用以说明本发明的技术方案而非限 制, 本领域的普通技术人员应当理解, 可以对本发明的技术方案进行修改 或者等同替换, 而不脱离本发明技术方案的精神范围, 其均应涵盖在本发 明的权利要求范围当中。  It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to be limiting, and those skilled in the art should understand that the technical solutions of the present invention may be modified or equivalently substituted without departing from the technical solutions of the present invention. The spirit of the scope should be covered by the scope of the claims of the present invention.

Claims

权利要求书 Claim
1. 一种并发访问系统, 其特征在于, 包括主设备、 接口装置和多个从 设备, 所述主设备通过数据总线与所述接口装置连接, 所述接口装置通过 多条 SPI总线分别与每个从设备连接, 其中:  A concurrent access system, comprising: a master device, an interface device, and a plurality of slave devices, wherein the master device is connected to the interface device via a data bus, and the interface device separately and each through a plurality of SPI buses Connected from the device, where:
所述主设备用于, 将所述多个从设备的串行数据按照时钟周期转换为 并行数据后, 通过所述数据总线输出到所述接口装置, 以及, 将用于对所 述多个从设备进行选择的片选数据通过所述数据总线输出到所述接口装 置;  The master device is configured to convert serial data of the plurality of slave devices into parallel data according to a clock cycle, output to the interface device through the data bus, and The chip selection data selected by the device is output to the interface device through the data bus;
所述接口装置用于, 将所述并行数据和所述片选数据转换为电平信号 后, 通过相应的 SPI总线输出到相应的从设备。  The interface device is configured to convert the parallel data and the chip select data into a level signal, and then output to a corresponding slave device through a corresponding SPI bus.
2. 如权利要求 1所述的并发访问系统, 其特征在于:  2. The concurrent access system of claim 1 wherein:
所述接口装置还用于, 从所述 SPI 总线上采集各从设备输出的电平信 号, 并将所述电平信号转换为输入数据;  The interface device is further configured to: collect a level signal output by each slave device from the SPI bus, and convert the level signal into input data;
所述主设备还用于, 通过所述数据总线从所述接口装置中获取所述输 入数据, 并将多个时钟周期的所述输入数据转换为各从设备的串行数据。  The master device is further configured to acquire the input data from the interface device through the data bus, and convert the input data of a plurality of clock cycles into serial data of each slave device.
3. 如权利要求 2所述的并发访问系统, 其特征在于, 所述接口装置包 括:  3. The concurrent access system of claim 2, wherein the interface device comprises:
多个 MOSI端口, 每个 MOSI端口与一个从设备的 MOSI端口连接; 多个 MISO端口, 每个 MISO端口与一个从设备的 MISO端口连接; 多个 SS端口, 每个 SS端口与一个从设备的 SS端口连接;  Multiple MOSI ports, each MOSI port is connected to a slave device's MOSI port; multiple MISO ports, each MISO port is connected to a slave device's MISO port; multiple SS ports, each SS port and one slave device SS port connection;
输出寄存器, 用于存储所述并行数据, 其每个比特位对应一个从设备; 输入寄存器, 用于存储所述输入数据, 其每个比特位对应一个从设备; 片选寄存器, 用于存储所述片选数据, 其每个比特位对应一个从设备; 逻辑转换单元, 用于将所述并行数据转换为电平信号后通过 MOSI端 口输出, 将所述片选数据转换为电平信号后通过 SS端口输出, 将从 MISO 端口采集的电平信号转换为所述输入数据。 An output register, configured to store the parallel data, each bit corresponding to a slave device; an input register, configured to store the input data, each bit corresponding to a slave device; a chip select register, for storing The chip selection data, each bit corresponding to a slave device; a logic conversion unit, configured to convert the parallel data into a level signal, output through the MOSI port, convert the chip select data into a level signal, and then pass SS port output, will be from MISO The level signal acquired by the port is converted into the input data.
4. 如权利要求 3所述的并发访问系统, 其特征在于:  4. The concurrent access system of claim 3, wherein:
所述主设备包括提供时钟信号的 SCLK端口, 所述 SCLK端口与每个 从设备的 SCLK端口连接。  The master device includes an SCLK port that provides a clock signal that is coupled to the SCLK port of each slave device.
5. 如权利要求 3所述的并发访问系统, 其特征在于:  5. The concurrent access system of claim 3, wherein:
所述接口装置包括提供时钟信号的 SCLK端口, 所述 SCLK端口与每 个从设备的 SCLK端口连接, 所述时钟信号由所述主设备通过所述数据总 线传输到所述接口装置的 SCLK端口。  The interface device includes an SCLK port that provides a clock signal, the SCLK port being coupled to an SCLK port of each slave device, the clock signal being transmitted by the master device through the data bus to an SCLK port of the interface device.
6. 如权利要求 1所述的并发访问系统, 其特征在于:  6. The concurrent access system of claim 1 wherein:
所述主设备为 CPU, 所述接口装置为 CPLD。  The master device is a CPU, and the interface device is a CPLD.
7. 一种接口装置, 与主设备通过数据总线连接, 用于主设备对多个从 设备的并发访问, 其特征在于, 所述接口装置包括:  An interface device, which is connected to the master device through a data bus, and is used for concurrent access of the master device to the plurality of slave devices, wherein the interface device includes:
多个 MOSI端口, 每个 MOSI端口与一个从设备的 MOSI端口连接; 多个 SS端口, 每个 SS端口与一个从设备的 SS端口连接;  Multiple MOSI ports, each MOSI port is connected to a slave device's MOSI port; multiple SS ports, each SS port is connected to a slave device's SS port;
输出寄存器, 用于存储所述主设备通过所述数据总线输出的多个从设 备的并行数据, 其每个比特位对应一个从设备;  An output register, configured to store parallel data of the plurality of slave devices output by the master device through the data bus, each bit corresponding to a slave device;
片选寄存器, 用于存储所述主设备通过所述数据总线输出的用于对多 个从设备进行选择的片选数据, 其每个比特位对应一个从设备;  a chip select register, configured to store chip select data output by the master device through the data bus for selecting a plurality of slave devices, each bit corresponding to a slave device;
逻辑转换单元, 用于将所述并行数据转换为电平信号后通过 MOSI端 口输出, 将所述片选数据转换为电平信号后通过 SS端口输出。  And a logic conversion unit, configured to convert the parallel data into a level signal and output through the MOSI port, convert the chip select data into a level signal, and output the signal through the SS port.
8. 如权利要求 7所述的接口装置, 其特征在于, 还包括:  8. The interface device of claim 7, further comprising:
多个 MISO端口, 每个 MISO端口与一个从设备的 MISO端口连接; 输入寄存器, 用于存储输入数据, 其每个比特位对应一个从设备; 所述逻辑转换单元还用于: 将从 MISO端口采集的电平信号转换为所 述输入数据。 a plurality of MISO ports, each MISO port is connected to a slave device's MISO port; an input register for storing input data, each bit corresponding to a slave device; the logic conversion unit is further configured to: The acquired level signal is converted to the input data.
9. 如权利要求 8所述的接口装置, 其特征在于, 还包括: 提供时钟信号的 SCLK端口, 所述 SCLK端口与每个从设备的 SCLK 端口连接, 所述时钟信号由所述主设备通过所述数据总线传输到所述接口 装置的 SCLK端口。 9. The interface device of claim 8, further comprising: an SCLK port providing a clock signal, the SCLK port being coupled to an SCLK port of each slave device, the clock signal being passed by the master device The data bus is transmitted to the SCLK port of the interface device.
10. 一种并发访问方法,应用于包括主设备、接口装置和多个从设备的 系统中, 所述主设备通过数据总线与所述接口装置连接, 所述接口装置通 过多条 SPI总线分别与每个从设备连接, 其特征在于, 所述方法包括: 所述主设备将所述多个从设备的串行数据按照时钟周期转换为并行数 据后, 通过所述数据总线输出到所述接口装置, 并将用于对所述多个从设 备进行选择的片选数据通过所述数据总线输出到所述接口装置;  10. A concurrent access method for use in a system comprising a master device, an interface device and a plurality of slave devices, the master device being connected to the interface device via a data bus, the interface device being respectively connected to the plurality of SPI buses Each of the slave devices is connected, wherein the method includes: the master device converts serial data of the plurality of slave devices into parallel data according to a clock cycle, and outputs the data to the interface device through the data bus And outputting chip selection data for selecting the plurality of slave devices to the interface device through the data bus;
所述接口装置将所述并行数据和所述片选数据转换为电平信号后, 通 过相应的 SPI总线输出到相应的从设备。  The interface device converts the parallel data and the chip select data into a level signal, and outputs the same to the corresponding slave device through the corresponding SPI bus.
11. 如权利要求 10所述的并发访问方法, 其特征在于, 还包括: 所述接口装置从所述 SPI 总线上采集各从设备输出的电平信号, 并将 所述电平信号转换为输入数据;  11. The concurrent access method according to claim 10, further comprising: said interface device collecting a level signal output by each slave device from said SPI bus, and converting said level signal into an input Data
所述主设备通过所述数据总线从所述接口装置中获取所述输入数据, 并将多个时钟周期的所述输入数据转换为各从设备的串行数据。  The master device acquires the input data from the interface device through the data bus, and converts the input data of a plurality of clock cycles into serial data of each slave device.
PCT/CN2012/072858 2011-07-25 2012-03-22 Concurrent access method and system and interface device WO2012155674A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110208976.4 2011-07-25
CN201110208976.4A CN102262604B (en) 2011-07-25 2011-07-25 Concurrent access method, system and interface device

Publications (1)

Publication Number Publication Date
WO2012155674A1 true WO2012155674A1 (en) 2012-11-22

Family

ID=45009238

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/072858 WO2012155674A1 (en) 2011-07-25 2012-03-22 Concurrent access method and system and interface device

Country Status (2)

Country Link
CN (1) CN102262604B (en)
WO (1) WO2012155674A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562666A (en) * 2017-09-26 2018-01-09 威创集团股份有限公司 Method, system and the relevant apparatus of communication between devices based on spi bus

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102262604B (en) * 2011-07-25 2017-04-26 中兴通讯股份有限公司 Concurrent access method, system and interface device
CN107436851B (en) * 2016-05-26 2020-05-12 北京联合大学 Four-line isolation system of serial peripheral interface and control method thereof
CN107153622B (en) * 2017-05-24 2019-08-23 中国电子科技集团公司第四十一研究所 A kind of drive control method based on spi bus
CN107301138B (en) * 2017-06-01 2019-05-17 深圳震有科技股份有限公司 A kind of universal serial bus bridging method and serial bus system
CN115174804B (en) * 2019-06-28 2024-02-20 华为技术有限公司 SPI-based data transmission system
CN110471881B (en) * 2019-07-29 2020-06-23 广芯微电子(广州)股份有限公司 Method for realizing rapid communication between multiple slave devices and SPI (Serial peripheral interface) master device
CN111444128A (en) * 2020-03-03 2020-07-24 福州瑞芯微电子股份有限公司 Data read-write bus supporting multiple equipment ends and data read-write method thereof
EP4033370B1 (en) * 2021-01-22 2023-11-15 Aptiv Technologies Limited Communications system and method of operating the same
TWI812194B (en) * 2022-04-27 2023-08-11 凌通科技股份有限公司 Serial peripheral interface compatibility extension switching method and embedded system using the same

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2682480Y (en) * 2003-12-31 2005-03-02 上海贝岭股份有限公司 SPI synchronous serial communication interface circuit integrated in a chip
CN101482856A (en) * 2009-01-05 2009-07-15 东南大学 Serial-parallel protocol conversion apparatus based on field programmable gate array
CN102262604A (en) * 2011-07-25 2011-11-30 中兴通讯股份有限公司 Concurrent access method, system and interface device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067804B (en) * 2007-05-29 2010-04-14 山东大学 A high-speed configurable extended SPI bus and working method thereof
CN101582823B (en) * 2008-05-13 2012-09-05 深圳迈瑞生物医疗电子股份有限公司 Communicated method, communication system and communication routing device based on SPI bus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2682480Y (en) * 2003-12-31 2005-03-02 上海贝岭股份有限公司 SPI synchronous serial communication interface circuit integrated in a chip
CN101482856A (en) * 2009-01-05 2009-07-15 东南大学 Serial-parallel protocol conversion apparatus based on field programmable gate array
CN102262604A (en) * 2011-07-25 2011-11-30 中兴通讯股份有限公司 Concurrent access method, system and interface device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562666A (en) * 2017-09-26 2018-01-09 威创集团股份有限公司 Method, system and the relevant apparatus of communication between devices based on spi bus
CN107562666B (en) * 2017-09-26 2020-10-23 威创集团股份有限公司 Method, system and related device for communication between devices based on SPI bus

Also Published As

Publication number Publication date
CN102262604A (en) 2011-11-30
CN102262604B (en) 2017-04-26

Similar Documents

Publication Publication Date Title
WO2012155674A1 (en) Concurrent access method and system and interface device
CN109828941B (en) AXI2WB bus bridge implementation method, device, equipment and storage medium
CN104809094A (en) SPI (Serial Peripheral Interface) controller and communication method for SPI controller
CN1570907B (en) Multiprocessor system
CN109634900B (en) AXI (advanced extensible interface) protocol-based multi-level low-delay interconnection structure
CN103136163B (en) Protocol processor chip capable of allocating and achieving FC-AE-ASM and FC-AV protocol
CN104714907B (en) A kind of pci bus is converted to ISA and APB bus design methods
CN103399830A (en) Equipment and method for reading computer physical memory through PCI Express bus
CN114265872A (en) Interconnection device for bus
US8458389B2 (en) Apparatus and method for converting protocol interface
CN219574799U (en) Multi-bus bridge based on AMBA bus and system on chip thereof
CN111143261A (en) PCIE (peripheral component interface express) -based high-speed data acquisition system
WO2014048327A1 (en) Commissioning system and method
CN113918497B (en) System, method and server for optimizing AHB bus data transmission performance
Li et al. UART Controller with FIFO Buffer Function Based on APB Bus
CN102541788A (en) APB (advanced peripheral bus) bridge and method for executing reading or writing by using APB bridge
Paunikar et al. Design and implementation of area efficient, low power AMBA-APB Bridge for SoC
WO2023033887A1 (en) On-demand packetization for a chip-to-chip interface
CN111079922B (en) AXI-APB-based neural network interaction system, method, server and storage medium
CN103309798B (en) A kind of DSP debugging apparatus
CN109144927A (en) A kind of more FPGA interconnect devices and method
CN115202257B (en) LPC bus protocol conversion and equipment parallel control device and method
CN111339012B (en) Processor system bus structure and system
TWI506455B (en) Embedded system
CN107562674B (en) Bus protocol asynchronous logic circuit implementation device embedded into processor

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12785189

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12785189

Country of ref document: EP

Kind code of ref document: A1