汽车电子与工控

硬件接口协议之“Rapid IO”

2023-06-30 21:00 5 次阅读 约 8,101 字 · 预计阅读 20 分钟

本文主要介绍Rapid IO的特性、协议结构、包格式、电气特性等。


Rapid IO技术最初是由Freescale和Mercury共同研发的一项互连技术,其研发初衷是作为处理器的前端总线,用于处理器之间的互连,但在标准制定之初,其创建者就意识到了Rapid IO还可以做为系统级互连的高效前端总线而使用。1999年完成第一个标准的制定,2003年5月,Mercury Computer Systems公司首次推出使用Rapid IO技术的多处理器系统ImpactRT 3100,表明Rapid IO已由一个标准制定阶段进展到产品阶段,到目前为止,Rapid IO已经成为电信,通迅以及嵌入式系统内的芯片与芯片之间,板与板之间的背板互连技术的生力军。

Rapid IO是针对嵌入式系统的独特互连需求而提出的,那么我们首先来说明嵌入式系统互连的一些基本需求:嵌入式系统需要的是一种标准化的互连设计,要满足以下几个基本的特点:高效率、低系统成本,点对点或是点对多点的通信,支持DMA操作,支持消息传递模式交换数据,支持分散处理和多主控系统,支持多种拓朴结构;另外,高稳定性和QOS也是选择嵌入式系统总线的基本原则。而这些恰是Rapid IO期望满足的方向。所以Rapid IO在制定之初即确定了以下几个基本原则:一是轻量型的传输协议,使协议尽量简单;二是对软件的制约要少,层次结构清晰;三是专注于机箱内部芯片与芯片之间,板与板之间的互连。


1、协议结构及包格式

Rapid IO协议由逻辑层、传输层和物理层构成。最明显的一个特点就是Rapid IO采用了单一的公用传输层规范来相容、会聚不同的逻辑层和物理层,单一的逻辑层实体增强了Rapid IO的适应性。

逻辑层定义了操作协议;传输层定义了包交换、路由和寻址机制;物理层定义了电气特性、链路控制和纠错重传等。

和以太网一样,RapidIO也是基于包交换的互连技术。RapidIO包由包头、可选的载荷数据和16bits CRC校验组成。包头的长度因为包类型不同可能是十几到二十几个字节。每包的载荷数据长度不超过256字节,这有利于减少传输时延,简化硬件实现。



上述包格式定义兼顾了包效率及组包/解包的简单性。RapidIO交换器件仅需解析前后16bits,以及源/目地器件ID,这简化了交换器件的实现。


1.1、逻辑层协议

逻辑层定义了操作协议和相应的包格式。RapidIO支持的逻辑层业务主要是:直接IO/DMA(Direct IO/Direct Memory Access)和消息传递(Message Passing)。

直接IO/DMA模式是最简单实用的传输方式,其前提是主设备知道被访问端的存储器映射。在这种模式下,主设备可以直接读写从设备的存储器。直接IO/DMA在被访问端的功能往往完全由硬件实现,所以被访问的器件不会有任何软件负担。

对上层应用来说,发起直接IO/DMA传输主要需提供以下参数:目地器件ID、数据长度、数据在目地器件存储器中的地址。

直接IO/DMA模式又可进一步分为以下几种传输格式:

  • NWRITE写操作,不要求接收端响应。

  • NWRITE_R带响应的NWRITE(NWRITE with Response),要求接收端响应。

  • SWRITE流写(Stream Write),数据长度必须是8字节的整数倍,不要求接收端响应。

  • NREAD读操作。

SWRITE是最高效的传输格式;带响应的写操作或读操作效率则较低,一般只能达到不带响应的传输的效率的一半。

消息传递(Message Passing)模式则类似于以太网的传输方式,它不要求主设备知道被访问设备的存储器状况。数据在被访问设备中的位置则由邮箱号(类似于以太网协议中的端口号)确定。从设备根据接收到的包的邮箱号把数据保存到对应的缓冲区,这一过程往往无法完全由硬件实现,而需要软件协助,所以会带来一些软件负担。

对上层应用来说,发起消息传递主要需提供以下参数:目地器件ID、数据长度、邮箱号。



直接IO/DMA

消息传递

主机可直接访问从机存储器

可以

不可以

主机需要知道从机存储器映射

需要

不需要

数据寻址方式

存储器地址

邮箱号

支持的数据访问方式

读/写

写

从机软件负担

无

有


1.2、传输层协议

RapidIO是基于包交换的互连技术,传输层定义了包交换的路由和寻址机制。

RapidIO网络主要由两种器件,终端器件(End Point)和交换器件(Switch)组成。终端器件是数据包的源或目的地,不同的终端器件以器件ID来区分。RapidIO支持8 bits或16 bits器件ID,因此一个RapidIO网络最多可容纳256或65536个终端器件。与以太网类似,RapidIO也支持广播或组播,每个终端器件除了独有的器件ID外,还可配置广播或组播ID。交换器件根据包的目地器件ID进行包的转发,交换器件本身没有器件ID。

