This article mainly introduces the layered structure of CSI-2, including the physical layer, lane management layer, low-level protocol layer, pixel/byte packing/unpacking layer, and application layer.
CSI-2 provides specifications for data transmission and control between the sender and receiver, physically consisting of control and data transmission parts. The sender acts as a slave device while the receiver acts as a master device.According to the specifications of the MIPI Alliance, CSI-2 can be divided into 5 layers: application layer, packing/unpacking layer, low-level protocol layer, lane management layer, and physical layer. In practice, it can be summarized intothree levels: physical layer, protocol layer, and application layer. Their roles are:
-
Physical Layer: Defines the connection method of the physical link.
-
Protocol Layer: Further divided into three layers (pixel/byte packing/unpacking layer, low-level protocol layer, lane management layer), mainly concerning the packing method of image data and how to handle multi-channel image data.
-
Application Layer: The topmost layer of the protocol, related to the encoding and decoding of image data.

PHY Layer: The PHY layer specifies the transmission medium (conductors), input/output circuits, and clock mechanisms, which means extracting ‘0’ and ‘1’ signals from the serial bit stream. This part of the specification records the characteristics of the transmission medium and defines electrical parameters based on the relationship between the clock and the data channel for signaling and generating clocks.
The mechanisms for Start of Transmission (SoT) and End of Transmission (EoT) are standardized. Other ‘out of band’ information that can be transmitted between the physical layers of transmission and reception is also standardized. Bit-level and byte-level synchronization mechanisms are part of the PHY.
Protocol Layer: The protocol layer consists of several clearly defined tasks. The CSI-2 protocol layer allows multiple data streams to share a single host processor signal interface. The protocol layer specifies how multiple data streams are tagged and cross-accessed so that each data stream can be correctly reconstructed.
Lane Management Layer: To continuously improve performance, CSI-2 is lane scalable. The number of data channels can be 1, 2, 3, or 4, depending on the bandwidth requirements of the application. The interface sender allocates (“distributor” function) output data streams to one or more channels. At the receiver end, the interface collects bytes from the channels and merges them (“merger” function) into a recombined data stream, restoring the original data stream sequence. This layer treats the packets transmitted by LLP as pure byte data and distributes them according to the number of lanes, regardless of the meaning of the data in the packets.
LLP (Low Level Protocol) Layer: The LLP layer includes methods for transmitting events between Start of Transmission (SoT) and End of Transmission (EoT) for serial data, and for transmitting data to the next layer while establishing bit-level and byte-level synchronization. The minimum data granularity of LLP is one byte. The LLP layer is the main functional layer of the CSI protocol, defining not only the packet format but also the synchronization mechanisms used during transmission. At the sender end, this layer is responsible for packaging the data received from the upper layers, adding checksum fields, increasing synchronization packets, and sending them to the next layer; at the receiver end, it first checks the integrity of the packets and parses each field, executing corresponding operations based on the packet type and sending image data to the upper layer. The payload data processed by LLP is pure byte data that has been converted, without pixel concepts. By defining different fields and packet types, the transmission of image data frame by frame is achieved.
Pixel/Byte Packing/Unpacking Layer: CSI-2 supports various pixel format image applications, including data formats from 6 bits to 24 bits per pixel. At the transmitter end, data is sent from this layer to the LLP layer (Low Level Protocol) before this layer packs the data from the application layer into byte data; at the receiver end, the reverse process is executed, unpacking the data from the LLP layer from bytes to pixels before sending it to the application layer. Data with 8 bits per pixel is not changed during transmission at this layer.
The main purpose of this layer is to convert different pixel formats (e.g., YUYV, RGBA, etc.) into 8-bit byte format, eliminating differences between different image formats and reducing transmission complexity. For example, for RGB888 format, one pixel is 24 bits, which will be converted into three bytes; for RGB565 format, one pixel is 16 bits, converted into two bytes. For RGB444, which is 12 bits, it needs to be padded to become RGB565 format, which is two bytes, as shown in the following image:

Data exists in packet form at the protocol layer. At the interface sender end, a packet header and optional error check information are added to the data coming from the LLP layer. At the receiver end, the LLP layer strips off the packet header, and the receiver parses it according to the corresponding logic. Error check information can be used to detect the integrity of the received data.
Application Layer: This layer performs further data decoding and analysis of the data contained in the data stream. CSI-2 specifies the mapping of pixel values to bytes.