Mipi CSI-2 Specification v1-3
Mipi CSI-2 Specification v1-3
Version 1.3
29 May 2014
MIPI Board Adopted 07 October 2014
NOTICE OF DISCLAIMER
The material contained herein is not a license, either expressly or impliedly, to any IPR owned or controlled
by any of the authors or developers of this material or MIPI®. The material contained herein is provided on
an “AS IS” basis and to the maximum extent permitted by applicable law, this material is provided AS IS
AND WITH ALL FAULTS, and the authors and developers of this material and MIPI hereby disclaim all
other warranties and conditions, either express, implied or statutory, including, but not limited to, any (if
any) implied warranties, duties or conditions of merchantability, of fitness for a particular purpose, of
accuracy or completeness of responses, of results, of workmanlike effort, of lack of viruses, and of lack of
negligence.
All materials contained herein are protected by copyright laws, and may not be reproduced, republished,
distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express
prior written permission of MIPI Alliance. MIPI, MIPI Alliance and the dotted rainbow arch and all related
trademarks, tradenames, and other intellectual property are the exclusive property of MIPI Alliance and
cannot be used without its express prior written permission.
ALSO, THERE IS NO WARRANTY OF CONDITION OF TITLE, QUIET ENJOYMENT, QUIET
POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD
TO THIS MATERIAL OR THE CONTENTS OF THIS DOCUMENT. IN NO EVENT WILL ANY
AUTHOR OR DEVELOPER OF THIS MATERIAL OR THE CONTENTS OF THIS DOCUMENT OR
MIPI BE LIABLE TO ANY OTHER PARTY FOR THE COST OF PROCURING SUBSTITUTE GOODS
OR SERVICES, LOST PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER
CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY
OTHER AGREEMENT, SPECIFICATION OR DOCUMENT RELATING TO THIS MATERIAL,
WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF THE POSSIBILITY OF SUCH
DAMAGES.
Without limiting the generality of this Disclaimer stated above, the user of the contents of this Document is
further notified that MIPI: (a) does not evaluate, test or verify the accuracy, soundness or credibility of the
contents of this Document; (b) does not monitor or enforce compliance with the contents of this Document;
and (c) does not certify, test, or in any manner investigate products or services or any claims of compliance
with the contents of this Document. The use or implementation of the contents of this Document may
involve or require the use of intellectual property rights (“IPR”) including (but not limited to) patents,
patent applications, or copyrights owned by one or more parties, whether or not Members of MIPI. MIPI
does not make any search or investigation for IPR, nor does MIPI require or request the disclosure of any
IPR or claims of IPR as respects the contents of this Document or otherwise.
Questions pertaining to this document, or the terms or conditions of its provision, should be addressed to:
MIPI Alliance, Inc.
c/o IEEE-ISTO
445 Hoes Lane
Piscataway, NJ 08854
Attn: Board Secretary
Contents
Contents ............................................................................................................................ iii
Figures .............................................................................................................................. vii
Tables................................................................................................................................ xii
Release History ............................................................................................................... xiii
1 Introduction .................................................................................................................1
1.1 Scope ............................................................................................................................... 1
1.2 Purpose ............................................................................................................................ 1
2 Terminology .................................................................................................................2
2.1 Use of Special Terms ....................................................................................................... 2
2.2 Definitions ....................................................................................................................... 2
2.3 Abbreviations................................................................................................................... 3
2.4 Acronyms ......................................................................................................................... 3
3 References ....................................................................................................................5
4 Overview of CSI-2 .......................................................................................................7
5 CSI-2 Layer Definitions ..............................................................................................9
6 Camera Control Interface (CCI) ............................................................................. 11
6.1 Data Transfer Protocol ................................................................................................... 11
6.1.1 Message Type ............................................................................................................. 11
6.1.2 Read/Write Operations ............................................................................................... 12
6.2 CCI Slave Addresses...................................................................................................... 15
6.3 CCI Multi-Byte Registers .............................................................................................. 15
6.3.1 Overview .................................................................................................................... 15
6.3.2 The Transmission Byte Order for Multi-byte Register Values ................................... 17
6.3.3 Multi-Byte Register Protocol...................................................................................... 18
6.4 Electrical Specifications and Timing for I/O Stages ...................................................... 22
7 Physical Layer ...........................................................................................................26
7.1 D-PHY Physical Layer Option ...................................................................................... 26
7.2 C-PHY Physical Layer Option....................................................................................... 26
8 Multi-Lane Distribution and Merging ....................................................................28
8.1 Lane Distribution for the D-PHY Physical Layer Option.............................................. 31
8.2 Lane Distribution for the C-PHY Physical Layer Option .............................................. 35
8.3 Multi-Lane Interoperability ........................................................................................... 36
9 Low Level Protocol....................................................................................................39
9.1 Low Level Protocol Packet Format ............................................................................... 39
9.1.1 Low Level Protocol Long Packet Format................................................................... 39
9.1.2 Low Level Protocol Short Packet Format .................................................................. 44
9.2 Data Identifier (DI) ........................................................................................................ 45
9.3 Virtual Channel Identifier .............................................................................................. 45
9.4 Data Type (DT) .............................................................................................................. 46
9.5 Packet Header Error Correction Code for D-PHY Physical Layer Option .................... 46
9.5.1 General Hamming Code Applied to Packet Header ................................................... 47
Figures
Figure 1 CSI-2 and CCI Transmitter and Receiver Interface for D-PHY ........................................ 7
Figure 2 CSI-2 and CCI Transmitter and Receiver Interface for C-PHY......................................... 8
Figure 3 CSI-2 Layer Definitions ..................................................................................................... 9
Figure 4 CCI Message Types.......................................................................................................... 12
Figure 5 CCI Single Read from Random Location ........................................................................ 12
Figure 6 CCI Single Read from Current Location ......................................................................... 13
Figure 7 CCI Sequential Read Starting from a Random Location ................................................. 13
Figure 8 CCI Sequential Read Starting from the Current Location ............................................... 14
Figure 9 CCI Single Write to a Random Location ......................................................................... 14
Figure 10 CCI Sequential Write Starting from a Random Location .............................................. 15
Figure 11 Corruption of a 32-bit Wide Register during a Read Message....................................... 16
Figure 12 Corruption of a 32-bit Wide Register during a Write Message ...................................... 17
Figure 13 Example 16-bit Register Write ....................................................................................... 17
Figure 14 Example 32-bit Register Write (address not shown)...................................................... 18
Figure 15 Example 64-bit Register Write (address not shown)...................................................... 18
Figure 16 Example 16-bit Register Read ....................................................................................... 19
Figure 17 Example 32-bit Register Read ....................................................................................... 20
Figure 18 Example 16-bit Register Write ....................................................................................... 21
Figure 19 Example 32-bit Register Write ....................................................................................... 22
Figure 20 CCI Timing .................................................................................................................... 25
Figure 21 Conceptual Overview of the Lane Distributor Function for D-PHY ............................. 28
Figure 22 Conceptual Overview of the Lane Distributor Function for C-PHY ............................. 29
Figure 23 Conceptual Overview of the Lane Merging Function for D-PHY ................................. 30
Figure 24 Conceptual Overview of the Lane Merging Function for C-PHY ................................. 31
Figure 25 Two Lane Multi-Lane Example for D-PHY .................................................................. 32
Figure 26 Three Lane Multi-Lane Example for D-PHY ................................................................ 33
Figure 27 N-Lane Multi-Lane Example for D-PHY ...................................................................... 34
Figure 28 N-Lane Multi-Lane Example for D-PHY Short Packet Transmission ........................... 35
Figure 29 Two Lane Multi-Lane Example for C-PHY ................................................................... 36
Figure 30 Three Lane Multi-Lane Example for C-PHY ................................................................ 36
Figure 31 General N-Lane Multi-Lane Distribution for C-PHY .................................................... 36
Figure 32 One Lane Transmitter and N-Lane Receiver Example for D-PHY................................ 37
Figure 33 M-Lane Transmitter and N-Lane Receiver Example (M<N) for D-PHY ...................... 37
Figure 34 M-Lane Transmitter and One Lane Receiver Example for D-PHY ............................... 38
Figure 35 M-Lane Transmitter and N-Lane Receiver Example (N<M) for D-PHY ...................... 38
Figure 36 Low Level Protocol Packet Overview ........................................................................... 39
Figure 37 Long Packet Structure for D-PHY Physical Layer Option ............................................ 40
Figure 38 Long Packet Structure for C-PHY Physical Layer Option............................................. 41
Figure 39 Packet Header Lane Distribution for C-PHY Physical Layer Option ............................ 41
Figure 40 Minimal Filler Byte Insertion Requirements for Three Lane C-PHY............................ 43
Figure 41 Short Packet Structure for D-PHY Physical Layer Option ............................................ 44
Figure 42 Short Packet Structure for C-PHY Physical Layer Option ............................................ 44
Figure 43 Data Identifier Byte ........................................................................................................ 45
Figure 44 Logical Channel Block Diagram (Receiver) .................................................................. 45
Figure 45 Interleaved Video Data Streams Examples .................................................................... 46
Figure 46 24-bit ECC Generation Example ................................................................................... 47
Figure 47 64-bit ECC Generation on TX Side ............................................................................... 51
Figure 48 24-bit ECC Generation on TX Side ............................................................................... 51
Figure 49 64-bit ECC on RX Side Including Error Correction ...................................................... 52
Figure 50 24-bit ECC on RX Side Including Error Correction ...................................................... 53
Figure 51 Checksum Transmission Byte Order.............................................................................. 53
Figure 52 Checksum Generation for Long Packet Payload Data ................................................... 54
Figure 53 Definition of 16-bit CRC Shift Register ........................................................................ 54
Figure 54 16-bit CRC Software Implementation Example ............................................................ 55
Figure 55 Packet Spacing ............................................................................................................... 56
Figure 56 Multiple Packet Example ............................................................................................... 58
Figure 57 Single Packet Example................................................................................................... 58
Figure 58 Line and Frame Blanking Definitions ............................................................................ 59
Figure 59 Vertical Sync Example ................................................................................................... 60
Figure 60 Horizontal Sync Example .............................................................................................. 60
Figure 61 General Frame Format Example .................................................................................... 61
Figure 62 Digital Interlaced Video Example .................................................................................. 62
Figure 63 Digital Interlaced Video with Accurate Synchronization Timing Information .............. 63
Figure 64 Interleaved Data Transmission using Data Type Value .................................................. 64
Tables
Table 1 CCI I/O Characteristics ..................................................................................................... 22
Table 2 CCI Timing Specification .................................................................................................. 24
Table 3 Data Type Classes .............................................................................................................. 46
Table 4 ECC Syndrome Association Matrix................................................................................... 48
Table 5 ECC Parity Generation Rules ............................................................................................ 49
Table 6 Synchronization Short Packet Data Type Codes ............................................................... 56
Table 7 Generic Short Packet Data Type Codes ............................................................................. 57
Table 8 Primary and Secondary Data Formats Definitions ............................................................ 69
Table 9 Generic 8-bit Long Packet Data Types .............................................................................. 70
Table 10 YUV Image Data Types ................................................................................................... 71
Table 11 Legacy YUV420 8-bit Packet Data Size Constraints ...................................................... 72
Table 12 YUV420 8-bit Packet Data Size Constraints ................................................................... 74
Table 13 YUV420 10-bit Packet Data Size Constraints ................................................................. 77
Table 14 YUV422 8-bit Packet Data Size Constraints ................................................................... 78
Table 15 YUV422 10-bit Packet Data Size Constraints ................................................................. 80
Table 16 RGB Image Data Types ................................................................................................... 81
Table 17 RGB888 Packet Data Size Constraints ............................................................................ 82
Table 18 RGB666 Packet Data Size Constraints ............................................................................ 83
Table 19 RGB565 Packet Data Size Constraints ............................................................................ 84
Table 20 RAW Image Data Types .................................................................................................. 87
Table 21 RAW6 Packet Data Size Constraints ............................................................................... 87
Table 22 RAW7 Packet Data Size Constraints ............................................................................... 88
Table 23 RAW8 Packet Data Size Constraints ............................................................................... 89
Table 24 RAW10 Packet Data Size Constraints ............................................................................. 90
Table 25 RAW12 Packet Data Size Constraints ............................................................................. 91
Table 26 RAW14 Packet Data Size Constraints ............................................................................. 92
Table 27 User Defined 8-bit Data Types ........................................................................................ 94
Table 28 Status Data Padding ....................................................................................................... 109
Table 29 JPEG8 Additional Marker Codes Listing ...................................................................... 111
Release History
1 Introduction
1.1 Scope
1 The Camera Serial Interface 2 Specification defines an interface between a peripheral device (camera) and
2 a host processor (baseband, application engine). The purpose of this document is to specify a standard
3 interface between a camera and a host processor for mobile applications.
4 This Revision of the Camera Serial Interface 2 Specification leverages [MIPI01] D-PHY 1.2 and introduces
5 [MIPI02] C-PHY 1.0, both with improved skew tolerance and higher data rates. These enhancements
6 enable higher interface bandwidth and more flexibility in channel layout. The CSI-2 1.3 Specification was
7 designed to ensure interoperability with CSI-2 1.2 when the former uses the D-PHY physical layer. If the
8 C-PHY physical layer only is used, backwards compatibility cannot be maintained.
9 A host processor in this document refers to the hardware and software that performs essential core
10 functions for telecommunication or application tasks. The engine of a mobile terminal includes hardware
11 and the functions, which enable the basic operation of the mobile terminal. These include, for example, the
12 printed circuit boards, RF components, basic electronics, and basic software, such as the digital signal
13 processing software.
1.2 Purpose
14 Demand for increasingly higher image resolutions is pushing the bandwidth capacity of existing host
15 processor-to-camera sensor interfaces. Common parallel interfaces are difficult to expand, require many
16 interconnects and consume relatively large amounts of power. Emerging serial interfaces address many of
17 the shortcomings of parallel interfaces while introducing their own problems. Incompatible, proprietary
18 interfaces prevent devices from different manufacturers from working together. This can raise system costs
19 and reduce system reliability by requiring “hacks” to force the devices to interoperate. The lack of a clear
20 industry standard can slow innovation and inhibit new product market entry.
21 CSI-2 provides the mobile industry a standard, robust, scalable, low-power, high-speed, cost-effective
22 interface that supports a wide range of imaging solutions for mobile devices.
2 Terminology
2.2 Definitions
41 Lane: A unidirectional, point-to-point, 2- or 3-wire interface used for high-speed serial clock or data
42 transmission; the number of wires is determined by the PHY specification in use (i.e. either D-PHY or C-
43 PHY, respectively). A CSI-2 camera interface using the D-PHY physical layer consists of one clock Lane
44 and one or more data Lanes. A CSI-2 camera interface using the C-PHY physical layer consists of one or
45 more Lanes, each of which transmits both clock and data information. Note that when describing features
46 or behavior applying to both D-PHY and C-PHY, this specification sometimes uses the term data Lane to
47 refer to both a D-PHY data Lane and a C-PHY Lane.
48 Packet: A group of bytes organized in a specified way to transfer data across the interface. All packets have
49 a minimum specified set of components. The byte is the fundamental unit of data from which packets are
50 made.
51 Payload: Application data only – with all sync, header, ECC and checksum and other protocol-related
52 information removed. This is the “core” of transmissions between application processor and peripheral.
53 Sleep Mode: Sleep mode (SLM) is a leakage level only power consumption mode.
54 Transmission: The time during which high-speed serial data is actively traversing the bus. A transmission
55 is comprised of one or more packets. A transmission is bounded by SoT (Start of Transmission) and EoT
56 (End of Transmission) at beginning and end, respectively.
57 Virtual Channel: Multiple independent data streams for up to four peripherals are supported by this
58 Specification. The data stream for each peripheral is a Virtual Channel. These data streams may be
59 interleaved and sent as sequential packets, with each packet dedicated to a particular peripheral or channel.
60 Packet protocol includes information that links each packet to its intended peripheral.
2.3 Abbreviations
61 e.g. For example (Latin: exempli gratia)
62 i.e. That is (Latin: id est)
2.4 Acronyms
63 BER Bit Error Rate
64 CCI Camera Control Interface
65 CIL Control and Interface Logic
66 CRC Cyclic Redundancy Check
67 CSI Camera Serial Interface
68 CSPS Chroma Shifted Pixel Sampling
69 DDR Dual Data Rate
70 DI Data Identifier
71 DT Data Type
72 ECC Error Correction Code
73 EoT End of Transmission
74 EXIF Exchangeable Image File Format
75 FE Frame End
76 FS Frame Start
77 HS High Speed; identifier for operation mode
78 HS-RX High-Speed Receiver
79 HS-TX High-Speed Transmitter
80 I2C Inter-Integrated Circuit
81 JFIF JPEG File Interchange Format
82 JPEG Joint Photographic Expert Group
83 LE Line End
84 LLP Low Level Protocol
85 LS Line Start
86 LSB Least Significant Bit
87 LSS Least Significant Symbol
88 LP Low-Power; identifier for operation mode
89 LP-RX Low-Power Receiver (Large-Swing Single Ended)
90 LP-TX Low-Power Transmitter (Large-Swing Single Ended)
91 MSB Most Significant Bit
92 MSS Most Significant Symbol
93 PF Packet Footer
94 PH Packet Header
95 PI Packet Identifier
96 PT Packet Type
97 PHY Physical Layer
98 PPI PHY Protocol Interface
99 RGB Color representation (Red, Green, Blue)
100 RX Receiver
101 SCL Serial Clock (for CCI)
102 SDA Serial Data (for CCI)
103 SLM Sleep Mode
104 SoT Start of Transmission
105 TX Transmitter
106 ULPS Ultra low Power State
107 VGA Video Graphics Array
108 YUV Color representation (Y for luminance, U & V for chrominance)
3 References
109 [NXP01] UM10204, I2C-bus specification and user manual, Revision 03, NXP B.V.,
110 19 June 2007.
111 [MIPI01] MIPI Alliance Specification for D PHY, version 1.2, MIPI Alliance, Inc.,
112 10 September 2014.
113 [MIPI02] MIPI Alliance Specification for C PHY, version 1.0, MIPI Alliance, Inc.,
114 07 October 2014.
Data1+ Data1+
Data1- Data1-
One 2-wire Clock Lane
Clock+ Clock+
Clock- Clock-
400kHz Bidirectional
CCI Slave Control Link CCI Master
SCL SCL
SDA SDA
129
Figure 1 CSI-2 and CCI Transmitter and Receiver Interface for D-PHY
Data1_A Data1_A
Data1_B Data1_B
Data1_C Data1_C
400kHz Bidirectional
CCI Slave Control Link CCI Master
SCL SCL
SDA SDA
130
Figure 2 CSI-2 and CCI Transmitter and Receiver Interface for C-PHY
Transmitter Receiver
Application Application
Pixel Control Pixel Control
6-, 7-, 8-, 10-, 12-, 14-, 15-, 16-, 18- or 24-bits
8-bits 8-bits
144 • Protocol Layer. The Protocol layer is composed of several layers, each with distinct
145 responsibilities. The CSI-2 protocol enables multiple data streams using a single interface on the
146 host processor. The Protocol layer specifies how multiple data streams may be tagged and
147 interleaved so each data stream can be properly reconstructed.
148 • Pixel/Byte Packing/Unpacking Layer. The CSI-2 specification supports image applications
149 with varying pixel formats from six to twenty-four bits per pixel. In the transmitter this layer
150 packs pixels from the Application layer into bytes before sending the data to the Low Level
151 Protocol layer. In the receiver this layer unpacks bytes from the Low Level Protocol layer into
152 pixels before sending the data to the Application layer. Eight bits per pixel data is transferred
153 unchanged by this layer.
154 • Low Level Protocol. The Low Level Protocol (LLP) includes the means of establishing bit-
155 level and byte-level synchronization for serial data transferred between SoT (Start of
156 Transmission) and EoT (End of Transmission) events and for passing data to the next layer. The
157 minimum data granularity of the LLP is one byte. The LLP also includes assignment of bit-value
158 interpretation within the byte, i.e. the “Endian” assignment.
159 • Lane Management. CSI-2 is Lane-scalable for increased performance. The number of data
160 Lanes is not limited by this specification and may be chosen depending on the bandwidth
161 requirements of the application. The transmitting side of the interface distributes (“distributor”
162 function) bytes from the outgoing data stream to one or more Lanes. On the receiving side, the
163 interface collects bytes from the Lanes and merges (“merger” function) them together into a
164 recombined data stream that restores the original stream sequence. For the C-PHY physical
165 layer option, this layer exclusively distributes or collects byte pairs (i.e. 16-bits) to or from the
166 data Lanes.
167 Data within the Protocol layer is organized as packets. The transmitting side of the interface
168 appends header and error-checking information on to data to be transmitted at the Low Level
169 Protocol layer. On the receiving side, the header is stripped off at the Low Level Protocol layer
170 and interpreted by corresponding logic in the receiver. Error-checking information may be used to
171 test the integrity of incoming data.
172 • Application Layer. This layer describes higher-level encoding and interpretation of data
173 contained in the data stream and is beyond the scope of this specification. The CSI-2 Specification
174 describes the mapping of pixel values to bytes.
175 The normative sections of the Specification only relate to the external part of the Link, e.g. the data and bit
176 patterns that are transferred across the Link. All internal interfaces and layers are purely informative.
Message type with 8-bit index and 8-bit data (7-bit address)
SLAVE R/ SUB A/
S A A DATA P
ADDRESS W ADDRESS A
INDEX[7:0]
Message type with 16-bit index and 8-bit data (7-bit address)
SLAVE R/ A/
S A SUB ADDRESS A SUB ADDRESS A DATA P
ADDRESS W A
INDEX[15:8] INDEX[7:0]
SLAVE S SLAVE
S 0 A SUB ADDRESS A 1 A DATA A P
ADDRESS r ADDRESS
INDEX, value M
SLAVE SLAVE
S 1 A DATA A P S 1 A DATA A P
ADDRESS ADDRESS
Index Index
Previous Index value, K Index M
(M +L-1) M+L
Index Index
Previous Index value, K Index K+1
(K +L-1) K+L
SLAVE
S 1 A DATA A DATA A DATA A P
ADDRESS
L bytes of data
SLAVE SUB A/
S 0 A A DATA P
ADDRESS ADDRESS A
INDEX, value M
Index Index
Previous Index value, K Index M
(M+L+1) M+L
SLAVE SUB A/
S 0 A A DATA A DATA P
ADDRESS ADDRESS A
282 Partial access to multi-byte registers is not allowed. A multi-byte register shall only be accessed by a single
283 sequential message. When a multi-byte register is accessed, its first byte is accessed first; its second byte is
284 accessed second, etc.
285 When a multi-byte register is accessed, the following re-timing rules must be followed:
286 • For a Write operation, the updating of the register shall be deferred to a time when the last bit of
287 the last byte has been received
288 • For a Read operation, the value read shall reflect the status of all bytes at the time that the first bit
289 of the first byte has been read
290 Section 6.3.3 describes example behavior for the re-timing of multi-byte register accesses.
291 Without re-timing, data may be corrupted as illustrated in Figure 11 and Figure 12.
SLAVE
S 1 A DATA = 0xFC A DATA=0xFD A DATA=0x03 A DATA=0x04 A P
ADDRESS
MS Data Byte LS Data Byte
DATA[31:0]
Internal logic
reads register
value
(For example
Register Index only)
SLAVE
S 0 A DATA=0x01 A DATA=0x02 A DATA=0x03 A DATA=0x04 A P
ADDRESS
MS Data Byte LS Data Byte
DATA[31:0]
294 6.3.2 The Transmission Byte Order for Multi-byte Register Values
295 This is a normative section.
296 The first byte of a CCI message is always the MS byte of a multi-byte register and the last byte is always
297 the LS byte.
DATA[15:0]
SLAVE SUB
S 0 A A DATA[15:8] A DATA[7:0] A P
ADDRESS ADDRESS
Index Value,
MS Data Byte LS Data Byte
M
298 Index M Index M+1
Register Index
Index M Index M+1 Index M+2 Index M+3
A/
A DATA A DATA A DATA A DATA
A
DATA[31:0]
299 MS Data Byte LS Data Byte
Register Index
Index M Index M+1 Index M+6 Index M+7
A/
A DATA A DATA A A DATA A DATA
A
DATA[63:0]
300 MS Data Byte LS Data Byte
Temporary Buffer
0x00 00 0xFC FD 0x03 04
A read from MS byte of the register Incremental read within the same
causes the whole register value to multi-byte register.
be transferred into a temporary Temporary Buffer not updated
buffer
SLAVE
S 1 A DATA = 0xFC A DATA=0xFD A DATA=0x03 A DATA=0x04 A P
ADDRESS
MS Data Byte LS Data Byte MS Data Byte LS Data Byte
DATA[15:0] DATA[15:0]
313 In this definition there is no distinction made between whether the register is accessed incrementally via
314 separate, single byte read messages with no intervening data writes or via a single multi-location read
315 message. This protocol purely relates to the behavior of the index value.
316 Examples of when the temporary buffer is updated are as follows:
317 • The MS byte of a register is accessed
318 • The index has crossed a multi-byte register boundary
319 • Successive single byte reads from the same index location
320 • The index value for the byte about to be read is the same or less than the previous index
321 Unless the contents of a multi-byte register are accessed in an incremental manner the values read back are
322 not guaranteed to be consistent.
323 The contents of the temporary buffer are reset to zero by START and STOP conditions.
Temporary Buffer
0x00 00 00 00 0xFC FD FE FF
A read from MS byte of the register Incremental read within the same
causes the whole register value to multi-byte register.
be transferred into a temporary Temporary Buffer not updated
buffer
SLAVE
S 1 A DATA = 0xFC A DATA=0xFD A DATA=0xFE A DATA=0xFF A P
ADDRESS
MS Data Byte LS Data Byte
DATA[31:0]
Register Index
Index M Index M+1 Index M+2 Index M+3
Temporary Buffer
0x00 00 0x01 00 0x00 00 0x03 00 0x00 00
SLAVE
S 0 A DATA=0x01 A DATA=0x02 A DATA=0x03 A DATA=0x04 A P
ADDRESS
MS Data Byte LS Data Byte MS Data Byte LS Data Byte
DATA[15:0] DATA[15:0]
Register Index
Index M Index M+1 Index M+2 Index M+3
Temporary Buffer
0x00 00 00 00 0x01 00 00 00 0x01 02 00 00 0x01 02 03 00 0x00 00 00 00
SLAVE
S 0 A DATA=0x01 A DATA=0x02 A DATA=0x03 A DATA=0x04 A P
ADDRESS
MS Data Byte LS Data Byte
DATA[31:0]
SDA
tR tF
tSU;STA
tSU;STO
tSU;DAT
tHD;DAT
tHD;STA
tLOW
SCL
tHIGH
tHD;STA
342 tSP
•••• ••••
Byte 5 Byte 5
Byte 4 Byte 4
Byte Stream
Byte 3 (Conceptual) Byte 3
Byte 2 Byte 2
Byte 1 Byte 1
Byte 0 Byte 0
Byte 3
• •• • • •• •
Byte 5 Byte 5
Byte 4 Conceptual Byte Stream Byte 4
Byte 3 From Low Level Protocol Byte 3
Byte 2 Byte 2
Byte 1 Byte 1
Byte 0 Byte 0
N Lane Link
Single Lane Link
404
Figure 22 Conceptual Overview of the Lane Distributor Function for C-PHY
Single Lane
Link N Lane Link
Byte 1
LMF ••••
Byte 5 Byte 5
Byte 4 Byte 4
Byte Stream
Byte 3 (Conceptual) Byte 3
Byte 2 Byte 2
Byte 1 Byte 1
Byte 0 Byte 0
405
Figure 23 Conceptual Overview of the Lane Merging Function for D-PHY
• ••
• •• • • •• • • •• • • •• • • •• •
Byte 7 Byte 2N +1 Byte 2N +3 • •• Byte 4N -3 Byte 4N -1
Byte 6 Byte 2N Byte 2N +2 Byte 4N -4 Byte 4N -2
Byte 5 Byte 1 Byte 3 Byte 2N -3 Byte 2N -1
Byte 4 Byte 0 Byte 2 Byte 2N -4 Byte 2N -2
Byte 3
Byte 2
Byte 1
Byte 0
Lane Merging Function (LMF)
LMF • •• •
Byte 5 Byte 5
Byte 2 Byte 2
Byte 1 Byte 1
Byte 0 Byte 0
406
Figure 24 Conceptual Overview of the Lane Merging Function for C-PHY
407 The Lane distributor takes a transmission of arbitrary byte length, buffers up N*b bytes (where N = number
408 of Lanes and b = 1 or 2 for the D-PHY or C-PHY physical layer option, respectively), and then sends
409 groups of N*b bytes in parallel across N Lanes with each Lane receiving b bytes. Before sending data, all
410 Lanes perform the SoT sequence in parallel to indicate to their corresponding receiving units that the first
411 byte of a packet is beginning. After SoT, the Lanes send groups of successive bytes from the first packet in
412 parallel, following a round-robin process.
413 8.1 Lane Distribution for the D-PHY Physical Layer Option
414 Examples are shown in Figure 25, Figure 26, Figure 27, and Figure 28:
415 • 2-Lane system (Figure 25): byte 0 of the packet goes to Lane 1, byte 1 goes to Lane 2, byte 2 to
416 Lane 1, byte 3 goes to Lane 2, byte 4 goes to Lane 1, and so on.
417 • 3-Lane system (Figure 26): byte 0 of the packet goes to Lane 1, byte 1 goes to Lane 2, byte 2 to
418 Lane 3, byte 3 goes to Lane 1, byte 4 goes to Lane 2, and so on.
419 • N-Lane system (Figure 27): byte 0 of the packet goes to Lane 1, byte 1 goes to Lane 2, byte N-1
420 goes to Lane N, byte N goes to Lane 1, byte N+1 goes to Lane 2, and so on.
421 • N-lane system (Figure 28) with N>4 short packet (4 bytes) transmission: byte 0 of the packet goes
422 to Lane 1, byte 1 goes to Lane 2, byte 2 goes to Lane 3, byte 3 goes to Lane 4, and Lanes 5 to N
423 do not receive bytes and stay in LPS state.
424 At the end of the transmission, there may be “extra” bytes since the total byte count may not be an integer
425 multiple of the number of Lanes, N. One or more Lanes may send their last bytes before the others. The
426 Lane distributor, as it buffers up the final set of less-than-N bytes in parallel for sending to N data Lanes,
427 de-asserts its “valid data” signal into all Lanes for which there is no further data. For systems with more
428 than 4 data Lanes sending a short packet constituted of 4 bytes the Lanes which do not receive a byte for
429 transmission shall stay in LPS state.
430 Each D-PHY data Lane operates autonomously.
431 Although multiple Lanes all start simultaneously with parallel “start packet” codes, they may complete the
432 transaction at different times, sending “end packet” codes one cycle (byte) apart.
433 The N PHYs on the receiving end of the link collect bytes in parallel, and feed them into the Lane-merging
434 layer. This reconstitutes the original sequence of bytes in the transmission, which can then be partitioned
435 into individual packets for the packet decoder layer.
LANE 1: SoT Byte 0 Byte 2 Byte 4 Byte B-6 Byte B-4 Byte B-2 EoT
LANE 2: SoT Byte 1 Byte 3 Byte 5 Byte B-5 Byte B-3 Byte B-1 EoT
LANE 1: SoT Byte 0 Byte 2 Byte 4 Byte B-5 Byte B-3 Byte B-1 EoT
LANE 2: SoT Byte 1 Byte 3 Byte 5 Byte B-4 Byte B-2 EoT LPS
KEY:
436 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 25 Two Lane Multi-Lane Example for D-PHY
LANE 1: SoT Byte 0 Byte 3 Byte 6 Byte B-9 Byte B-6 Byte B-3 EoT
LANE 2: SoT Byte 1 Byte 4 Byte 7 Byte B-8 Byte B-5 Byte B-2 EoT
LANE 3: SoT Byte 2 Byte 5 Byte 8 Byte B-7 Byte B-4 Byte B-1 EoT
Number of Bytes, B, transmitted is NOT an integer multiple of the number of lanes (Example 1):
LANE 1: SoT Byte 0 Byte 3 Byte 6 Byte B-7 Byte B-4 Byte B-1 EoT
LANE 2: SoT Byte 1 Byte 4 Byte 7 Byte B-6 Byte B-3 EoT LPS
LANE 3: SoT Byte 2 Byte 5 Byte 8 Byte B-5 Byte B-2 EoT LPS
Number of Bytes, B, transmitted is NOT an integer multiple of the number of lanes (Example 2):
LANE 1: SoT Byte 0 Byte 3 Byte 6 Byte B-8 Byte B-5 Byte B-2 EoT
LANE 2: SoT Byte 1 Byte 4 Byte 7 Byte B-7 Byte B-4 Byte B-1 EoT
LANE 3: SoT Byte 2 Byte 5 Byte 8 Byte B-6 Byte B-3 EoT LPS
KEY:
437 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 26 Three Lane Multi-Lane Example for D-PHY
LANE 2: SoT Byte 1 Byte N+1 Byte B-2N+1 Byte B-N+1 EoT
•••
•••
•••
•••
•••
LANE N-1: SoT Byte N-2 Byte 2N-2 Byte B-N-2 Byte B-2 EoT
LANE N: SoT Byte N-1 Byte 2N-1 Byte B-N-1 Byte B-1 EoT
•••
•••
•••
•••
LANE K: SoT Byte K-1 Byte N+K-1 Byte B-N-1 Byte B-1 EoT
LANE K+1: SoT Byte K Byte N+K Byte B-N EoT LPS
•••
•••
•••
•••
•••
LANE N: SoT Byte N-1 Byte 2N-1 Byte B-K-1 EoT LPS
KEY:
438 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 27 N-Lane Multi-Lane Example for D-PHY
•••
LANE 4: SoT Byte 3 EoT LPS
LANE 5: LPS
KEY:
439 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 28 N-Lane Multi-Lane Example for D-PHY Short Packet Transmission
440 8.2 Lane Distribution for the C-PHY Physical Layer Option
441 Examples are shown in Figure 29 and Figure 30:
442 • 2-Lane system (Figure 29): bytes 1 and 0 of the packet are sent as a 16-bit word to the Lane 1 C-
443 PHY module, bytes 3 and 2 are sent to Lane 2, bytes 5 and 4 are sent to Lane 1, bytes 7 and 6 are
444 sent to Lane 2, bytes 9 and 8 are sent to Lane 1, and so on.
445 • 3-Lane system (Figure 30): bytes 1 and 0 of the packet are sent as a 16-bit word to the Lane 1 C-
446 PHY module, bytes 3 and 2 are sent to Lane 2, bytes 5 and 4 are sent to Lane 3, bytes 7 and 6 are
447 sent to Lane 1, bytes 9 and 8 are sent to Lane 2, and so on.
448 Figure 31 illustrates normative behavior for an N-Lane system where N ≥ 1: bytes 1 and 0 of the packet are
449 sent as a 16-bit word to the Lane 1 C-PHY module, bytes 3 and 2 are sent to Lane 2, bytes 2N-1 and 2N-2
450 are sent to Lane N, bytes 2N+1 and 2N are sent to Lane 1, and so on. The last two bytes B-1 and B-2 are
451 sent to Lane N, where B is the total number of bytes in the packet.
452 For an N-Lane transmitter, the C-PHY module for Lane n (1 ≤ n ≤ N) shall transmit the following
453 sequence of {ms byte : ls byte} byte pairs from a B-byte packet generated by the low level protocol layer:
454 {Byte 2*(k*N+n)-1 : Byte 2*(k*N+n)-2}, for k = 0, 1, 2, …, B/(2N) - 1, where Byte 0 is the first byte in
455 the packet. The low level protocol shall guarantee that B is an integer multiple of 2N.
456 That is, at the end of the packet transmission, there shall be no “extra” bytes since the total byte count is
457 always an even multiple of the number of Lanes, N. The Lane distributor, after sending the final set of 2N
458 bytes in parallel to the N Lanes, simultaneously de-asserts its “valid data” signal to all Lanes, signaling to
459 each C-PHY Lane module that it may start its EoT sequence.
460 Each C-PHY Lane module operates autonomously, but packet data transmission starts and stops at the same
461 time on all Lanes.
462 The N C-PHY receiver modules on the receiving end of the link collect byte pairs in parallel, and feed them
463 into the Lane-merging layer. This reconstitutes the original sequence of bytes in the transmission, which
464 can then be partitioned into individual packets for the packet decoder layers.
KEY:
465 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 29 Two Lane Multi-Lane Example for C-PHY
KEY:
466 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 30 Three Lane Multi-Lane Example for C-PHY
Bytes 2N+3: Bytes 4N+3: Bytes B-6N+3: Bytes B-4N+3: Bytes B-2N+3:
LANE 2: SoT Bytes 3:2
2N+2 4N+2 B-6N+2 B-4N+2 B-2N+2
EoT
•••
•••
•••
•••
•••
•••
Bytes 2N-3: Bytes 4N-3: Bytes 6N-3: Bytes B-4N-3: Bytes B-2N-3: Bytes B-3:
LANE N-1: SoT 2N-4 4N-4 6N-4 B-4N-4 B-2N-4 B-4
EoT
Bytes 2N-1: Bytes 4N-1: Bytes 6N-1: Bytes B-4N-1: Bytes B-2N-1: Bytes B-1:
LANE N: SoT 2N-2 4N-2 6N-2 B-4N-2 B-2N-2 B-2
EoT
KEY:
467 LPS – Low Power State SoT – Start of Transmission EoT – End of Transmission
Figure 31 General N-Lane Multi-Lane Distribution for C-PHY
471 An "N" data Lane receiver shall be connected with an "M" data Lane transmitter, by CCI configuration of
472 the Lane distribution and merging layers within the CSI-2 transmitter and receiver when more than one data
473 Lane is used. Thus, if M<=N a receiver with N data Lanes shall work with transmitters with M data Lanes.
474 Likewise, if M>=N a transmitter with M Lanes shall work with receivers with N data Lanes. Transmitter
475 Lanes 1 to M shall be connected to the receiver Lanes 1 to N.
476 Two cases:
477 • If M<=N then there is no loss of performance – the receiver has sufficient data Lanes to match the
478 transmitter (Figure 32 and Figure 33).
479 • If M> N then there may be a loss of performance (e.g. frame rate) as the receiver has fewer data
480 Lanes than the transmitter (Figure 34 and Figure 35).
481 • Note that while the examples shown are for the D-PHY physical layer option, the C-PHY physical
482 layer option is handled similarly, except there is no clock Lane.
1 lane N lane
Transmitter PHY Receiver PHY
Lane Distribution Function
•••
•••
•••
8-bit SerDes Lane 1 SerDes 8-bit
M lane N lane
Transmitter PHY Receiver PHY
SerDes 8-bit
Lane Distribution Function
•••
•••
•••
•••
•••
•••
•••
•••
M lane 1 lane
Transmitter PHY Receiver PHY
Lane Distribution Function
•••
•••
•••
8-bit SerDes Lane 1 SerDes 8-bit
M lane N lane
Transmitter PHY Receiver PHY
8-bit SerDes
Lane Distribution Function
•••
•••
•••
•••
•••
•••
•••
•••
8-bit SerDes Lane 1 SerDes 8-bit
DATA:
Short Long Long Short
Packet Packet Packet Packet
KEY:
LPS – Low Power State PH – Packet Header
ET – End of Transmission PF – Packet Footer + Filler (if applicable)
499 ST – Start of Transmission
Figure 36 Low Level Protocol Packet Overview
Data WC-4
Data WC-3
Data WC-2
Data WC-1
Checksum
Data ID
Data 0
Data 1
Data 2
Data 3
16-Bit
16-bit
ECC
515 Figure 38 shows the Long Packet structure for the C-PHY physical layer option; it shall consist of four
516 elements: a Packet Header (PH), an application specific Data Payload with a variable number of 8-bit data
517 words, a 16-bit Packet Footer (PF), and zero or more Filler bytes (FILLER). The Packet Header is 6N x 16-
518 bits long, where N is the number of C-PHY physical layer Lanes. As shown in Figure 38, the Packet Header
519 consists of two identical 6N-byte halves, where each half consists of N sequential copies of each of the
520 following fields: a 16-bit field containing eight Reserved bits plus the 8-bit Data Identifier (DI); the 16-bit
521 Packet Data Word Count (WC); and a 16-bit Packet Header checksum (PH-CRC) which is computed over
522 the previous four bytes. The value of each Reserved bit shall be zero. The Packet Footer consists of a 16-bit
523 checksum (CRC) computed over the Packet Data using the same CRC polynomial as the Packet Header
524 CRC and the Packet Footer used in the D-PHY physical layer option. Packet Filler bytes are inserted after
525 the Packet Footer, if needed, to ensure that the Packet Footer ends on a 16-bit word boundary and that each
526 C-PHY physical layer Lane transports the same number of 16-bit words (i.e. byte pairs).
PH Checksum
PD Checksum
PH Checksum
Word Count
Word Count
Data WC-4
Data WC-3
Data WC-2
Data WC-1
(l.s. byte first)
Filler FC-1
Reserved
Reserved
Data ID
Data ID
Filler 0
Data 0
Data 1
Data 2
Data 3
16-Bit
16-Bit
16-Bit
16-Bit
16-Bit
N Copies N Copies N Copies N Copies N Copies N Copies PACKET DATA: 16-bit FILLER:
Length = Word Count (WC) * Data Word PACKET FC 8-bit bytes added to
PACKET HEADER (PH): 6N x 16-bits Width (8-bits). There are NO restrictions FOOTER ensure that all Lanes
(N = Physical Layer Lane Count) on the values of the data words (PF) transport the same number of
527 16-bit words; FC may be 0.
528 As shown in Figure 39, the Packet Header structure depicted in Figure 38 effectively results in the C-PHY
529 Lane Distributor broadcasting the same six 16-bit words to each of N Lanes. Furthermore, the six words per
530 Lane are split into two identical three-word groups which are separated by a mandatory C-PHY Sync Word
531 as described in [MIPI02]. The Sync Word is inserted by the C-PHY physical layer in response to a CSI-2
532 protocol transmitter PPI command.
Word Count Word Count Checksum Checksum Word Count Word Count Checksum Checksum
LANE 1: Data ID Reserved
(MS Byte) (LS Byte) (MS Byte) (LS Byte)
Data ID Reserved
(MS Byte) (LS Byte) (MS Byte) (LS Byte)
ms bit ls bit ms bit ls bit
● ●
C-PHY physical layer inserts a 7-symbol Sync Word
To Lane 1 C-PHY TX
● here on each Lane in response to a CSI-2 PPI command ● To Lane 1 C-PHY TX
● ●
Word Count Word Count Checksum Checksum Word Count Word Count Checksum Checksum
LANE N: Data ID Reserved
(MS Byte) (LS Byte) (MS Byte) (LS Byte)
Data ID Reserved
(MS Byte) (LS Byte) (MS Byte) (LS Byte)
ms bit ls bit ms bit ls bit
Figure 39 Packet Header Lane Distribution for C-PHY Physical Layer Option
534 For both physical layer options, the 8-bit Data Identifier field defines the Virtual Channel for the data and
535 the Data Type for the application specific payload data.
536 For both physical layer options, the 16-bit Word Count (WC) field defines the number of 8-bit data words
537 in the Data Payload between the end of the Packet Header and the start of the Packet Footer. No Packet
538 Header, Packet Footer, or Packet Filler bytes shall be included in the Word Count.
539 For the D-PHY physical layer option, the Error Correction Code (ECC) byte allows single-bit errors to be
540 corrected and 2-bit errors to be detected in the Packet Header. This includes both the Data Identifier value
541 and the Word Count value.
542 The ECC byte is not used by the C-PHY physical layer option because a single symbol error on a C-PHY
543 physical link can cause multiple bit errors in the received CSI-2 Packet Header, rendering an ECC
544 ineffective. Instead, a CSI-2 protocol transmitter for the C-PHY physical layer option computes a 16-bit
545 CRC over the four bytes composing the Reserved, Data Identifier, and Word Count Packet Header fields
546 and then transmits multiple copies of all these fields, including the CRC, to facilitate their recovery by the
547 CSI-2 protocol receiver in the event of one or more C-PHY physical link errors. The multiple Sync Words
548 inserted into the Packet Header by the C-PHY physical layer (as shown in Figure 39) also facilitate Packet
549 Header data recovery by enabling the C-PHY receiver to recover from lost symbol clocks; see [MIPI02] for
550 further information about the C-PHY Sync Word and symbol clock recovery.
551 For both physical layer options, the CSI-2 receiver reads the next WC 8-bit data words of the Data Payload
552 following the Packet Header. While reading the Data Payload the receiver shall not look for any embedded
553 sync codes. Therefore, there are no limitations on the value of an 8-bit payload data word. In the generic
554 case, the length of the Data Payload shall always be a multiple of 8-bit data words. In addition, each Data
555 Type may impose additional restrictions on the length of the Data Payload, e.g. require a multiple of four
556 bytes.
557 For both physical layer options, once the CSI-2 receiver has read the Data Payload, it then reads the 16-bit
558 checksum (CRC) in the Packet Footer and compares it against its own calculated checksum to determine if
559 any Data Payload errors have occurred.
560 Filler bytes are only inserted by the CSI-2 transmitter’s low level protocol layer in conjunction with the C-
561 PHY physical layer option. The value of any Filler byte shall be zero. If the Packet Data Word Count (WC)
562 is an odd number (i.e. LSB is “1”), the CSI-2 transmitter shall insert one Packet Filler byte after the Packet
563 Footer to ensure that the Packet Footer ends on a 16-bit word boundary. The CSI-2 transmitter shall also
564 insert additional Filler bytes, if needed, to ensure that each C-PHY Lane transports the same number of 16-
565 bit words. The latter rules require the total number of Filler bytes, FC, to be greater than or equal to (WC
566 mod 2) + {{N - (([WC + 2 + (WC mod 2)] / 2) mod N)} mod N} * 2, where N is the number of Lanes.
567 Note that it is possible for FC to be zero.
568 Figure 40 illustrates the Lane distribution of the minimal number of Filler bytes required for packets of
569 various lengths transmitted over three C-PHY Lanes. The total number of Filler bytes required per packet
570 ranges from 0 to 5, depending on the value of the Packet Data Word Count (WC). In general, the minimal
571 number of Filler bytes required per packet ranges from 0 to 2N-1 for an N-Lane C-PHY system.
572 For the D-PHY physical layer option, the CSI-2 Lane Distributor function shall pass each byte to the
573 physical layer which then serially transmits it least significant bit first.
574 For the C-PHY physical layer option, the Lane Distributor function shall group each pair of consecutive
575 bytes 2n and 2n+1 (for n ≥ 0) received from the Low Level Protocol into a 16-bit word (whose least
576 significant byte is byte 2n) and then pass this word to a physical layer Lane module. The C-PHY Lane
577 module maps each 16-bit word into a 7-symbol word which it then serially transmits least significant
578 symbol first.
579 For both physical layer options, payload data may be presented to the Lane Distributor function in any byte
580 order restricted only by data format requirements. Multi-byte protocol elements such as Word Count,
581 Checksum and the Short packet 16-bit Data Field shall be presented to the Lane Distributor function least
582 significant byte first.
583 After the EoT sequence the receiver begins looking for the next SoT sequence.
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n-3 Byte 6n-4 Filler Filler EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 Byte 6n-1 Byte 6n-2 Filler Filler EoT
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n-3 Byte 6n-4 Filler PF (MSB) EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 Byte 6n-1 Byte 6n-2 Filler Filler EoT
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n-3 Byte 6n-4 PF (MSB) PF (LSB) EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 Byte 6n-1 Byte 6n-2 Filler Filler EoT
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n-3 Byte 6n-4 PF (LSB) Byte 6n+2 EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 Byte 6n-1 Byte 6n-2 Filler PF (MSB) EoT
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n-3 Byte 6n-4 Byte 6n+3 Byte 6n+2 EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 Byte 6n-1 Byte 6n-2 PF (MSB) PF (LSB) EoT
Lane 2 SoT PH SYN PH Byte 3 Byte 2 Byte 6n+3 Byte 6n+2 Filler Filler EoT
Lane 3 SoT PH SYN PH Byte 5 Byte 4 PF (LSB) Byte 6n+4 Filler Filler EoT
KEY:
SoT – Start of Transmission EoT – End of Transmission PF – Packet Footer
584 SYN – 7-Symbol Sync Word PH – Packet Header (6 Bytes) (2 Bytes)
Figure 40 Minimal Filler Byte Insertion Requirements for Three Lane C-PHY
16-Bit
ECC
LPS SoT EoT LPS
Short Packet
Checksum*
Checksum*
Data Field*
Data Field*
(PH-CRC)
(PH-CRC)
Reserved
Reserved
Data ID
Data ID
16-Bit
16-Bit
16-Bit
16-Bit
Channel 0
Logical Channel Control
Data In Channel 1
Channel
Detect
Channel 2
Channel 3
616
Figure 44 Logical Channel Block Diagram (Receiver)
617 Figure 45 illustrates an example of data streams utilizing virtual channel support.
SoT PH RGB 6:6:6 PF EoT LPS SoT PH YUV 4:2:2 PF EoT LPS SoT PH RGB 6:6:6 PF EoT
SoT PH RGB 5:6:5 PF EoT LPS SoT PH JPEG8 PF EoT LPS SoT PH RGB 5:6:5 PF EoT
SoT PH RGB 6:6:6 PF EoT LPS SoT PH MPEG4 PF EoT LPS SoT PH RGB 6:6:6 PF EoT
KEY:
LPS – Low Power State PH – Packet Header
SoT – Start of Transmission PF – Packet Footer + Filler (if applicable)
618 EoT – End of Transmission
Figure 45 Interleaved Video Data Streams Examples
628 9.5 Packet Header Error Correction Code for D-PHY Physical Layer
629 Option
630 The correct interpretation of the data identifier and word count values is vital to the packet structure. The
631 Packet Header Error Correction Code (ECC) byte allows single-bit errors in the data identifier and the word
632 count to be corrected and two-bit errors to be detected for the D-PHY physical layer option; the ECC is not
633 available for the C-PHY physical layer option.. The 24-bit subset of the code described in Section 9.5.2
634 shall be used. Therefore, bits 7 and 6 of the ECC byte shall be zero. The error state based on ECC decoding
635 shall be available at the Application layer in the receiver.
636 The Data Identifier field DI[7:0] shall map to D[7:0] of the ECC input, the Word Count LS Byte (WC[7:0])
637 to D[15:8] and the Word Count MS Byte (WC[15:8]) to D[23:16]. This mapping is shown in Figure 46,
638 which also serves as an ECC calculation example.
32-bit
PACKET HEADER
(PH)
Word Count
Data ID
Data 0
ECC
(WC)
LPS SoT
1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0
D D P0 P1 P2 P3 P4 P5
0 2
3
639
Figure 46 24-bit ECC Generation Example
643 d + p + 1 ≤ 2p, where d is the number of data bits and p is the number of parity bits.
644 The result of appending the computed parity bits to the data bits is called the Hamming code word. The size
645 of the code word c is obviously d + p, and a Hamming code word is described by the ordered set (c, d). A
646 Hamming code word is generated by multiplying the data bits by a generator matrix G. The resulting
647 product is the code-word vector (c1, c2, c3 … cn), consisting of the original data bits and the calculated
648 parity bits. The generator matrix G used in constructing Hamming codes consists of I (the identity matrix)
649 and a parity generation matrix A:
650 G=[I|A]
651 The packet header plus the ECC code can be obtained as: PH = p*G where p represents the header (24 or
652 64 bits) and G is the corresponding generator matrix.
653 Validating the received code word r, involves multiplying it by a parity check to form s, the syndrome or
654 parity check vector: s = H*PH where PH is the received packet header and H is the parity check matrix:
655 H = [AT | I]
656 If all elements of s are zero, the code word was received correctly. If s contains non-zero elements, then at
657 least one error is present. If a single bit error is encountered then the syndrome s is one of the elements of H
658 which will point to the bit in error. Further, in this case, if the bit in error is one of the parity bits, then the
659 syndrome will be one of the elements on I, else it will be the data bit identified by the position of the
660 syndrome in AT.
669 Each cell in the matrix represents a syndrome and the first twenty-four cells (the orange rows) are using the
670 first three or five bits to build the syndrome. Each syndrome in the matrix is MSB left aligned:
672 The top row defines the three LSB of data position bit, and the left column defines the three MSB of data
673 position bit (there are 64-bit positions in total).
674 e.g. 37th bit position is encoded 0b100_101 and has the syndrome 0x68.
675 To derive the parity P0 for 24-bits, the P0’s in the orange rows will define if the corresponding bit position
676 is used in P0 parity or not.
678 Similar, to derive the parity P0 for 64-bits, all P0’s in Table 5 will define the corresponding bit positions to
679 be used.
680 To correct a single-bit error, the syndrome has to be one of the syndromes Table 4, which will identify the
681 bit position in error. The syndrome is calculated as:
682 S = PSEND^PRECEIVED where PSEND is the 8/6-bit ECC field in the header and PRECEIVED is the
683 calculated parity of the received header.
684 Table 5 represents the same information as the matrix in Table 4, organized such that will give a better
685 insight on the way parity bits are formed out of data bits. The orange area of the table has to be used to
686 form the ECC to protect a 24-bit header, whereas the whole table has to be used to protect a 64-bit header.
Bit P7 P6 P5 P4 P3 P2 P1 P0 Hex
28 0 1 0 0 1 0 1 0 0x4A
29 0 1 0 0 1 1 0 0 0x4C
30 0 1 0 1 0 0 0 1 0x51
31 0 1 0 1 0 0 1 0 0x52
32 0 1 0 1 0 1 0 0 0x54
33 0 1 0 1 1 0 0 0 0x58
34 0 1 1 0 0 0 0 1 0x61
35 0 1 1 0 0 0 1 0 0x62
36 0 1 1 0 0 1 0 0 0x64
37 0 1 1 0 1 0 0 0 0x68
38 0 1 1 1 0 0 0 0 0x70
39 1 0 0 0 0 0 1 1 0x83
40 1 0 0 0 0 1 0 1 0x85
41 1 0 0 0 0 1 1 0 0x86
42 1 0 0 0 1 0 0 1 0x89
43 1 0 0 0 1 0 1 0 0x8A
44 0 0 1 1 1 1 0 1 0x3D
45 0 0 1 1 1 1 1 0 0x3E
46 0 1 0 0 1 1 1 1 0x4F
47 0 1 0 1 0 1 1 1 0x57
48 1 0 0 0 1 1 0 0 0x8C
49 1 0 0 1 0 0 0 1 0x91
50 1 0 0 1 0 0 1 0 0x92
51 1 0 0 1 0 1 0 0 0x94
52 1 0 0 1 1 0 0 0 0x98
53 1 0 1 0 0 0 0 1 0xA1
54 1 0 1 0 0 0 1 0 0xA2
55 1 0 1 0 0 1 0 0 0xA4
56 1 0 1 0 1 0 0 0 0xA8
57 1 0 1 1 0 0 0 0 0xB0
58 1 1 0 0 0 0 0 1 0xC1
59 1 1 0 0 0 0 1 0 0xC2
60 1 1 0 0 0 1 0 0 0xC4
61 1 1 0 0 1 0 0 0 0xC8
62 1 1 0 1 0 0 0 0 0xD0
63 1 1 1 0 0 0 0 0 0xE0
688
P 7 6 5 4 3 2 1 0
Parity Generator
692
Figure 47 64-bit ECC Generation on TX Side
P 2 1 0
Parity
Generator
694
Figure 48 24-bit ECC Generation on TX Side
695 The parity generators are based on Table 5.
Combinational
Received ECC Logic Block
Rec’d No error
ECC
Syndrome Corrected Error
XOR SYN
Byte Interface In Decoder
to ECC block Error
Parity Calc’d
Generator ECC
Corrected Data
ECC
8 XOR 8
7 XOR 7
Received Packet
6 XOR 6
Header
5 XOR 5
4 XOR 4
3 XOR 3
2 XOR 2
1 XOR 1
Byte Interface
out from ECC
701 Block
Combinational
Received ECC Logic Block
Rec’d No error
ECC
Syndrome Corrected Error
XOR SYN
Byte Interface In Decoder
to ECC block Error
Parity Calc’d
Generator ECC
Corrected Data
ECC
Received Packet
3 XOR 3
Header
2 XOR 2
1 XOR 1
Byte Interface
out from ECC
713 Block
16-bit Checksum
724 When computed over the Packet Data words of a Long Packet, the 16-bit checksum sequence is transmitted
725 as part of the Packet Footer. When the Word Count is zero, the CRC shall be 0xFFFF. When computed over
726 the Reserved, Data Identifier, and Word Count fields of a Packet Header for the C-PHY physical layer
727 option, the 16-bit checksum sequence is transmitted as part of the Packet Header CRC (PH-CRC) field.
729 The definition of a serial CRC implementation is presented in Figure 53. The CRC implementation shall be
730 functionally equivalent with the C code presented in Figure 54. The CRC shift register is initialized to
731 0xFFFF at the beginning of each packet. Note that for the C-PHY physical layer option, if the same
732 circuitry is used to compute both the Packet Header and Packet Footer CRC, the CRC shift register shall be
733 initialized twice per packet, i.e. once at the beginning of the packet and then again following the
734 computation of the Packet Header CRC. After all payload data has passed through the CRC circuitry, the
735 CRC circuitry contains the checksum. The 16-bit checksum produced by the C code in Figure 54 equals the
736 final contents of the C[15:0] shift register shown in Figure 53. The checksum is then transmitted by the
737 CSI-2 physical layer to the CSI-2 receiver to verify that no errors have occurred in the transmission.
740 Beginning with index 0, the contents of the input data array in Figure 54 are given by WC 8-bit payload
741 data words for packet data CRC computations and by the four 8-bit Reserved, Data Identifier, WC (LS
742 byte), and WC (MS byte) fields for packet header CRC computations.
743
744 CRC computation examples:
745 Input Data Bytes:
746 FF 00 00 02 B9 DC F3 72 BB D4 B8 5A C8 75 C2 7C 81 F8 05 DF FF 00 00 01
747 Checksum LS byte and MS byte:
748 F0 00
749
750 Input Data Bytes:
751 FF 00 00 00 1E F0 1E C7 4F 82 78 C5 82 E0 8C 70 D2 3C 78 E9 FF 00 00 01
752 Checksum LS byte and MS byte:
753 69 E5
KEY:
LPS – Low Power State PH – Packet Header
ST – Start of Transmission PF – Packet Footer + Filler (if applicable)
759 ET – End of Transmission SP – Short Packet
Figure 55 Packet Spacing
800 The intention of the Generic Short Packet Data Types is to provide a mechanism for including timing
801 information for the opening/closing of shutters, triggering of flashes, etc. within the data stream. The intent
802 of the 16-bit User defined data field in the generic short packets is to pass a data type value and a 16-bit
803 data value from the transmitter to application layer in the receiver. The CSI-2 receiver shall pass the data
804 type value and the associated 16-bit data value to the application layer.
810 Note that the VVALID, HVALID and DVALID signals in the figures in this section are only concepts to
811 help illustrate the behavior of the frame start/end and line start/end packets. The VVALID, HVALID and
812 DVALID signals do not form part of the Specification.
SoT FS EoT LPS SoT PH Data PF EoT SoT PH Data PF EoT LPS SoT FE EoT
VVALID
HVALID
DVALID
KEY:
SoT – Start of Transmission EoT – End of Transmission LPS – Low Power State
PH – Packet Header PF – Packet Footer + Filler (if applicable)
FS – Frame Start FE – Frame End
813 LS – Line Start LE – Line End
VVALID
HVALID
DVALID
KEY:
SoT – Start of Transmission EoT – End of Transmission LPS – Low Power State
PH – Packet Header PF – Packet Footer + Filler (if applicable)
FS – Frame Start FE – Frame End
814 LS – Line Start LE – Line End
1 Line 1 Line
SoT PH Data PF EoT LPS SoT PH Data PF EoT LPS SoT PH Data PF EoT
SoT PH Data PF EoT LPS SoT FE EoT LPS SoT FS EoT LPS SoT PH Data PF EoT
KEY:
SoT – Start of Transmission EoT – End of Transmission LPS – Low Power State
PH – Packet Header PF – Packet Footer + Filler (if applicable)
FS – Frame Start FE – Frame End
815 LS – Line Start LE – Line End
Figure 58 Line and Frame Blanking Definitions
816 The period between the end of the Packet Footer (or the Packet Filler, if present) of one long packet and the
817 Packet Header of the next long packet is called the Line Blanking Period.
818 The period between the Frame End packet in frame N and the Frame Start packet in frame N+1 is called the
819 Frame Blanking Period (Figure 58).
820 The Line Blanking Period is not fixed and may vary in length. The receiver should be able to cope with a
821 near zero Line Blanking Period as defined by the minimum inter-packet spacing defined in [MIPI01] or
822 [MIPI02], as appropriate. The transmitter defines the minimum time for the Frame Blanking Period. The
823 Frame Blanking Period duration should be programmable in the transmitter.
824 Frame Start and Frame End packets shall be used.
825 Recommendations (informative) for frame start and end packet spacing:
826 • The Frame Start packet to first data packet spacing should be as close as possible to the minimum
827 packet spacing
828 • The last data packet to Frame End packet spacing should be as close as possible to the minimum
829 packet spacing
830 The intention is to ensure that the Frame Start and Frame End packets accurately denote the start and end of
831 a frame of image data. A valid exception is when the positions of the Frame Start and Frame End packets
832 are being used to convey pixel level accurate vertical synchronization timing information.
833 The positions of the Frame Start and Frame End packets can be varied within the Frame Blanking Period in
834 order to provide pixel level accurate vertical synchronization timing information. See Figure 59.
835 Line Start and Line End packets shall be used for pixel level accurate horizontal synchronization timing
836 information.
837 The positions of the Line Start and Line End packets, if present, can be varied within the Line Blanking
838 Period in order to provide pixel accurate horizontal synchronization timing information. See Figure 60.
VIDEO
DATA
Black Level
Blanking Level
Sync Level
DVALID
VVALID
SoT FE EoT LPS SoT FS EoT LPS SoT PH Data PF EoT LPS SoT PH Data PF EoT
Frame End Frame Start Valid Video Data Valid Video Data
839 Packet Packet
VIDEO
DATA
Black Level
Blanking Level
Sync Level
DVALID
HVALID
PF EoT LPS SoT LE EoT LPS SoT LS EoT LPS SoT PH Data PF EoT LPS SoT LE EoT
853 required by the RAW10 transmission format as described in Section 11.4.4. The values of such padding
854 pixels are not specified.
Frame Blanking
Packet Header, PH
Packet Footer, PF
FE
Frame Blanking
FE
Frame Blanking
Blanking Lines
FS
Frame 1
Line Blanking (Odd, Frame Number = 1)
YUV422 Image Data
Packet Header, PH
Packet Footer, PF
FE
Blanking Lines
FS
Frame 2
Line Blanking (Even, Frame Number = 2)
YUV422 Image Data
FE
Blanking Lines
Blanking Lines
FS
Line Blanking
Frame 1
(Odd, Frame Number = 1)
YUV422 Image Data
Packet Header, PH
Packet Footer, PF
FE
Line Start, LS
Line End, LE
Blanking Lines
FS
Line Blanking
Frame 2
(Even, Frame Number = 2)
YUV422 Image Data
FE
Blanking Lines
876 • For defined image data types – any non-reserved codes in the range 0x18 to 0x3F – only the single
877 corresponding MIPI-defined packet payload data format shall be considered correct
878 • Reserved image data types – any reserved codes in the range 0x18 to 0x3F – shall not be used. No
879 packet payload data format shall be considered correct for reserved image data types
880 • For generic long packet data types (codes 0x10 thru 0x17) and user-defined, byte-based (codes
881 0x30 – 0x37), any packet payload data format shall be considered correct
882 • Generic long packet data types (codes 0x10 thru 0x17) and user-defined, byte-based (codes 0x30 –
883 0x37), should not be used with packet payloads that meet any MIPI image data format definition
884 • Synchronization short packet data types (codes 0x00 thru 0x07) shall consist of only the header
885 and shall not include payload data bytes
886 • Generic short packet data types (codes 0x08 thru 0x0F) shall consist of only the header and shall
887 not include payload data bytes
888 Data formats are defined further in Section 11.
Frame Start Packet Embedded Data Embedded Data Data Type 1 Image Data
SoT FS EoT LPS SoT PH Embed Data PF EoT LPS SoT PH Embed Data PF EoT LPS SoT PH Data Type 1 PF EoT
Data Type 1 Image Data Data Type 2 Image Data Data Type 1 Image Data
LPS SoT PH Data Type 1 PF EoT LPS SoT PH Data Type 2 PF EoT LPS SoT PH Data Type 1 PF EoT
Data Type 2 Image Data Data Type 1 Image Data Frame End Packet
LPS SoT PH Data Type 2 PF EoT LPS SoT PH Data Type 1 PF EoT LPS SoT FE EoT
KEY:
LPS – Low Power State FS – Frame Start Packet PH – Packet Header
SoT – Start of Transmission FE – Frame End Packet PF – Packet Footer + Filler (if applicable)
889 EoT – End of Transmission
890 All of the packets within the same virtual channel, independent of the Data Type value, share the same
891 frame start/end and line start/end synchronization information. By definition, all of the packets,
892 independent of data type, between a Frame Start and a Frame End packet within the same virtual channel
893 belong to the same frame.
894 Packets of different data types may be interleaved at either the packet level as illustrated in Figure 65 or the
895 frame level as illustrated in Figure 66. Data formats are defined in Section 11.
Frame Blanking
Line
Blanking
Frame Blanking
Line
D1 Data Type 1 Image Data PF
Blanking
Frame Blanking
Line
D2 Data Type 2 Image Data PF
Blanking
Frame Blanking
901 Each virtual channel has its own Frame Start and Frame End packet. Therefore, it is possible for different
902 virtual channels to have different frame rates, though the data rate for both channels would remain the
903 same.
904 In addition, Data Type value Interleaving can be used for each virtual channel, allowing different data types
905 within a virtual channel and a second level of data interleaving.
906 Therefore, receivers should be able to de-multiplex different data packets based on the combination of the
907 Virtual Channel Identifier and the Data Type value. For example, data packets containing the same Data
908 Type value but transmitted on different virtual channels are considered to belong to different frames
909 (streams) of image data.
Frame Start Packet Embedded Data Frame Start Packet Embedded Data
Virtual Channel 0 Virtual Channel 0 Virtual Channel 1 Virtual Channel 1
SoT FS EoT LPS SoT PH Embedded Data PF EoT LPS SoT FS EoT LPS SoT PH Embedded Data PF EoT
Data Type 1 Image Data Data Type 2 Image Data Data Type 1 Image Data
Virtual Channel 0 Virtual Channel 1 Virtual Channel 0
LPS SoT PH Data Type 1 PF EoT LPS SoT PH Data Type 2 PF EoT LPS SoT PH Data Type 1 PF EoT
Data Type 2 Image Data Frame End Packet Data Type 1 Image Data Frame End Packet
Virtual Channel 1 Virtual Channel 1 Virtual Channel 0 Virtual Channel 0
LPS SoT PH Data Type 2 PF EoT LPS SoT FE EoT LPS SoT PH Data Type 1 PF EoT LPS SoT FE EoT
KEY:
LPS – Low Power State FS – Frame Start Packet PH – Packet Header
SoT – Start of Transmission FE – Frame End Packet PF – Packet Footer + Filler (if applicable)
910 EoT – End of Transmission
942 not meant to imply that the bytes themselves are bit-reversed by the Pixel to Byte Packing Formats layer
943 prior to output.
944 For the D-PHY physical layer option, each byte in the sequence is serially transmitted LSB-first, whereas
945 for the C-PHY physical layer option, successive byte pairs in the sequence are encoded and then serially
946 transmitted LSS-first. Figure 68 illustrates these options for a single-Lane system.
D-PHY Physical Layer Byte n* Byte n+1 Byte n+2 Byte n+3
serializes each byte
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
and transmits it least
significant bit first
C-PHY Physical Layer B0 C-PHY 16 bit to 7 Symbol Mapper B15 B0 C-PHY 16 bit to 7 Symbol Mapper B15
Mapper composes 7
(B0 = Input LSB, S0 = Output LSS) (B0 = Input LSB, S0 = Output LSS)
symbols from 16-bit
word and transmits S0 S1 S2 S3 S4 S5 S6 S0 S1 S2 S3 S4 S5 S6
least significant symbol * For the C-PHY physical layer option, n = 2k, for k = 0, 1, 2, ...
947 first
CS (Checksum)
Frame of Arbitrary Pixel and/or Line
User-Defined Byte-Based Data Blanking
Frame Blanking
964
Figure 69 Frame Structure with Embedded Data at the Beginning and End of the Frame
979 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel to byte mapping is illustrated
980 in Figure 71.
Line Start: Packet Header U1[7:0] Y1[7:0] Y2[7:0] U3[7:0] Y3[7:0] Y4[7:0]
(Odd line)
Line End:
U637[7:0] Y637[7:0] Y638[7:0] U639[7:0] Y639[7:0] Y640[7:0] Packet Footer
(Odd Line)
Line Start:
Packet Header V1[7:0] Y1[7:0] Y2[7:0] V3[7:0] Y3[7:0] Y4[7:0]
(Even Line)
Line End:
V637[7:0] Y637[7:0] Y638[7:0] V639[7:0] Y639[7:0] Y640[7:0] Packet Footer
981 (Even Line)
Figure 70 Legacy YUV420 8-bit Transmission
B7 B0 B7 B0 B7 B0 B7 B0
Pixel Data V1[7:0] Y1[7:0] Y2[7:0] V3[7:0]
B7 B0 B7 B0 B7 B0 B7 B0
Byte Data V1[7:0] Y1[7:0] Y2[7:0] V3[7:0]
B7 B0 B7 B0 B7 B0
V1[7:0] Y1[7:0] Y2[7:0]
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
982
Figure 71 Legacy YUV420 8-bit Pixel to Byte Packing Bitwise Illustration
Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8
Line 1
Line 2
Line 3
Line 4
Line 5
FS U Y Y U Y Y …. U Y Y
V Y Y V Y Y …. V Y Y
U Y Y U Y Y …. U Y Y
Packet Header, PH
Packet Footer, PF
V Y Y V Y Y …. V Y Y
U Y Y U Y Y …. U Y Y
V Y Y V Y Y …. V Y Y
U Y Y U Y Y …. U Y Y
V Y Y V Y Y …. V Y Y
U Y Y U Y Y …. U Y Y
V Y Y V Y Y …. V Y Y
U Y Y U Y Y …. U Y Y
V Y Y V Y Y …. V Y Y FE
986
Figure 73 Legacy YUV420 8-bit Frame Format
998 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel to byte mapping is illustrated
999 in Figure 75.
Odd lines:
Y1[7:0] (A) Y2[7:0] (B) Y3[7:0] (C) Y4[7:0] (D)
Data A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
Even lines:
U1[7:0] (A) Y1[7:0] (B) V1[7:0] (C) Y2[7:0] (D)
Data A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
1001
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8
Line 1
Line 2
Line 3
Line 4
Line 5
Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8
Line 1
Line 2
Line 3
Line 4
Line 5
FS Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Packet Header, PH
Packet Header, PH
Packet Footer, PF
Packet Footer, PF
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y
Y Y Y Y …. Y U Y V Y U Y V Y …. V Y FE
1020 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel-to-byte mapping is illustrated
1021 in Figure 80.
LSB’s
LSB’s
LSB’s
Line End:
(Even Line) Y638 V637 Y637 U637 Y640 V639 Y639 U639 Packet
[1:0] [1:0] [1:0] [1:0] U639[9:2] Y639[9:2] V639[9:2] Y640[9:2] [1:0] [1:0] [1:0] [1:0] Footer
Odd lines: Y1 Y2 Y3 Y4
Y1[9:2] (A) Y2[9:2] (B) Y3[9:2] (C) Y4[9:2] (D) [1:0] [1:0] [1:0] [1:0]
Data A2 A3 A4 A5 A6 A7 A8 A9 B2 B3 B4 B5 B6 B7 B8 B9 C2 C3 C4 C5 C6 C7 C8 C9 D2 D3 D4 D5 D6 D7 D8 D9 A0 A1 B0 B1 C0 C1 D0 D1
Even lines: U1 Y1 V1 Y2
U1[9:2] (A) Y1[9:2] (B) V1[9:2] (C) Y2[9:2] (D) [1:0] [1:0] [1:0] [1:0]
Data A2 A3 A4 A5 A6 A7 A8 A9 B2 B3 B4 B5 B6 B7 B8 B9 C2 C3 C4 C5 C6 C7 C8 C9 D2 D3 D4 D5 D6 D7 D8 D9 A0 A1 B0 B1 C0 C1 D0 D1
1023 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1024 The pixel spatial sampling options are the same as for the YUV420 8-bit data format.
Packet Header, PH
Packet Footer, PF
Packet Footer, PF
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB
Y Y Y Y LSB …. Y LSB U Y V Y LSB U Y V Y LSB …. V Y LSB FE
1032 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel to byte mapping is illustrated
1033 in Figure 83.
B7 B0 B7 B0 B7 B0 B7 B0
Pixel Data U1[7:0] Y1[7:0] V1[7:0] Y2[7:0]
B7 B0 B7 B0 B7 B0 B7 B0
Byte Data U1[7:0] Y1[7:0] V1[7:0] Y2[7:0]
B7 B0 B7 B0 B7 B0
U1[7:0] Y1[7:0] V1[7:0]
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1035
Figure 83 YUV422 8-bit Pixel to Byte Packing Bitwise Illustration
Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8
Line 1
Line 2
Line 3
Line 4
Line 5
1037 The pixel spatial alignment is the same as in CCIR-656 standard. The frame format for YUV422 is
1038 presented in Figure 85.
FS U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
Packet Header, PH
Packet Footer, PF
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y
U Y V Y U …. Y U Y V Y FE
1039
Figure 85 YUV422 8-bit Frame Format
1046 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel to byte mapping is illustrated
1047 in Figure 87.
Pixel Data:
B9 B0 B9 B0 B9 B0 B9 B0
U1[9:0] Y1[9:0] V1[9:0] Y2[9:0]
LSB’s
B7 B0 B7 B0 B7 B6 B5 B4 B3 B2 B1 B0
V1[9:2] Y2[9:2] Y2[1:0] V1[1:0] Y1[1:0] U1[1:0]
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1049
Figure 87 YUV422 10-bit Pixel to Byte Packing Bitwise Illustration
1050 The pixel spatial alignment is the same as in the YUV422 8-bit data case. The frame format for YUV422 is
1051 presented in the Figure 88.
FS U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
Packer Header, PH
Packer Footer, PF
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs
U Y V Y LSBs U …. U Y V Y LSBs FE
1052
Figure 88 YUV422 10-bit Frame Format
1062 Bit order in transmission follows the general CSI-2 rule, LSB first. The pixel to byte mapping is illustrated
1063 in Figure 90.
Line Start Packet Header B1[7:0] G1[7:0] R1[7:0] B2[7:0] G2[7:0] R2[7:0]
Line End B639[7:0] G639[7:0] R639[7:0] B640[7:0] G640[7:0] R640[7:0] Packet Footer
1064
Figure 89 RGB888 Transmission
B7 B0 B7 B0 B7 B0
B1[7:0] G1[7:0] R1[7:0]
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1065
Figure 90 RGB888 Transmission in CSI-2 Bus Bitwise Illustration
24-bit
FS B G R B G R …. B G R
B G R B G R …. B G R
B G R B G R …. B G R
Packet Header, PH
Packet Footer, PF
B G R B G R …. B G R
B G R B G R …. B G R
…. …. …. …. …. …. …. …. …. ….
…. …. …. …. …. …. …. …. …. ….
B G R B G R …. B G R
B G R B G R …. B G R
B G R B G R …. B G R
B G R B G R …. B G R
B G R B G R …. B G R FE
1066
Figure 91 RGB888 Frame Format
1073 Bit order in transmission follows the general CSI-2 rule, LSB first. In RGB666 case the length of one data
1074 word is 18-bits, not eight bits. The word-wise flip is done for 18-bit BGR words; i.e. instead of flipping
1075 each byte (8-bits), each 18-bits pixel value is flipped. This is illustrated in Figure 93.
1077
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 ...
Figure 93 RGB666 Transmission on CSI-2 Bus Bitwise Illustration
8b 8b 8b 8b 8b 8b 8b 8b 8b
Packer Footer, PF
BGR BGR BGR BGR …. BGR BGR
BGR BGR BGR BGR …. BGR BGR
…. …. …. …. …. …. ….
…. …. …. …. …. …. ….
BGR BGR BGR BGR …. BGR BGR
BGR BGR BGR BGR …. BGR BGR
BGR BGR BGR BGR …. BGR BGR
BGR BGR BGR BGR …. BGR BGR
BGR BGR BGR BGR …. BGR BGR FE
1078 18-bit
1085 Bit order in transmission follows the general CSI-2 rule, LSB first. In RGB565 case the length of one data
1086 word is 16-bits, not eight bits. The word-wise flip is done for 16-bit BGR words; i.e. instead of flipping
1087 each byte (8-bits), each two bytes (16-bits) are flipped. This is illustrated in Figure 96.
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1089
Figure 96 RGB565 Transmission on CSI-2 Bus Bitwise Illustration
16-bit
Packer Footer, PF
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1099
Figure 98 RGB555 Transmission on CSI-2 Bus Bitwise Illustration
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
1108
Figure 99 RGB444 Transmission on CSI-2 Bus Bitwise Illustration
1124 Each 6-bit pixel is sent LSB first. This is an exception to general CSI-2 rule byte wise LSB first.
Packet
Line Start P1[5:0] P2[5:0] P3[5:0] P4[5:0] P5[5:0] P6[5:0] P7[5:0]
Header
Packet
Line End P634[5:0] P635[5:0] P636[5:0] P637[5:0] P638[5:0] P639[5:0] P640[5:0]
1125 Footer
Data A0 A1 A2 A3 A4 A5 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 D0 D1 D2 D3 D4 D5
Packer Footer, PF
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640 FE
1134 Each 7-bit pixel is sent LSB first. This is an exception to general CSI-2 rule byte-wise LSB first.
Packet
Line Start P1[6:0] P2[6:0] P3[6:0] P4[6:0] P5[6:0] P6[6:0] P7[6:0]
Header
Packet
Line End P634[6:0] P635[6:0] P636[6:0] P637[6:0] P638[6:0] P639[6:0] P640[6:0]
1135 Footer
Data A0 A1 A2 A3 A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 C0 C1 C2 C3 C4 C5 C6 D0 D1 D2 D3 D4 D5 D6
1136
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 ...
Figure 104 RAW7 Data Transmission on CSI-2 Bus Bitwise Illustration
Packer Footer, PF
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640
P1 P2 P3 P4 P5 P6 P7 P8 …. P638 P639 P640 FE
Packet
Line Start P1[7:0] P2[7:0] P3[7:0] P4[7:0] P5[7:0] P6[7:0] P7[7:0]
Header
Packet
Line End P634[7:0] P635[7:0] P636[7:0] P637[7:0] P638[7:0] P639[7:0] P640[7:0]
1145 Footer
Data A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
1146
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Packer Footer, PF
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
FE
1147
P1 P2 P3 P4 P5 …. P637 P638 P639 P640
LSB’s
Packet P4 P3 P2 P1
Line Start P1[9:2] P2[9:2] P3[9:2] P4[9:2] [1:0] [1:0] [1:0] [1:0] P5[9:2] P6[9:2]
Header
Data A2 A3 A4 A5 A6 A7 A8 A9 B2 B3 B4 B5 B6 B7 B8 B9 C2 C3 C4 C5 C6 C7 C8 C9 D2 D3 D4 D5 D6 D7 D8 D9
P1 P2 P3 P4
[1:0] [1:0] [1:0] [1:0] P5[9:2] (E) P6[9:2] (F) P7[9:2] (G)
A0 A1 B0 B1 C0 C1 D0 D1 E2 E3 E4 E5 E6 E7 E8 E9 F2 F3 F4 F5 F6 F7 F8 F9 G2 G3 G4 G5 G6 G7 G8 G9
1156 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Packer Footer, PF
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
FE
1157
P1 P2 P3 P4 LSBs P5 …. P637 P638 P639 P640 LSBs
LSB’s LSB’s
Packet P2 P1 P4 P3
Line Start P1[11:4] P2[11:4] P3[11:4] P4[11:4] P5[11:4]
Header [3:0] [3:0] [3:0] [3:0]
P1[11:4] (A) P2[11:4] (B) P1[3:0] (A) P2[3:0 (B)] P3[11:4] (C)
1166
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Packer Footer, PF
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
FE
1167
P1 P2 LSBs P3 P4 LSBs …. P638 LSBs P639 P640 LSBs
LSB’s
Packet P1 P2 P3 P4
Line Start P1[13:6] P2[13:6] P3[13:6] P4[13:6]
Header [5:0] [5:0] [5:0] [5:0]
1177 LSB’s
Figure 115 RAW14 Transmission
Data A6 A7 A8 A9 A10 A11 A12 A13 B6 B7 B8 B9 B10 B11 B12 B13 C6 C7 C8 C9 C10 C11 C12 C13 D6 D7 D8 D9 D10 D11 D12 D13
P1[5:0] (A) P2[5:0] (B) P3[5:0] (C) P4[5:0] (D) P5[13:6] (E)
1178 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Packer Footer, PF
Packet
Line Start B1[7:0] B2[7:0] B3[7:0] B4[7:0] B5[7:0] B6[7:0] B7[7:0]
Header
Packet
Line End B121[7:0] B122[7:0] B123[7:0] B124[7:0] B125[7:0] B126[7:0] B127[7:0]
1185 Footer
Data A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
1186 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
Figure 119 User Defined 8-bit Data Transmission on CSI-2 Bus Bitwise Illustration
1187 The packet data size in bits shall be divisible by eight, i.e. a whole number of bytes shall be transmitted.
1188 For User Defined data:
1189 • The frame is transmitted as a sequence of arbitrary sized packets.
1190 • The packet size may vary from packet to packet.
1191 • The packet spacing may vary between packets.
SoT FS EoT LPS SoT PH Data PF EoT LPS SoT PH Data PF EoT LPS SoT FE EoT
VVALID
HVALID
DVALID
KEY:
SoT – Start of Transmission EoT – End of Transmission LPS – Low Power State
PH – Packet Header PF – Packet Footer
FS – Frame Start FE – Frame End
1192 LE – Line End
1193 Eight different User Defined data type codes are available as shown in Table 27.
U3 Y3 V3 Y4
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
Y3 Y4 U5 Y5
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
Buffer
Data in receiver's buffer
Addr
MSB U1 Y1 Y2 U3 LSB
00h a7 a6 a5 a4 a3 a2 a1 a0 b7 b6 b5 b4 b3 b2 b1 b0 c7 c6 c5 c4 c3 c2 c1 c0 d7 d6 d5 d4 d3 d2 d1 d0
Y3 Y4 U5 Y5
01h e7 e6 e5 e4 e3 e2 e1 e0 f7 f6 f5 f4 f3 f2 f1 f0 g7 g6 g5 g4 g3 g2 g1 g0 h7 h6 h5 h4 h3 h2 h1 h0
Y3 Y4 V5 Y5
e
e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
0
Buffer
Data in receiver's buffer
Addr
MSB V1 Y1 Y2 V3 LSB
N a7 a6 a5 a4 a3 a2 a1 a0 b7 b6 b5 b4 b3 b2 b1 b0 c7 c6 c5 c4 c3 c2 c1 c0 d7 d6 d5 d4 d3 d2 d1 d0
Y3 Y4 V5 Y5
N+1 e7 e6 e5 e4 e3 e2 e1 e0 f7 f6 f5 f4 f3 f2 f1 f0 g7 g6 g5 g4 g3 g2 g1 g0 h7 h6 h5 h4 h3 h2 h1 h0
Y5 Y6 Y7 Y8
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
U3 Y3 V3 Y4
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
P6 P7 P8 P9 P10 P11
f2 f3 f4 f5 g0 g1 g2 g3 g4 g5 h0 h1 h2 h3 h4 h5 i0 i1 i2 i3 i4 i5 j0 j1 j2 j3 j4 j5 k0 k1 k2 k3
P5 P6 P7 P8 P9 P10
e4 e5 e6 f0 f1 f2 f3 f4 f5 f6 g0 g1 g2 g3 g4 g5 g6 h0 h1 h2 h3 h4 h5 h6 i0 i1 i2 i3 i4 i5 i6 j0
P5 P6 P7 P8
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
Buffer
Data in receiver's buffer:
Addr
MSB P4[9:2] P3[9:2] P2[9:2] P1[9:2] LSB
00h d9 d8 d7 d6 d5 d4 d3 d2 c9 c8 c7 c6 c5 c4 c3 c2 b9 b8 b7 b6 b5 b4 b3 b2 a9 a8 a7 a6 a5 a4 a3 a2
JPEG encoding
Camera image according to SOSI, EOSI, SOEI and
data processing baseline JPEG EOEI marker application CSI
(color separation, DCT with JPEG8 and additional data transmitter
AWB, etc.) additional embedding
definitions
Thumbnail image
scaling and sRGB
conversion
Image status
information
1266
Figure 138 JPEG8 Data Flow in the Encoder
Additional data
Addition of EXIF
CSI extraction based on
information,
receiver SOSI, EOSI, SOEI
Storing into a file
and EOEI markers
Thumbnail image
Image status
information
1267
Figure 139 JPEG8 Data Flow in the Decoder
1270 • sRGB color space shall be used. The JPEG is generated from YCbCr format after sRGB to YCbCr
1271 conversion.
1272 • The JPEG metadata has to be EXIF compatible, i.e. metadata within application segments has to
1273 be placed in beginning of file, in the order illustrated in Figure 140.
1274 • A status line is added in the end of JPEG data as defined in Section A.3.
1275 • If needed, an embedded image is interlaced in order which is free of choice as defined in Section
1276 A.4.
1277 • Prior to storing into a file, the CSI-2 JPEG data is processed by the data separation process
1278 described in Section A.1.
Compressed Data
Compressed Data
1313 Embedded Image data is separated from compressed data by SOEI (Start Of Embedded Image) and EOEI
1314 (End Of Embedded Image) non-standard markers, which are defined in Section A.5. The amount of fields
1315 separated by SOEI and EOEI is not limited.
1316 The pixel to byte packing for image data within an EI data field should be as specified for the equivalent
1317 CSI-2 data format. However there is an additional restriction; the embedded image data must not generate
1318 any false JPEG marker sequences (0xFFXX).
1319 The suggested method of preventing false JPEG marker codes from occurring within the embedded image
1320 data it to limit the data range for the pixel values. For example
1321 • For RGB888 data the suggested way to solve the false synchronization code issue is to constrain
1322 the numerical range of R, G and B values from 1 to 254.
1323 • For RGB565 data the suggested way to solve the false synchronization code issue is to constrain
1324 the numerical range of G component from 1-62 and R component from 1-30.
1325 Each EI data field is separated by the SOEI / EOEI markers, and has to contain an equal amount bytes and
1326 a complete number of pixels. An EI data field may contain multiple lines or a full frame of image data.
1327 The embedded image data is decoded and removed apart from the JPEG compressed data prior to writing
1328 the JPEG into a file. In the process, EI data fields are appended one after each other, in order of occurrence
1329 in the received JPEG data.
SOEI
Embedded Image data
End Of Image (EOI)
EOEI
Start of Status Information (SOSI)
Compressed Data
Image Status Information
End of Status Information (EOSI)
1330
Figure 142 Example of TN Image Embedding Inside the Compressed JPEG Data Block
B5 B6 B7 B8
e0 e1 e2 e3 e4 e5 e6 e7 f0 f1 f2 f3 f4 f5 f6 f7 g0 g1 g2 g3 g4 g5 g6 g7 h0 h1 h2 h3 h4 h5 h6 h7
Coverage of this
CSI Transmitter 2 Data Lanes CSI Receiver implementation
Data2+ Data2+ example
Data2- Data2-
Data1+ Data1+
Data1- Data1-
Clock+ Clock+
Clock- Clock-
400kHz Bidirectional
CCI Slave Control Link CCI Master
SCL SCL
SDA SDA
1343
Figure 144 Implementation Example Block Diagram and Coverage
1344 For this implementation example a layered structure is described with the following parts:
1345 • D-PHY implementation details
1346 • Multi-lane merger details
1347 • Protocol layer details
1348 This implementation example refers to a RAW8 data type only; hence no packing/unpacking or byte
1349 clock/pixel clock timing will be referenced as for this type of implementation they are not needed.
1350 No error recovery mechanism or error processing details will be presented, as the intent of the document is
1351 to present an implementation from the data flow perspective.
TxDDRClkHS-Q
TxDDRClkHS-I TxDDRClkHS-Q LP-TX Cp
Clock HS-TX
TxByteClkHS CIL-MCNN
management unit TxRequestHS Cn
TxByteClk TxReadyHS
TxClkEsc D-PHY
ShutdownClk
PHY Handshake TxUlpmClk
elasticity FIFO
Clock Lane
TxByteClk
FrameValid Protocol level
control logic TxDDRClkHS-I LP-TX D2p
LineValid
HS-TX
TxByteClkHS CIL-MFEN D2n
TxByteDataHS[7:0] TxDataHS[7:0]
Fixed ID
(RAW8) ECC[7:0] TxWriteHS TxRequestHS D-PHY
ECC generator
TxReadyHS
Shutdown2
WC[15:0] TxUlpm
CSI2 packet PH[7:0] TxWrite
VC[1:0] TxClkEsc
header (PH)
TxByteData[7:0]
Data Lane 2
Cp LP-RX RxDDRClkHS
HS-RX
Cn CIL-SCNN
RxClkActiveHS
D-PHY
StopstateClk
ShutdownClk
RxUlpmClk
PHY delay FIFO
Clock Lane
LP-RX RxDDRClkHS
D2p HS-RX
CIL-SFEN RxByteClkHS
RxDataHS[7:0] RxByteDataHS[7:0]
D2n
RxSyncHS
RxValidHS
RxActiveHS
Packet header ECC
D-PHY Stopstate2 ECC decode elasticity FIFO
Shutdown2 and correct
ErrSotHS
ErrSotSyncHS
RxByteDataHS[7:0] RAW8_Data[7:0]
WC1
WC0
ECC
ErrControl
ID
RxUlpmEsc
ErrEsc
CSI2 packet VC[1:0]
Data Lane 2 header/footer WC[15:0]
ECC generator processing
LP-RX RxDDRClkHS
D1p HS-RX RxByteClkHS
CIL-SFEN RxByteDataHS[7:0]
RxDataHS[7:0] 16-bit MISR (LFSR)
D1n
RxSyncHS
RxValidHS Receiver Payload CRC error
RxActiveHS Error control CRC detect
block
AppErrors[n:0]
D-PHY Stopstate1
Shutdown1
ErrSotHS Stopstate
ErrSotSyncHS Lane merger ErrSotSyncHS RxByteClk
control logic ErrSotHS FrameValid
ErrControl
(including ErrControl Protocol level LineValid
RxUlpmEsc
PHY control/ RxValidHS1 control logic
ErrEsc
error signals) RxValidHS2
RxByteClk
Data Lane 1
ErrEsc
D-PHY level Lane Merger Level CSI2 Protocol Level
Clock Lane
LP-RX RxDDRClkHS
TxDDRClkHS-I LP-TX D1p D1p HS-RX RxByteClkHS
HS-TX CIL-SFEN
CIL-MFEN RxDataHS[7:0]
TxByteClkHS D1n D1n
TxDataHS[7:0] RxSyncHS
RxValidHS
TxRequestHS D-PHY RxActiveHS
TxReadyHS
RxUlpmEsc
D-PHY
Shutdown Stopstate
TxUlpm Shutdown
TxClkEsc
ErrSotHS
ErrSotSyncHS
ErrEsc
ErrControl
Data Lane 1
LP-RX RxDDRClkHS
TxDDRClkHS-I LP-TX D2p D2p HS-RX RxByteClkHS
HS-TX CIL-SFEN
CIL-MFEN RxDataHS[7:0]
TxByteClkHS D2n D2n
TxDataHS[7:0] RxSyncHS
RxValidHS
TxRequestHS D-PHY RxActiveHS
TxReadyHS
RxUlpmEsc
D-PHY
Shutdown Stopstate
TxUlpm Shutdown
TxClkEsc
ErrSotHS
ErrSotSyncHS
ErrEsc
ErrControl
Data Lane 2
1359
CSI-2 Transmitter Side CSI-2 Receiver Side
Low-power Function
Cp
TX Ctrl Logic
LP-TX
Cn
TxDDRClkHS-Q HS-TX
TxRequestHS
TxReadyHS TX Ctrl IF Logic High-speed Function
Shutdown
TX State
Machine
TxUlpmClk
CIL-MCNN
Lane Control and Interface Logic
1370
Figure 148 CSI-2 Clock Lane Transmitter
1371 The modular D-PHY components used to build a CSI-2 clock lane transmitter are:
1372 • LP-TX for the Low-power function
1373 • HS-TX for the High-speed function
1374 • CIL-MCNN for the Lane control and interface logic
1375 The PPI interface signals to the CSI-2 clock lane transmitter are:
1376 • TxDDRClkHS-Q (Input): High-Speed Transmit DDR Clock (Quadrature).
1377 • TxRequestHS (Input): High-Speed Transmit Request. This active high signal causes the lane
1378 module to begin transmitting a high-speed clock.
1379 • TxReadyHS (Output): High-Speed Transmit Ready. This active high signal indicates that the
1380 clock lane is transmitting HS clock.
1381 • Shutdown (Input): Shutdown Lane Module. This active high signal forces the lane module into
1382 “shutdown”, disabling all activity. All line drivers, including terminators, are turned off when
1383 Shutdown is asserted. When Shutdown is high, all other PPI inputs are ignored and all PPI outputs
1384 are driven to the default inactive state. Shutdown is a level sensitive signal and does not depend on
1385 any clock.
1386 • TxUlpmClk (Input): Transmit Ultra Low-Power mode on Clock Lane This active high signal is
1387 asserted to cause a Clock Lane module to enter the Ultra Low-Power mode. The lane module
1388 remains in this mode until TxUlpmClk is de-asserted.
High-speed Function
RxDDRClkHS HS-RX RT
Cp
RX Ctrl Decoder
LP-RX
Cn
RX Ctrl IF Logic
RxUlpmEsc RX State
RxClkActiveHS Low-power Function
Machine
Stopstate
Shutdown
CIL-SCNN
Lane Control and Interface Logic
1390
Figure 149 CSI-2 Clock Lane Receiver
1391 The modular D-PHY components used to build a CSI-2 clock lane receiver are:
1392 • LP-RX for the Low-power function
1393 • HS-RX for the High-speed function
1394 • CIL-SCNN for the Lane control and interface logic
1395 The PPI interface signals to the CSI-2 clock lane receiver are:
1396 • RxDDRClkHS (Output): High-Speed Receive DDR Clock used to sample the data in all data
1397 lanes.
1398 • RxClkActiveHS (Output): High-Speed Reception Active. This active high signal indicates that the
1399 clock lane is receiving valid clock. This signal is asynchronous.
1400 • Stopstate (Output): Lane is in Stop state. This active high signal indicates that the lane module is
1401 currently in Stop state. This signal is asynchronous.
1402 • Shutdown (Input): Shutdown Lane Module. This active high signal forces the lane module into
1403 “shutdown”, disabling all activity. All line drivers, including terminators, are turned off when
1404 Shutdown is asserted. When Shutdown is high, all PPI outputs are driven to the default inactive
1405 state. Shutdown is a level sensitive signal and does not depend on any clock.
1406 • RxUlpmEsc (Output): Escape Ultra Low-Power (Receive) mode. This active high signal is
1407 asserted to indicate that the lane module has entered the Ultra Low-Power mode. The lane module
1408 remains in this mode with RxUlpmEsc asserted until a Stop state is detected on the lane
1409 interconnect.
Low-power Function
TX Ctrl Logic
Dp
TX Data IF Logic
LP-TX
TxDDRClkHS-I
Dn
TxByteClkHS
HS-Serialize
TxDataHS[7:0]
Sync sequence HS-TX
Deskew sequence
High-speed Function
TxRequestHS
TX Ctrl IF Logic
TxReadyHS
Shutdown
TxRequestEsc TX State
Machine
TxUlpm TxUlpmEsc
TxClkEsc
CIL-MFEN
1412 The modular D-PHY components used to build a CSI-2 data lane transmitter are:
1413 • LP-TX for the Low-power function
1414 • HS-TX for the High-speed function
1415 • CIL-MFEN for the Lane control and interface logic. For optional deskew calibration support, the
1416 data lane transmitter transmits a deskew sequence. The deskew sequence transmission is enabled
1417 by a mechanism out of the scope of this specification.
1418 The PPI interface signals to the CSI-2 data lane transmitter are:
1419 • TxDDRClkHS-I (Input): High-Speed Transmit DDR Clock (in-phase).
1420 • TxByteClkHS (Input): High-Speed Transmit Byte Clock. This is used to synchronize PPI signals
1421 in the high-speed transmit clock domain. It is recommended that both transmitting data lane
1422 modules share one TxByteClkHS signal. The frequency of TxByteClkHS must be exactly 1/8 the
1423 high-speed bit rate.
1424 • TxDataHS[7:0] (Input): High-Speed Transmit Data. Eight bit high-speed data to be transmitted.
1425 The signal connected to TxDataHS[0] is transmitted first. Data is registered on rising edges of
1426 TxByteClkHS.
1427 • TxRequestHS (Input): High-Speed Transmit Request. A low-to-high transition on TxRequestHS
1428 causes the lane module to initiate a Start-of-Transmission sequence. A high-to-low transition on
1429 TxRequest causes the lane module to initiate an End-of-Transmission sequence. This active high
1430 signal also indicates that the protocol is driving valid data on TxByteDataHS to be transmitted.
1431 The lane module accepts the data when both TxRequestHS and TxReadyHS are active on the same
1432 rising TxByteClkHS clock edge. The protocol always provides valid transmit data when
1433 TxRequestHS is active. Once asserted, TxRequestHS should remain high until the all the data has
1434 been accepted.
1435 • TxReadyHS (Output): High-Speed Transmit Ready. This active high signal indicates that
1436 TxDataHS is accepted by the lane module to be serially transmitted. TxReadyHS is valid on rising
1437 edges of TxByteClkHS. Valid data has to be provided for the whole duration of active
1438 TxReadyHS.
1439 • Shutdown (Input): Shutdown Lane Module. This active high signal forces the lane module into
1440 “shutdown”, disabling all activity. All line drivers, including terminators, are turned off when
1441 Shutdown is asserted. When Shutdown is high, all other PPI inputs are ignored and all PPI outputs
1442 are driven to the default inactive state. Shutdown is a level sensitive signal and does not depend on
1443 any clock.
1444 • TxUlpmEsc (Input): Escape mode Transmit Ultra Low Power. This active high signal is asserted
1445 with TxRequestEsc to cause the lane module to enter the Ultra Low-Power mode. The lane
1446 module remains in this mode until TxRequestEsc is de-asserted.
1447 • TxRequestEsc (Input): This active high signal, asserted together with TxUlpmEsc is used to
1448 request entry into escape mode. Once in escape mode, the lane stays in escape mode until
1449 TxRequestEsc is de-asserted. TxRequestEsc is only asserted by the protocol while TxRequestHS
1450 is low.
1451 • TxClkEsc (Input): Escape mode Transmit Clock. This clock is directly used to generate escape
1452 sequences. The period of this clock determines the symbol time for low power signals. It is
1453 therefore constrained by the normative part of the [MIPI01].
High-speed Function
RX Data IF Logic
RxDDRClkHS
RxByteClkHS
HS-Deskew
RxDataHS[7:0]
HS-Deserialize HS-RX RT
RxUlpmEsc Dp
RX Esc ULPS Decoder
LP-RX
RX Ctrl Decoder Dn
RxValidHS
RxActiveHS
Low-power Function
RxSyncHS
RX Ctrl IF Logic
RX State
Stopstate Machine
Shutdown
ErrSotHS
ErrSotSyncHS
ErrControl
ErrEsc
CIL-SFEN
1459 • CIL-SFEN for the Lane control and interface logic. For optional deskew calibration support the
1460 data lane receiver detects a transmitted deskew calibration pattern and performs optimum deskew
1461 of the Data with respect to the RxDDRClkHS Clock.
1462 The PPI interface signals to the CSI-2 data lane receiver are:
1463 • RxDDRClkHS (Input): High-Speed Receive DDR Clock used to sample the date in all data lanes.
1464 This signal is supplied by the CSI-2 clock lane receiver.
1465 • RxByteClkHS (Output): High-Speed Receive Byte Clock. This signal is used to synchronize
1466 signals in the high-speed receive clock domain. The RxByteClkHS is generated by dividing the
1467 received RxDDRClkHS.
1468 • RXDataHS[7:0] (Output): High-Speed Receive Data. Eight bit high-speed data received by the
1469 lane module. The signal connected to RxDataHS[0] was received first. Data is transferred on
1470 rising edges of RxByteClkHS.
1471 • RxValidHS (Output): High-Speed Receive Data Valid. This active high signal indicates that the
1472 lane module is driving valid data to the protocol on the RxDataHS output. There is no
1473 “RxReadyHS” signal, and the protocol is expected to capture RxDataHS on every rising edge of
1474 RxByteClkHS where RxValidHS is asserted. There is no provision for the protocol to slow down
1475 (“throttle”) the receive data.
1476 • RxActiveHS (Output): High-Speed Reception Active. This active high signal indicates that the
1477 lane module is actively receiving a high-speed transmission from the lane interconnect.
1478 • RxSyncHS (Output): Receiver Synchronization Observed. This active high signal indicates that
1479 the lane module has seen an appropriate synchronization event. In a typical high-speed
1480 transmission, RxSyncHS is high for one cycle of RxByteClkHS at the beginning of a high-speed
1481 transmission when RxActiveHS is first asserted. This signal missing is signaled using
1482 ErrSotSyncHS.
1483 • RxUlpmEsc (Output): Escape Ultra Low Power (Receive) mode. This active high signal is
1484 asserted to indicate that the lane module has entered the Ultra Low-Power mode. The lane module
1485 remains in this mode with RxUlpmEsc asserted until a Stop state is detected on the lane
1486 interconnect.
1487 • Stopstate (Output): Lane is in Stop state. This active high signal indicates that the lane module is
1488 currently in Stop state. This signal is asynchronous.
1489 • Shutdown (Input): Shutdown Lane Module. This active high signal forces the lane module into
1490 “shutdown”, disabling all activity. All line drivers, including terminators, are turned off when
1491 Shutdown is asserted. When Shutdown is high, all PPI outputs are driven to the default inactive
1492 state. Shutdown is a level sensitive signal and does not depend on any clock.
1493 • ErrSotHS (Output): Start-of-Transmission (SoT) Error. If the high-speed SoT leader sequence is
1494 corrupted, but in such a way that proper synchronization can still be achieved, this error signal is
1495 asserted for one cycle of RxByteClkHS. This is considered to be a “soft error” in the leader
1496 sequence and confidence in the payload data is reduced.
1497 • ErrSotSyncHS (Output): Start-of-Transmission Synchronization Error. If the high-speed SoT
1498 leader sequence is corrupted in a way that proper synchronization cannot be expected, this error is
1499 asserted for one cycle of RxByteClkHS.
1500 • ErrControl (Output): Control Error. This signal is asserted when an incorrect line state sequence
1501 is detected.
1502 • ErrEsc (Output): Escape Entry Error. If an unrecognized escape entry command is received, this
1503 signal is asserted and remains high until the next change in line state. The only escape entry
1504 command supported by the receiver is the ULPS.
1546 • ErrSotHS: Start-of-Transmission (SoT) Error. If the high-speed SoT leader sequence is corrupted,
1547 but in such a way that proper synchronization can still be achieved, this error signal is asserted for
1548 one cycle of RxByteClkHS. This is considered to be a “soft error” in the leader sequence and
1549 confidence in the payload data is reduced.
1550 • ErrSotSyncHS: Start-of-Transmission Synchronization Error. If the high-speed SoT leader
1551 sequence is corrupted in a way that proper synchronization cannot be expected, this error signal is
1552 asserted for one cycle of RxByteClkHS.
1553 • ErrControl: Control Error. This signal is asserted when an incorrect line state sequence is
1554 detected. For example, if a Turn-around request or Escape Mode request is immediately followed
1555 by a Stop state instead of the required Bridge state, this signal is asserted and remains high until
1556 the next change in line state.
1557 The recommended receiver error behavior for this level is:
1558 • ErrSotHS should be passed to the Application Layer. Even though the error was detected and
1559 corrected and the Sync mechanism was unaffected, confidence in the data integrity is reduced and
1560 the application should be informed. This signal should be referenced to the corresponding data
1561 packet.
1562 • ErrSotSyncHS should be passed to the Protocol Decoding Level, since this is an unrecoverable
1563 error. An unrecoverable type of error should also be signaled to the Application Layer, since the
1564 whole transmission until the first D-PHY Stop state should be ignored if this type of error occurs.
1565 • ErrControl should be passed to the Application Layer, since this type of error doesn’t normally
1566 occur if the interface is configured to be unidirectional. Even so, the application should be aware
1567 of the error and configure the interface accordingly through other, implementation specific-means
1568 that are out of scope for this specification.
1569 Also, it is recommended that the PPI StopState signal for each implemented Lane should be propagated to
1570 the Application Layer during configuration or initialization to indicate the Lane is ready.
1592 • ErrEccCorrected should be passed to the Application Layer since the application should be
1593 informed that an error had occurred but was corrected, so the received Packet Header was
1594 unaffected, although the confidence in the data integrity is reduced.
1595 • ErrEccNoError can be passed to the Protocol Decoding Level to signal the validity of the current
1596 Packet Header.
1597 • ErrCrc should be passed to the Protocol Decoding Level to indicate that the packet’s payload data
1598 might be corrupt.
1599 • ErrID should be passed to the Application Layer to indicate that the data packet is unidentified
1600 and cannot be unpacked by the receiver. This signal should be asserted after the ID has been
1601 identified and de-asserted on the first Frame End (FE) on same virtual channel.
Using signal XSHUTDOWN to confirm entry and exit from “Sleep” mode
Using the ULPS Sequence on Data Lane to confirm entry and exit from “Sleep” mode
Dp (D-PHY) or
Data_A (C-PHY)
Dn (D-PHY) or
Data_C (C-PHY)
Initial
1654 State
Transmitter Receiver
Codec
Selector and
Encoder Encoded Encoded
Symbols Symbols Decoded
+ DPCM1 Symbols
Σ ... Decoder
Unencoded DPCMN
- PCM
Symbols M-pixel
Memory
M-pixel
Predictor Decoder
Memory Predictor
1701
Figure 153 Data Compression System Block Diagram
1702 The encoder uses a simple algorithm to encode the pixel values. A fixed number of pixel values at the
1703 beginning of each line are encoded without using prediction. These first few values are used to initialize the
1704 predictor block. The remaining pixel values on the line are encoded using prediction.
1705 If the predicted value of the pixel (Xpred) is close enough to the original value of the pixel (Xorig)
1706 (abs(Xorig - Xpred) < difference limit), its difference value (Xdiff) is quantized using a DPCM codec.
1707 Otherwise, Xorig is quantized using a PCM codec. The quantized value is combined with a code word
1708 describing the codec used to quantize the pixel and the sign bit, if applicable, to create the encoded value
1709 (Xenco).
E.1 Predictors
1710 In order to have meaningful data transfer, both the transmitter and the receiver need to use the same
1711 predictor block.
1712 The order of pixels in a raw image is shown in Figure 154.
1713
Figure 154 Pixel Order of the Original Image
1714 Figure 155 shows an example of the pixel order with RGB data.
G0 R1 G2 R3 G4 R5 G6 R7
B0 G1 B2 G3 B4 G5 B6 G7
1715
Figure 155 Example Pixel Order of the Original Image
1716 Two predictors are defined for use in the data compression schemes.
1717 Predictor1 uses a very simple algorithm and is intended to minimize processing power and memory size
1718 requirements. Typically, this predictor is used when the compression requirements are modest and the
1719 original image quality is high. Predictor1 should be used with 10–8–10, 10–7–10 and 12–8–12 data
1720 compression schemes.
1721 The second predictor, Predictor2, is more complex than Predictor1. This predictor provides slightly better
1722 prediction than Predictor1 and therefore the decoded image quality can be improved compared to
1723 Predictor1. Predictor2 should be used with 10–6–10, 12–7–12, and 12–6–12 data compression schemes.
1724 Both receiver and transmitter shall support Predictor1 for all data compression schemes.
E.1.1 Predictor1
1725 Predictor1 uses only the previous same color component value as the prediction value. Therefore, only a
1726 two-pixel deep memory is required.
1727 The first two pixels (C00, C11 / C20, C31 or as in example G0, R1 / B0, G1) in a line are encoded without
1728 prediction.
1729 The prediction values for the remaining pixels in the line are calculated using the previous same color
1730 decoded value, Xdeco. Therefore, the predictor equation can be written as follows:
1731 Xpred( n ) = Xdeco( n-2 )
E.1.2 Predictor2
1732 Predictor2 uses the four previous pixel values, when the prediction value is evaluated. This means that also
1733 the other color component values are used, when the prediction value has been defined. The predictor
1734 equations can be written as shown in the following formulas.
1735 Predictor2 uses all color components of the four previous pixel values to create the prediction value.
1736 Therefore, a four-pixel deep memory is required.
1737 The first pixel (C00 / C20, or as in example G0 / B0) in a line is coded without prediction.
1738 The second pixel (C11 / C31 or as in example R1 / G1) in a line is predicted using the previous decoded
1739 different color value as a prediction value. The second pixel is predicted with the following equation:
1740 Xpred( n ) = Xdeco( n-1 )
1741 The third pixel (C02 / C22 or as in example G2 / B2) in a line is predicted using the previous decoded same
1742 color value as a prediction value. The third pixel is predicted with the following equation:
1743 Xpred( n ) = Xdeco( n-2 )
1744 The fourth pixel (C13 / C33 or as in example R3 / G3) in a line is predicted using the following equation:
1745 if ((Xdeco( n-1 ) <= Xdeco( n-2 ) AND Xdeco( n-2 ) <= Xdeco( n-3 )) OR
1746 (Xdeco( n-1 ) >= Xdeco( n-2 ) AND Xdeco( n-2 ) >= Xdeco( n-3 ))) then
1747 Xpred( n ) = Xdeco( n-1 )
1748 else
1749 Xpred( n ) = Xdeco( n-2 )
1750 endif
1751 Other pixels in all lines are predicted using the equation:
1752 if ((Xdeco( n-1 ) <= Xdeco( n-2 ) AND Xdeco( n-2 ) <= Xdeco( n-3 )) OR
1753 (Xdeco( n-1 ) >= Xdeco( n-2 ) AND Xdeco( n-2 ) >= Xdeco( n-3 ))) then
1754 Xpred( n ) = Xdeco( n-1 )
1755 else if ((Xdeco( n-1 ) <= Xdeco( n-3 ) AND Xdeco( n-2 ) <= Xdeco( n-4 )) OR
1756 (Xdeco( n-1 ) >= Xdeco( n-3 ) AND Xdeco( n-2 ) >= Xdeco( n-4 ))) then
1757 Xpred( n ) = Xdeco( n-2 )
1758 else
1759 Xpred( n ) = (Xdeco( n-2 ) + Xdeco( n-4 ) + 1) / 2
1760 endif
E.2 Encoders
1761 There are six different encoders available, one for each data compression scheme.
1762 For all encoders, the formula used for non-predicted pixels (beginning of lines) is different than the formula
1763 for predicted pixels.
1806 endif
1807 value = (abs(Xdiff( n )) - 32) / 2
2019 where,
2020 “0000” is the code word
2021 “s” is the sign bit
2022 “xxx” is the three bit value field
2023 The coder equation is described as follows:
2024 if (Xdiff( n ) <= 0) then
2025 sign = 1
2026 else
2027 sign = 0
2028 endif
2029 value = abs(Xdiff( n ))
2030 Note: Zero code has been avoided (0 is sent as -0).
2151 sign = 0
2152 endif
2153 value = (abs(Xdiff( n )) - 12) / 4
2280 where,
2281 “011” is the code word
2282 “s” is the sign bit
2283 “xx” is the two bit value field
2284 The coder equation is described as follows:
2285 if (Xdiff( n ) < 0) then
2286 sign = 1
2287 else
2288 sign = 0
2289 endif
2290 value = (abs(Xdiff( n )) - 74) / 32
E.3 Decoders
2312 There are six different decoders available, one for each data compression scheme.
2313 For all decoders, the formula used for non-predicted pixels (beginning of lines) is different than the formula
2314 for predicted pixels.
2681 where,
2682 “0001” is the code word
2683 “s” is the sign bit
2684 “xxx” is the three bit value field
2685 The codec equation is described as follows:
2686 sign = Xenco( n ) & 0x8
2687 value = 16 * (Xenco( n ) & 0x7) + 232 + 7
2688 if (sign > 0) then
2689 Xdeco( n ) = Xpred( n ) - value
2690 if (Xdeco( n ) < 0) then
2691 Xdeco( n ) = 0
2692 endif
2693 else
2694 Xdeco( n ) = Xpred( n ) + value
2695 if (Xdeco( n ) > 4095) then
2696 Xdeco( n ) = 4095
2697 endif
2698 endif
2776 endif
2777 endif
2916 Xdeco( n ) = 0
2917 endif
2918 else
2919 Xdeco( n ) = Xpred( n ) + value
2920 if (Xdeco( n ) > 4095) then
2921 Xdeco( n ) = 4095
2922 endif
2923 endif
Frame Start Packet YUV422 Data Type User Defined Data Type
LPS SoT FS EoT LPS SoT PH YUV422 Data PF EoT LPS SoT PH JPEG Data PF EoT
YUV422 Data Type YUV422 Data Type User Defined Data Type
LPS SoT PH YUV422 Data PF EoT LPS SoT PH YUV422 Data PF EoT LPS SoT PH JPEG Data PF EoT
YUV422 Data Type User Defined Data Type Frame End Packet
LPS SoT PH YUV422 Data PF EoT LPS SoT PH JPEG Data PF EoT LPS SoT FE EoT LPS
KEY:
LPS – Low Power State PH – Packet Header FS – Frame Start Packet
SoT – Start of Transmission PF – Packet Footer FE – Frame End Packet
3016 EoT – End of Transmission
Figure 156 Data Type Interleaving: Concurrent JPEG and YUV Image Data
SoT FS EoT LPS SoT PH JPEG Data PF EoT LPS SoT FS EoT LPS SoT PH YUV422 Data PF EoT
LPS SoT PH JPEG Data PF EoT LPS SoT PH YUV422 Data PF EoT LPS SoT PH JPEG Data PF EoT
LPS SoT PH YUV422 Data PF EoT LPS SoT FE EoT LPS SoT PH JPEG Data PF EoT LPS SoT FE EoT
KEY:
LPS – Low Power State PH – Packet Header FS – Frame Start Packet
SoT – Start of Transmission PF – Packet Footer FE – Frame End Packet
3017 EoT – End of Transmission
Figure 157 Virtual Channel Interleaving: Concurrent JPEG and YUV Image Data
3018 Both Figure 156 and Figure 157 can be similarly extended to the interleaving of JPEG image data with any
3019 other type of image data, e.g. RGB565.
3020 Figure 158 illustrates the use of Virtual Channels to support three different JPEG interleaving usage cases:
3021 • Concurrent JPEG and YUV422 image data.
3022 • Alternating JPEG and YUV422 output - one frame JPEG, then one frame YUV
3023 • Streaming YUV22 with occasional JPEG for still capture
3024 Again, these examples could also represent interleaving JPEG data with any other image data type.
JPEG JPEG JPEG JPEG 1 Frame 1 Frame JPEG JPEG JPEG JPEG
CSI-2 RX
VC0
CSI-2 TX
VC0 Frame Frame Frame Frame Frame Frame Frame Frame
Y J Y J Y J Y J Y J Y J Y J Y J
YUV YUV YUV YUV YUV YUV YUV YUV
VC1 Frame Packet interleaved JPEG and VC1
Frame Frame Frame Frame Frame Frame Frame
YUV data
Use Case 2: Alternating JPEG and YUV output – one frame JPEG, then one frame YUV
CSI-2 RX
VC0
CSI-2 TX
VC0 Frame Frame Frame Frame
YUV JPEG YUV JPEG
YUV YUV YUV YUV
VC1 Frame CSI-2 RX uses the Virtual VC1
Frame Frame Frame
Channel and Data Type
codes to de-multiplex data
JPEG JPEG
CSI-2 RX
VC0
CSI-2 TX
3025
Figure 158 Example JPEG and YUV Interleaving Use Cases