RapidIO的互连拓扑结构非常灵活,除了通过交换器件外,两个终端器件也可直接互连。


1.3、物理层协议

Rapid IO协议定义了两种物理层接口标准:

  • 8/16并行协议

  • 1x/4x串行协议(SRIO)

并行Rapid IO由于信号线较多(40~76),难以得到广泛的应用,而1x/4x串行Rapid IO仅4或16个信号线,逐渐成为主流。

串行RapidIO基于现在已广泛用于背板互连的SerDes(Serialize Deserialize)技术,它采用差分交流耦合信号。差分交流耦合信号具有抗干扰强、速率高、传输距离较远等优点。

串行物理层定义了器件间的全双工串行链路,在每个方向上支持1个串行差分对称为1个通道(1x),或同时支持4个并行的串行差分对称为4通道(4x),接口的电气特性采用成熟的XAUI接口(CML电平)(Xilinx的GTx支持的SRIO用的是LP-LVDS信号),编码方式采用的是8b/10b编码,对链路的管理,包括流量控制,包定界和错误报告等使用专用的8b/10b码(K码),接收端从链路上提取时钟信息,无需独立的时钟线。



发送时,逻辑层和传输层将组好的包经过CRC编码后被送到物理层的FIFO中,“8b/10b编码”模块将每8bit数据编码成10bits数据,“并/串转换”模块将10bits并行数据转换成串行bits,发送模块把数字bit转换成差分交流耦合信号在信号线上发送出去。这里的8b/10b编码的主要作用是:

  • 保证信号有足够的跳变,以便于接收方恢复时钟。串行RapidIO没有专门的时钟信号线,接收端靠数据信号的跳变恢复时钟。所以需要把信号跳变少的8bits数据(如全0或全1)编码成有一定跳变的10bits数据。另外,也使得总体数据中0和1的个数均衡,以消除直流分量,保证交流耦合特性;

  • 8b/10b编码可扩大符号空间,以承载带内控制符号。10bits能表示1024个符号,其中256个表示有效的8bits数据,剩下的符号中的几十个被用作控制符号。控制符号可被用作包分隔符,响应标志,或用于链路初始化,链路控制等功能;

  • 8b/10b编码能实现一定的检错功能。1024个符号中,除了256个有效数据符号和几十个控制符号外,其它符号都是非法的,接收方收到非法符号则表示链路传输出错。

接收的过程则正好相反,首先接收方需要根据数据信号的跳变恢复出时钟,用这个时钟采样串行信号,将串行信号转换为10bits的并行信号,再按8b/10b编码规则解码得到8bits数据,最后做CRC校验并送上层处理。

数据被正确的接收时,接收端会发送一个ACK响应包给发送端;如果数据不正确(CRC错或非法的10bits符号),则会送NACK包,要求发送方重传。这种重传纠错的功能由物理层完成,而物理层功能往往由硬件实现,所以不需要软件干预。

串行Rapid IO支持的信号速率有如下三个等级:

  • Baud Rate Class 1 is used forlanes running at 1.25 Gbaud, 2.5 Gbaud, 3.125 Gbaud or 5 Gbaud.

  • Baud Rate Class 2 is used forlanes running at 6.25 Gbaud.

  • Baud Rate Class 3 is used forlanes running at 10.3125, 12.5 and 25.78125 Gbaud.

The 8b/10b PCS and PMA Layers shall be used by links operating at Baud Rate Class 1 or Baud Rate Class 2. The 64b/67b PCS and PMA Layers shall be supported by links operating at Baud Rate Class 3. 经过编码后的有效数据速率为:1, 2, 2.5, 4, 5, 9.85,11.94 and 24.63 Gbps per lane.

SRIO和PCIe、以太网的对比如下表所示:



软件实现TCP/IP协议栈的以太网

4x PCIe

4x SRIO

备注

软件开销

高

中

低

SRIO协议栈简单,一般都由硬件实现,软件开销很小

硬件纠错重传

不支持

支持

支持


传输模式

消息

DMA

DMA,消息


拓扑结构

任意

PCI树

任意

SRIO支持直接点对点或通过交换器件实现的各种拓扑结构

直接点对点对等互连

支持

不支持

支持

SRIO互连双方可对等的发起传输。

传输距离

长

中

中

SRIO针对嵌入式设备内部互连,传输距离一般小于1米

数据包最大有效载荷长度

1500字节

4096字节

256字节

嵌入式通信系统对实时性要求高,SRIO小包传输可减少传输时延

打包效率(以传输256字节数据为例)

79%(TCP包)

82%

92~94%

打包效率是有效载荷长度与总包长的比率。SRIO支持多种高效包格式。

 

2.1、Electrical Specifications

