MIPI CSI2 learning (a): talk about MIPI CSI2

1. MIPI CSI2 Profile

The MIPI Alliance is an open membership organization. In July 2003, the Texas Instruments (TI), STMicroelectronics (ST), the United Kingdom ARM and Finland's Nokia (Nokia) 4 companies jointly established. The MIPI Alliance is intended to promote the standardization of mobile application processor interfaces. MIPI alliance different WorkGroup below, define a series of internal phone interface standard, such as the CSI camera interface, a display interface the DSI, the DigRF RF interface, a microphone / loudspeaker interface SLIMbus like.

CSI (Camera Serial Interface) is specified by the Camera Work Group under the MIPI Alliance interface standard. MIPI CSI CSI-2 is the second edition, mainly by the application layer, protocol layer, physical layer, maximum support 4 data transfer channels, in-line transmission speeds of up to 1Gb / s.

2. MIPI CSI2 hierarchical structure

MIPI layered CSI2 There are several methods, according to the specification of the MIPI alliance, CSI2 can be divided into five layers, respectively: the application layer, pack / unpack layer, the underlying protocol layer (Low Level Protocol), channel management and physical layer.

image

For more clear description of the protocol structure in terms, a detailed list thereof set forth in particular in Table 2-1.

Table 2-1 Protocol Structure Glossary

name Explanation
Application layer That is, the original image data processing algorithms module
Pack / unpack layer Responsible for the data according to a certain order, cut into 8-bit data.
Underlying protocol layer Newly generated data plus header packet end, the data stream is formed in line with the requirements of the protocol.
Channel Management The data stream generated according to a certain order and requirements, manage read and write, the output data stream.
Physical Layer Finally, a signal waveform generated MIPI.
Pixel data Module after the image processed data stream, the original image or data path.
transfer data After MIPI cut or module header plus the trailer.
control signal Controlling data flow between modules
The sender MIPI digital portion comprising a portion of the adapter plate to achieve MIPI transmission source.
Receiving end The adapter plate comprises a receiving end and a commercial module responsible for parsing the source MIPI received.

Detail, the working order of the link is as follows:

First, the original image data is done at the application layer corresponding image processing, including white balance, noise removal, color reproduction.

处理过后的数据进入组包层做数据分割和重组,再传给协议层。协议层根据数据类型产生包头,根据数据内容产生构成包尾的校验序列,之后将包头、数据本身、包尾组合起来发送给通道管理模块。

通道管理模块按照通道的选通情况,合理分配数据到每个通道,之后数据经过数模转换进入物理层传输,接收端在收到物理层的数据后,再按照之前的逆序解包出原始的图像数据。

3 MIPI CSI2的物理连接

除地线外,MIPI CSI2一般会有1对I2C通信引脚,1对MIPI差分时钟引脚和1~4对MIPI差分数据信号引脚,如图3-1所示。

image

图中涉及到的名词如表3-1所示:

表3-1 CSI2涉及到的各个引脚解释

名称 解释
DATA 1+ / DATA 1- MIPI 协议组包生成的差分模拟数据信号第二组
DATA 2+ / DATA 2- MIPI 协议组包生成的差分模拟数据信号第一组
CLOCK+ / CLOCK- MIPI 协议组包生成的差分模拟时钟信号
SDA I2C 数据信号线
SCL I2C 时钟信号线

在典型的应用中发送端在完成对图像的各种处理后,按照协议对数据进行打包,然后通过差分信号线向接收端传输信号,差分信号线一般有一对时钟差分线和多对数据差分线,数据差分信号线的数量与需要传输的数据量的要求有关,数据量越大多对数据线能更容易满足链路的需求。一般情况下两百万到五百万像素的手机使用两对差分数据线,即两个数据通道。而当摄像头像素进一步提高到八百万甚至一千三百万时一般会使用四个数据通道,即四对差分数据线。

与外部进行控制信号交互时,采用的是 I2C 接口,在 MIPI 的发送端使用的是 I2C 从端的 IP,MIPI CSI-2 接口的控制寄存器连接 I2C 的从端,这样外部接收装置可以通过 I2C 去配置 MIPI 发送端的内部寄存器,以此改变 MIPI CSI-2 接口内部状态机的持续时间和最后输出数据时的通道数,又或者在调试过程中读出这些寄存器,去做相应的检查,以判断发送端的工作状态,再通过接收端的现象来分析发送端是否工作在正常的状态。

4. MIPI CSI2的工作模式

D-PHY有两种传输模式:

(1) HS 高速传输模式,用于传输突发数据,同步传输,信号为差分信号,电平范围为100mv-300mv,传输速度范围是80-1000Mbps。在该模式下传输时,当差分线正端收到 1.2V 信号,负端收到 0V信号时,这时接收端识别为 1。反之为0。
  

(2) LP 低功耗模式,用于传输控制指令,异步传输,信号线为单端,电平范围是0-1.2v,没有用时钟线,时钟是通过两个数据线异或而来的,速度只有10Mbps。在该模式下传输时,当正端接收到300m V,负端接收到100m V 时接收端识别为1.反之则识别为0.

image

5. MIPI CSI2的数据包格式

MIPI CSI2是一个面向字节的,基于包的协议;它支持任意大小的数据通过短包和长包格式传输。各个包之间由EOT-LPS-SOT序列隔开,如图5-1所示。
image

LLP包有两种:长包和短包。每个包的传输以SoT(start of transmission)开始,EoT(end of transmission)结束,中间间隙是LPS(Low Power State低功耗状态)。

5.1 MIPI CSI2的长包格式

MIPI CSI2的长包主要有包头、数据包和包尾三部分构成。而包头又可细分为:数据标识(data identifier)、数据包大小(word count)和错误校验码(ECC)构成。如图5-2所示。

image

其中,数据标识大小为1字节,包含虚拟数据通道号[7:6]和数据类型[5:0]。

  • 数据包大小为2字节,其内容为传送数据的长度,以“字”为单位。
  • 错误校验码大小为1字节,负责对数据包的传输错误进行检查及纠错。
  • 数据包可以传送数据的大小为0~65535字节。
  • 包尾大小为2字节,是数据负荷的检查和。

5.2 MIPI CSI2的短包格式

Compared with long packets and short packets, and no packet trailer. Data identifying the type of data DI is between 0x00 to 0x0F. WC short field is a data field of the packet, the data may be user-defined. Is a check code ECC, an error can be error corrected 1bit, 2bit error check shown in Figure 5-3.

image

Guess you like

Origin www.cnblogs.com/linhaostudy/p/11334435.html