Parallel To MIPI CSI-2 TX Bridge: January 2015 Reference Design RD1183
Parallel To MIPI CSI-2 TX Bridge: January 2015 Reference Design RD1183
Introduction
The Mobile Industry Processor Interface (MIPI) has become a specification standard for interfacing components in
consumer mobile devices. The MIPI Camera Serial Interface 2 (CSI-2) specification provides a protocol layer inter-
face definition, which is used to interface with Cameras and Image Sensors. The Parallel to MIPI CSI-2 TX Bridge
Reference Design allows users to deliver data to a MIPI CSI-2 compatible receiver such an ISP (Image Signal Pro-
cessor) from a standard parallel video interface. See Figure 1.
Clock lane +
Camera/Image Sensor Clock lane - Processor
Contains: Contains:
HS Transmitter Data lane 3 + HS Receiver
Data lane 3 -
LP Transmitter LP Receiver
CCI Slave (12C Interface) Data lane 2 + LP Transmitter (Optional)
Data lane 2 -
Typical Device Examples: Data lane 1 + Typical Device Examples:
Cameras and Image Sensors Data lane 1 - ISP (Image Signal Processor)
SCL
SDA
Key Features
• Interfaces to MIPI CSI-2 Receiving Devices
• Supports Unidirectional HS (High Speed) Mode
• Supports Bidirectional LP (Low Power) Mode
• Serializes HS (High Speed) data from up to four data lanes
• Supports all CSI-2 compatible video formats (RAW, YUV, RGB and User Defined)
© 2015 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at [Link]/legal. All other brand
or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.
[Link] 1 RD1183_1.5
Parallel to MIPI CSI-2 TX Bridge
Data lane 1 +
Data lane 1 -
Data lane 0 +
Data lane 0 -
SCL
SDA
Functional Description
The Parallel to MIPI CSI-2 TX Bridge Reference Design converts a standard parallel video interface into CSI-2 byte
packets. It then serializes HS data and controls LP (Low Power) and HS (High Speed) data transfers using the Lat-
tice RD1182, MIPI D-PHY Reference IP. The input interface for the design consists of a data bus (PIXDATA), line
and frame valid indicators (FV and LV) and a clock (PIXCLK). The output interface consists of HS and LP signals
that must be connected together using an external resistor network, which is described in the Unidirectional Trans-
mit HS Mode and Bidirectional LP Mode Interface Implementation section of this document. Further information
regarding this resistor network can also be found in the Lattice RD1182, MIPI D-PHY Reference IP documentation.
HS and LP signals for the clock lane and data lanes are provided on DCK, D0, D1, D2, D3 and LPCLK, LP0, LP1,
LP2, and LP3 signals respectively. Include parameters control the amount of data ports available for HS and LP
modes at the top level depending on the number of data lanes used.
FV
DE
PIXDATA [word_width-1:0]
• byte_packetizer.v – Converts parallel data to byte packets. Appends Packet Header and Checksum.
• lp_hs_dly_ctrl.v – Controls time delay between clock and data lanes when entering and exiting HS mode. Con-
trols time delay from when HS mode is entered to when data is placed on the data bus.
• dphy_tx_inst.v – Serializes byte data using iDDRx4 gearbox primitives. Controls high impedance and bi-direc-
tional states of HS and LP signals.
• pll_pix2byte_gen.v – Converts pixel clock to HS clock and byte clocks. Output frequencies depend on input
clock, input bus width and number of MIPI data lanes.
2
Parallel to MIPI CSI-2 TX Bridge
PLL byte_clk
resetn
LP_HS_DELAY_CNTRL
Byte Packetizer
pixclk
FV
LV LP_clk[1:0]
D-PHY
LP_data[1:0]
Pixdata[35:0] Parallel Packet Checksum Reference IP
to Byte Header Append Byte_D0[7:0]
Byte_D1[7:0]
VC[1:0] Packet Append
Byte_D3[7:0]
WC[15:0] Byte_D2[7:0]
To control the ports defined at the top level, `define compiler directives are used. These compiler directives can be
found in compiler_directives.v
Design parameters control other features of the design. These design parameters are located at the top of the
module declaration in top.v.
Top level IO ports are defined as follows for top.v. The number of IO is dependent on the number of data lanes
defined by compiler_directives.v.
3
Parallel to MIPI CSI-2 TX Bridge
The top level module instantiates and connects five main modules. In addition, a PLL module controls clocking for
the entire design. The input of the PLL is pixel clock. The PLL outputs two high speed oDDRx4 gearbox clocks (0
degree and one with 90 degree phase shifts), the byte clock and the CRC clock.
The clock equations for PLL output ports are shown in Table 4.
The PLL is configured using IPExpress in the Lattice Diamond® Software. The PLL comes pre-configured for the
appropriate clock conversion ratios based on the mode and number of MIPI data lanes used. It can also be
adjusted and reconfigured to individual design needs by double clicking on pll_pix2byte.ipx in the file list. An IPEx-
press configuration GUI will open to adjust the PLL.
4
Parallel to MIPI CSI-2 TX Bridge
Parameters for the BYTE_PACKETIZER include word_width (bus width of the pixel bus), lane_width (number of
byte lanes), dt (data type), crc16 enable. Different NGOs in the */NGO/* folder are called depending on the mode
defined.
Within the module the pixel data is converted to bytes. If the data is going to be a long packet, identified by LV (Line
Valid), the CRC checksum will be calculated over the data and appended to the end of the long packet. Also
appended to the data stream in this module is the Packet Header for all packet types.
The number of horizontal pixels the LV (Line Valid) is high should correlate to an integer multiple of the number of
bytes used at the output. It is recommend that active lines be truncated or extended to meet this criteria. This will
ensure proper readout of all pixels and a correct checksum calculation.
5
Parallel to MIPI CSI-2 TX Bridge
To ensure that the input pixel data is an integer multiple of the output byte data, the following equation can be used.
The LV must be held for an integer number of byte clocks. If "number of byte clocks" does not calculate to an inte-
ger value, adjust the number of pixel clock cycles for which LV is active.
number of byte clocks = [(number of pixels) * (bits per pixel)] / [8 bits * (number of data lanes)]
Output ports for the BYTE_PACKETIZER module include the 8-bit data buses for each lane and an enable signal.
The hs_en signal goes active ‘high’ when any short packet or long packet is to be transmitted.
6
Parallel to MIPI CSI-2 TX Bridge
dly
dly
ly
dly
_
_d
ta_
ata
lk_
ata
fda
ofd
2c
2d
r to
ata
nd
clk
sta
_e
_d
_
_
HS
LP
LP
HS
HS
HS
LP
LP
PIXDATA[23:0]
[23:0]
LV
FV
BYTE_PACKETIZER_24s_2s_36_1s_1s
reset_n
pll_pix2byte PIXCLK
CLKOP FV hs_en
CLKOS LV
reset_n CLKI byte_D3[7:0]
CLKOS2 byte_clk [7:0]
RST
CLKOS3 crc_clk byte_D2[7:0]
un1_reset_n LOCK [23:0] [7:0]
PIXDATA[23:0] byte_D1[7:0]
00 [7:0]
u_pll_pix2byte VC[1:0] byte_D0[7:0]
[15:0] [7:0]
WC[15:0]
u_BYTE_PACKETIZER
colorbar_gen_480_620_800_830_40_44_148_5_5_0s
fv
lv
rstn vsync
011111011101111 0
PIXCLK clk hsync
0000010110000000 [15:0]
data[23:0] 1
[23:0]
u_colorbar_gen
word_cnt[15:0]
7
Parallel to MIPI CSI-2 TX Bridge
Packaged Design
The Parallel to MIPI CSI-2 TX Bridge Reference Design is available for Lattice MachXO2TM devices. The reference
design immediately available on [Link] is configured for RAW10, 2-lane mode. Other designs are avail-
able through the bridge request form. The packaged design contains a Lattice Diamond project within the *\impl\
folder configured for the MachXO2 device. Verilog source is contained within the *\rtl\ folder. The Verilog test bench
is contained within the tb folder. The simulation folder contains an Aldec Active-HDL project. It is recommended
that users access the active HDL Simulation environment through the Lattice Diamond Software and the simulation
setup script contained within the project. For details on how to access the design simulation environment see the
Functional Simulation section of this document.
8
Parallel to MIPI CSI-2 TX Bridge
Functional Simulation
The simulation environment and testbench Parallel2CSI2_tb_*.v instantiates the top level design module. The top
level design inputs are driven with a generated pattern from the colorbar_gen module.
The simulation environment can be accessed by double clicking on the <name>.spf script file in Lattice Diamond
from the file list. After clicking OK, Aldec ActiveHDL opens to the pop-up windows. Compile the project and initialize
the simulation. Add signals to the waveform viewer that are desired to be viewer and run the simulation.
9
Parallel to MIPI CSI-2 TX Bridge
Figure 10. Unidirectional Transmit HS Mode and Bidirectional LP Mode Interface Implementation
50 ohm
LVCMOS12
320 ohm D3P
LVDS25
320 ohm D3N
LVCMOS12
50 ohm
The following are rules for choosing a proper pinout on MachXO2 devices:
Bank 0 should be used for HS outputs (DCK, D0, D1, D2, D3) with the TX D-PHY IP since these pins utilize
oDDRx4 gearbox primitives
With the rules mentioned above a recommend pinout is provided for the most common packages chosen for this IP.
For the MachXO2 the cs132bga is the most common package. The pinouts chosen below are pin compatible with
MachXO2-1200, MachXO2-2000 and MachXO2-4000 devices.
10
Parallel to MIPI CSI-2 TX Bridge
Table 7. TX IO Timing
Device Family Speed Grade -4 @ 262Mhz Speed Grade -5 @ 315Mhz Speed Grade -6 @ 378Mhz
TM
MachXO2 Data Valid Data Valid Data Valid Data Valid Data Valid Data Valid
Before Clock (ps) After Clock (ps) Before Clock (ps) After Clock (ps) Before Clock (ps) After Clock (ps)
710 710 570 570 455 455
11
Parallel to MIPI CSI-2 TX Bridge
Resource Utilization
The resource utilization tables below represent the device usage in various configurations of the D-PHY IP.
Resource utilization was performed on the IP in configurations of 1, 2 and 4 data lanes. For each of these configu-
rations LP mode on the data lanes used was turned on. In addition, HS and LP clock signals were available for
each configuration.
References
• MIPI Alliance Specification for Camera Serial Interface 2 (CSI-2) V1.01
• MIPI Alliance Specification for D-PHY V1.1
12
Parallel to MIPI CSI-2 TX Bridge
Revision History
Date Version Change Summary
January 2015 01.5 Added support for ECP5 device family.
Updated the Packaged Design section. Updated Figure 8, Packaged
Design Directory Structure.
Updated the Device Pinout and Bank Voltage Requirements section.
Updated Table 8, TX Maximum Operating Frequencies by Configura-
tion.
Updated the Resource Utilization section. Updated Table 9, TX
Resource Utilization.
Corrected version number on first page footer. Previous version should
be 01.4; updated this version to 01.5.
April 2014 01.4 Added support for MachXO3L device family.
Updated Functional Description section. Revised top level design (top.v)
main modules.
Updated Functional Simulation section. Revised .spf script file name.
Updated Packaged Design section. Updated Figure 8, Packaged
Design Directory Structure.
Updated the Device Pinout and Bank Voltage Requirements section.
Updated Table 8, TX Maximum Operating Frequencies by Configura-
tion.
Updated the Resource Utilization section. Updated Table 9, TX
Resource Utilization.
Added support for Lattice Diamond 3.1 design software.e
March 2014 01.3 Updated Figure 6, Timing Diagram for LP_HS_DELAY_CNTRL Delay
Parameters.
December 2013 01.2 Updated the BYTE_PACKETIZER Module Description section.
August 2013 01.1 Updated Table 8 title to TX Maximum Operating Frequencies by Config-
uration and added footnote.
01.0 Initial release.
13