2.1、波特率

All unit intervals are specified with a toleranceof ±100 ppm. The worst case frequency difference between any transmit andreceive clock is 200 ppm.


2.2、Electrical Specifications

根据不同速率等级,分为四个link level,下面针对Level I进行详细介绍,其他几个Level参见相关规范。

A Level I link shall:

  • allow 1.25 Gbaud, 2.5 Gbaud, or3.125 Gbaud baud rates.

  • supports hot plug.

  • The electrical specifications shall support lane widths options of 1x, 2x, 4x, 8x and 16x.

  • AC coupling at the receivershall be specified to ensure inter-operability between transmitters and receivers of different vendors and technologies.

  • A compliant device may implement any subset of baud rates contained in this section.

  • A compliant device mayimplement either a shortrun (SR) transmitter, a long run (LR) transmitter, or both, at each of the baud ratesthat it supports.

  • The clock frequency tolerancere quirement for transmit and receive are 100 ppm. The worst case frequency differences between any transmit and receive clock is 200 ppm.

  • The Bit Error Ratio (BER) shallbe better than 10-12 per lane.

  • The transmitter pins shall becapable of surviving short circuit either to each other, to supply voltages,and to ground.

  • The short run interface shall be capable of spanning at least 20 cm of PCB material with up to a singleconnector.

  • The long run interface shall be capable of spanning at least 50 cm of PCB material with up to two connectors.


A Level II link shall:

  • allow 5 Gbaud or 6.25 Gbaudbaud rates.

  • supports hot plug.

  • The electrical specifications shall support lane widths options of 1x, 2x, 4x, 8x and 16x.

  • supports AC coupling andoptional DC coupling. Both AC coupled and DC coupled links options shall bespecified. A compliant device must implement AC coupling and may implement DCcoupling as an option.

  • supports short run (SR), medium run (MR),and long run (LR) links achieved with two transmitters and two receivers.

  • The clock frequency tolerance requirement for transmit and receive are 100 ppm. The worst case frequency differences between any transmit and receive clock is 200 ppm.

  • achieves Bit Error Ratio oflower than 10-15 per lane but test requirements will be verified to10-12 per lane.

  • Transmitters and receivers usedon short, medium and long run links shall inter-operate for path lengths up to20 cm.

  • Transmitters and receivers used on medium and long run links shall inter-operate for path lengths up to 60 cm.

  • The transmitter pins shall be capable of surviving short circuit either to each other, to supply voltages,and to ground.


A Level III link shall:

  • allow 10.3125 and 12.5 Gbaudbaud rates.

  • The electrical specifications shall support lane width options of 1x, 2x, 4x, 8x and 16x.

  • A compliant device mustimplement AC coupling.

  • A compliant device mayimplement any subset of baud rates contained in this chapter.

  • A compliant device mayimplement either a short-reach transmitter, a long-reach transmitter, or both,at each of the baud rates that it supports.

  • A compliant device may implementeither a short-reach receiver or a long-reach receiver at each of the baudrates that it supports.

  • The clock frequency tolerancerequirement for transmit and receive are 100 ppm. The worst case frequencydifferences between any transmit and receive clock is 200 ppm.

  • The Bit Error Ratio (BER) shallbe better than 10-15 per lane but the test requirements will be toverify 10-12 per lane.

  • Transmitters and receivers usedon short and long-reach links shall inter-operate for path lengths up to 20 cm.

  • Transmitters and receivers usedon long-reach links shall inter-operate for path lengths up to 100 cm.

  • The transmitter pins shall becapable of surviving short circuit either to each other, to supply voltages,and to ground.


A Level IV link shall:

  • allow 25 Gbaud baud rates.

  • The electrical specificationsshall support lane width options of 1x, 2x, 4x, 8x and 16x.

  • A compliant device mustimplement AC coupling.

  • A compliant device mayimplement any subset of baud rates contained in this chapter.

  • A compliant device mayimplement either a short-reach transmitter, a long-reach transmitter, or both,at each of the baud rates that it supports.

  • A compliant device mayimplement either a short-reach receiver or a long-reach receiver at each of thebaud rates that it supports.

  • The clock frequency tolerancerequirement for transmit and receive are 100 ppm. The worst case frequencydifferences between any transmit and receive clock is 200 ppm.

  • The Bit Error Ratio (BER) shallbe better than 10-15 per lane but the test requirements will be toverify 10-12 per lane.

  • Transmitters and receivers usedon short and long-reach links shall inter-operate for path lengths up to 20 cm.

  • Transmitters and receivers usedon long-reach links shall inter-operate for path lengths up to 100 cm.

  • The transmitter pins shall becapable of surviving short circuit either to each other, to supply voltages,and to ground.

 

Level I的详细电气特性如下:





Level II~IV的相关电气特性参考RapidIO Specification 4.1相关章节。

更多汽车与工控文章