<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processors中的主题 iMX6[DL] Troubleshooting MIPI CSI2 and Working with Bayer</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761688#M118330</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;Does&amp;nbsp;&lt;SPAN&gt;CCM_ANALOG_PLL_VIDEO need to be configured for iMX6DL?&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Is the bandwidth (based on 2.3.1 in &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf" style="color: #2989c5; text-decoration: none;"&gt;AN5305&lt;/A&gt;):&lt;BR /&gt; 1920x1080 (pixels/frame) x 10 (bits/pixel) / 8 (bits/cycle) x30 (frames/second) x 1.35 =&amp;nbsp;105 MHz;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(This post is still being written.&amp;nbsp; I &lt;EM&gt;WILL&lt;/EM&gt;&amp;nbsp;explain how to get a working Bayer conversion at 30fps!)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an attempt to capture a complete guide on working with the iMX6 (specific to DL) MIPI CSI2 camera that outputs Bayer format (10-bit).&amp;nbsp; I will attempt to keep it up to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll start out with our current configuration,&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; width: 67.0426%;"&gt;&lt;TBODY&gt;&lt;TR style="height: 19px;"&gt;&lt;TD style="width: 27.4409%; height: 19px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Sensor&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 19px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;OV5675&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Pixel Format&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Bayer 10-bit&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Targeted Resolution&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;1920x1080&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Targeted Frame Rate&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;30 FPS&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Lanes&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Clock (Reference Manual)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;900 MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Pixel Clock (Reference Manual)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;112.5 MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;VSync&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;No additional pins / Read from MIPI packet&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;iMX6DL path&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CSI2--&amp;gt;MIPI--&amp;gt;SMFC--&amp;gt;IMDAC--&amp;gt;GPU&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Packet format (reg. 0x4814)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0x2A&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Virtual Channel&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CSI clock source&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CLKO =&amp;gt; 24MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD colspan="2" style="width: 62%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;git clone&amp;nbsp;git://git.freescale.com/imx/linux-imx.git -b&amp;nbsp;imx_4.9.11_1.0.0_ga&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From 2.3.1 in the &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf"&gt;AN5305&lt;/A&gt; document describes the payload as being 16-bits wide and 8-bits per cycle.&amp;nbsp; For Bayer 10-bit one clock cycle can send,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;10 (bits/pixel) /&amp;nbsp;8 (bits/cycle) = 5/4 (cycles/pixel)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Camera drives the MIPI clock and can be calculated,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Bandwidth: (must be &amp;lt; 125 MHz)&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;1920x1080 (pixels/frame) x 10 (bits/pixel) / 8 (bits/cycle) x30 (frames/second) x 1.35 =&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;105&lt;/SPAN&gt;&amp;nbsp;MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;MIPI D-PHY&amp;nbsp;Data Rate:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;105&amp;nbsp;MHz x&amp;nbsp;8&amp;nbsp;(bits/cycle) =&amp;nbsp;840 Mb/s&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;MIPI Clock:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;840&lt;/SPAN&gt;&amp;nbsp;Mb/s / 2 (lanes) / 2 (reads/bit DDR) =&amp;nbsp;210 MHz &amp;lt;&amp;nbsp;900 MHz (actual)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;MIPI_CSI2_PHY_TST_CTRL1:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;900 MHz (0x34)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Turns out I was relying too much on a crappy oscilloscope that read 450 MHz when the actual speed was 900 MHz.&amp;nbsp; Now the 'calibrated' MIPI D-PHY clock can be set according to table 4 in the &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf"&gt;MIPI-CSI2 Guide&lt;/A&gt;.&amp;nbsp; This works out to be &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x34&lt;/SPAN&gt;.&amp;nbsp; This assumes the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ref_clock&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;PLL3&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;VIDEO_27M_CLK_ROOT&lt;/SPAN&gt;) is at 27MHz.&amp;nbsp; &lt;SPAN style="text-decoration: line-through;"&gt;This can be verified by checking &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI_PHY_STATE&lt;/SPAN&gt;&lt;/SPAN&gt;, (This cannot be verified reliably but may give some clues)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Make sure clocks are enabled */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;clk_prepare_enable(info-&amp;gt;cfg_clk);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; clk_prepare_enable(info-&amp;gt;dphy_clk);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Set lanes to 2 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, info-&amp;gt;lanes - 1, MIPI_CSI2_N_LANES);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Low is active for the following */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0x0, MIPI_CSI2_PHY_SHUTDOWNZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x0, MIPI_CSI2_DPHY_RSTZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x0, MIPI_CSI2_CSI2_RESETN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Sequence required to 'calibrate' MIPI D-PHY clock */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0x00000001, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000002, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00010044, MIPI_CSI2_PHY_TST_CTRL1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000034, MIPI_CSI2_PHY_TST_CTRL1);&amp;nbsp;&amp;nbsp;&amp;nbsp;/* &amp;lt;--&amp;nbsp;900 MHz */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000002, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Put back high to enable MIPI D-PHY */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_PHY_SHUTDOWNZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_DPHY_RSTZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_CSI2_RESETN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/***** Put Camera sensor into MIPI STOPSTATE&amp;nbsp;*****/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Wait Camera MIPI lines to be in state LP-11 (STOPSTATE) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;while (i++&amp;lt;10 &amp;amp;&amp;amp; ((status = mipi_csi2_dphy_status(mipi_csi2)) &amp;amp; 0x430) != 0x430)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;msleep(10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;if (i &amp;gt;= 10) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;dev_err(dev, "Error w/ MIPI CSI2 clock (0x%08x)\n", status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;return -1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/***** Re-enable the Camera sensor here *****/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;i = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; /* Wait for MIPI stable */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; while (i++&amp;lt;10 &amp;amp;&amp;amp; ((status1 = mipi_csi2_get_error1(mipi_csi2)) ||&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 150px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;(&lt;SPAN&gt;status2 = mipi_csi2_get_error2(mipi_csi2)&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;msleep(10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;/* In case it was missed and to satisfy the compiler. */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;&lt;SPAN&gt;status2 = mipi_csi2_get_error2(mipi_csi2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;if (i &amp;gt;= 10) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;dev_err(dev, "mipi csi2 can not reveive data correctly! (0x%08x)\n", status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; return -1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still get errors from &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI_ERROR1|2&lt;/SPAN&gt; then increase the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI2_PHY_TST_CTRL1&lt;/SPAN&gt; speed.&amp;nbsp; The MIPI D-PHY&amp;nbsp;should have no problems if set above the measured/calculated value.&amp;nbsp; After the camera has been enabled you may notice&amp;nbsp;&lt;SPAN&gt;MIPI_CSI_PHY_STATE changing states between &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00000330&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00000300&lt;/SPAN&gt; as data is being fed into the MIPI D-PHY.&amp;nbsp; Probing with an oscilloscope should also reveal MIPI packets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you do not see any packet being transmitted then there is a good chance that your camera is not configured correctly.&amp;nbsp; The&amp;nbsp;OmniVision&amp;nbsp;cameras are known to not transmit when incorrectly configured.&amp;nbsp; Try configuring the camera for just sending test images.&amp;nbsp; For the OV5675, write &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x80&lt;/SPAN&gt; to register&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x4503&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It&amp;nbsp;is recommended that the camera sensor be placed into the MIPI &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;STOPSTATE&lt;/SPAN&gt;.&amp;nbsp; The OV5675 can be set to this state by disabling the software i.e. writing &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00&lt;/SPAN&gt; to register &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x0100&lt;/SPAN&gt;.&amp;nbsp; Optionally, restart the OV5675's software by writing &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x01&lt;/SPAN&gt; to register &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x0103&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I initially decided to configure the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CCM_ANALOG_PLL_VIDEO&lt;/SPAN&gt; clock since it is mentioned in the &lt;STRONG&gt;MIPI-CSI2 Peripheral&lt;/STRONG&gt; document example (link was provided&amp;nbsp;above).&amp;nbsp; The&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CCM_ANALOG_PLL_VIDEO&lt;/SPAN&gt;&amp;nbsp;clock&amp;nbsp;(a.k.a. PLL5 - default 630 MHz) and can be adjusted &lt;SPAN&gt;by (18.5.1.3.4 Audio / Video PLL from IMXSDLRM),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;PLL5 output frequency = Fref * (DIV_SELECT + NUM/DENOM)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the clock is connected to the display output, I decide NOT to continue down this path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;The next step is configuring the CSI-2/IPU Gasket.&amp;nbsp; I might be wrong here, but according to&amp;nbsp;38.4.3.6.2 in the &lt;/SPAN&gt;&lt;A href="https://www.nxp.com/doc/IMX6SDLRM"&gt;Application Processor Reference Manual&lt;/A&gt;&lt;SPAN style="color: #800000;"&gt;: non-gated mode should be selected for MIPI.&amp;nbsp; I am uncertain if &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CSI2IPU_SW_RST[CLK_SEL]&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IPU_CSI0_SENS_CONF[CSI0_EXT_VSYNC]&lt;/SPAN&gt; are related.&amp;nbsp; According to &lt;A _jive_internal="true" href="https://community.nxp.com/thread/432525"&gt;this post&lt;/A&gt; the VSYNC is not required.&amp;nbsp; I know they are not the same thing, however something must be used to determine the EOF (End Of Frame).&amp;nbsp; The EOF and VSYNC&amp;nbsp;should come from the MIPI [short] packets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the pixel clock between the gasket and IPU must be configured.&amp;nbsp; Documentation seems to be limited on exactly how to do this.&amp;nbsp; Here is one confusing line provided by NXP,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;hsp_clk &amp;gt; ccm_pixel_clk/0.9 &amp;gt; (mipi_clk_lane frequency /(8bits*2))*Data_lane_number&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now&lt;SPAN&gt;&amp;nbsp;the only reference to &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt; in IMX6SDLRM is in table 18.4 System Clocks under &lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CORE&lt;/SPAN&gt;.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Turns out that the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt; is&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu_hsp_clock&lt;/SPAN&gt;&amp;nbsp;for the iMX6SDL and that the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;hsp_clk&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;gt;&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt;/0.9 rule only applies to iMX6DQ.&amp;nbsp; As stated &lt;A _jive_internal="true" href="https://community.nxp.com/thread/356520"&gt;here in question 2&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From table 42-1 in the IMX6SDLRM the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;pixel_clk&lt;/SPAN&gt; root is set to&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu1_ipu_hsp_clk_root&lt;/SPAN&gt;.&amp;nbsp;&amp;nbsp;Just checking the Linux &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;clk_summary&lt;/SPAN&gt; did not reveal this clocks frequency,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;cat /sys/kernel/debug/clk/clk_summary | grep hsp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can see the routing for this clock in 18.3 of the IMX6SDLRM which shares with&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_PIXEL_CLK&lt;/SPAN&gt;...&amp;nbsp; Y&lt;SPAN&gt;ou wont be able&amp;nbsp;to find "&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;pixel"&lt;/SPAN&gt; in the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;clk_summary&lt;/SPAN&gt; either.&amp;nbsp; There is an &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu1_pclk[01]&lt;/SPAN&gt; entry however.&amp;nbsp; ...Taking a step back,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;CSCDR3[IPU1_HSP_CLK_SEL] --&amp;gt;&amp;nbsp;CSCDR3[IPU1_HSP_PODF] --&amp;gt;&amp;nbsp;IPU1_HSP_CLK_ROOT &amp;amp;&amp;nbsp;MIPI_PIXEL_CLK&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;^--&amp;gt; PFD1(540),&amp;nbsp;MMDC CH0, PFD2(396), or PLL3(480) / 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Turns out that the these two clocks are,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;CSCDR3[0x020C403C] =&amp;nbsp;0x00014e41&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;ipu1_hsp_clk_sel = 0x3 (540M PFD)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;ipu1_hsp_podf&amp;nbsp; &amp;nbsp; = 0x1 (/2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;==&amp;gt; 540/2 = 270 MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This clock can be read from the terminal,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;$&amp;nbsp;cat /sys/kernel/debug/clk/clk_summary | grep -E "ipu1_sel|ipu1_podf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;ipu1_sel 0 1 540000000 0 0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ipu1_podf 0 1 270000000 0 0 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;So&amp;nbsp;&lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IPU1_HSP_CLK_ROOT&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_PIXEL_CLK&lt;/SPAN&gt; are 270MHz which is the maximum speed for these clocks.&amp;nbsp; Now we can confirm the condition mentioned above,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;IPU1_HSP_CLK (&lt;STRONG&gt;270 MHz&lt;/STRONG&gt;) &amp;gt; 900 MHz / (8 (bits/cycle) x 2 (DDR)) x 2 (Lanes) = &lt;STRONG&gt;112.5&amp;nbsp;MHz&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pressing on, the IPU must be configured.&amp;nbsp; The goal is to transfer the camera image directly to memory since the IPU cannot process Bayer/Raw pixel format.&amp;nbsp; This is okay since the GPU can be used to convert to other formats (more on that later).&amp;nbsp; So the goal is to go from&amp;nbsp;CSI2IPU --&amp;gt; SMFC --&amp;gt; IDMAC --&amp;gt; GPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First confirm that&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IOMUXC_GPR1[MIPI_IPU1_MUX]&lt;/SPAN&gt; is &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0&lt;/SPAN&gt; for "enable MIPI to IPU1 CSI0—the virtual channel is fixed to 0".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2018 15:27:36 GMT</pubDate>
    <dc:creator>natesigrist</dc:creator>
    <dc:date>2018-05-16T15:27:36Z</dc:date>
    <item>
      <title>iMX6[DL] Troubleshooting MIPI CSI2 and Working with Bayer</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761688#M118330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;Does&amp;nbsp;&lt;SPAN&gt;CCM_ANALOG_PLL_VIDEO need to be configured for iMX6DL?&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Is the bandwidth (based on 2.3.1 in &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf" style="color: #2989c5; text-decoration: none;"&gt;AN5305&lt;/A&gt;):&lt;BR /&gt; 1920x1080 (pixels/frame) x 10 (bits/pixel) / 8 (bits/cycle) x30 (frames/second) x 1.35 =&amp;nbsp;105 MHz;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(This post is still being written.&amp;nbsp; I &lt;EM&gt;WILL&lt;/EM&gt;&amp;nbsp;explain how to get a working Bayer conversion at 30fps!)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an attempt to capture a complete guide on working with the iMX6 (specific to DL) MIPI CSI2 camera that outputs Bayer format (10-bit).&amp;nbsp; I will attempt to keep it up to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll start out with our current configuration,&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; width: 67.0426%;"&gt;&lt;TBODY&gt;&lt;TR style="height: 19px;"&gt;&lt;TD style="width: 27.4409%; height: 19px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Sensor&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 19px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;OV5675&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Pixel Format&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Bayer 10-bit&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Targeted Resolution&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;1920x1080&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Targeted Frame Rate&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;30 FPS&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Lanes&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Clock (Reference Manual)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;900 MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Pixel Clock (Reference Manual)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;112.5 MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;VSync&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;No additional pins / Read from MIPI packet&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;iMX6DL path&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CSI2--&amp;gt;MIPI--&amp;gt;SMFC--&amp;gt;IMDAC--&amp;gt;GPU&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MIPI Packet format (reg. 0x4814)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0x2A&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Virtual Channel&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 27.4409%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CSI clock source&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 34.5591%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;CLKO =&amp;gt; 24MHz&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD colspan="2" style="width: 62%; height: 25px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;git clone&amp;nbsp;git://git.freescale.com/imx/linux-imx.git -b&amp;nbsp;imx_4.9.11_1.0.0_ga&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From 2.3.1 in the &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf"&gt;AN5305&lt;/A&gt; document describes the payload as being 16-bits wide and 8-bits per cycle.&amp;nbsp; For Bayer 10-bit one clock cycle can send,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;10 (bits/pixel) /&amp;nbsp;8 (bits/cycle) = 5/4 (cycles/pixel)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Camera drives the MIPI clock and can be calculated,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Bandwidth: (must be &amp;lt; 125 MHz)&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;1920x1080 (pixels/frame) x 10 (bits/pixel) / 8 (bits/cycle) x30 (frames/second) x 1.35 =&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;105&lt;/SPAN&gt;&amp;nbsp;MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;MIPI D-PHY&amp;nbsp;Data Rate:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;105&amp;nbsp;MHz x&amp;nbsp;8&amp;nbsp;(bits/cycle) =&amp;nbsp;840 Mb/s&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;MIPI Clock:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN&gt;840&lt;/SPAN&gt;&amp;nbsp;Mb/s / 2 (lanes) / 2 (reads/bit DDR) =&amp;nbsp;210 MHz &amp;lt;&amp;nbsp;900 MHz (actual)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;MIPI_CSI2_PHY_TST_CTRL1:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;900 MHz (0x34)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Turns out I was relying too much on a crappy oscilloscope that read 450 MHz when the actual speed was 900 MHz.&amp;nbsp; Now the 'calibrated' MIPI D-PHY clock can be set according to table 4 in the &lt;A href="https://www.nxp.com/docs/en/application-note/AN5305.pdf"&gt;MIPI-CSI2 Guide&lt;/A&gt;.&amp;nbsp; This works out to be &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x34&lt;/SPAN&gt;.&amp;nbsp; This assumes the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ref_clock&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;PLL3&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;VIDEO_27M_CLK_ROOT&lt;/SPAN&gt;) is at 27MHz.&amp;nbsp; &lt;SPAN style="text-decoration: line-through;"&gt;This can be verified by checking &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI_PHY_STATE&lt;/SPAN&gt;&lt;/SPAN&gt;, (This cannot be verified reliably but may give some clues)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Make sure clocks are enabled */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;clk_prepare_enable(info-&amp;gt;cfg_clk);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; clk_prepare_enable(info-&amp;gt;dphy_clk);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Set lanes to 2 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, info-&amp;gt;lanes - 1, MIPI_CSI2_N_LANES);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Low is active for the following */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0x0, MIPI_CSI2_PHY_SHUTDOWNZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x0, MIPI_CSI2_DPHY_RSTZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x0, MIPI_CSI2_CSI2_RESETN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Sequence required to 'calibrate' MIPI D-PHY clock */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0x00000001, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000002, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00010044, MIPI_CSI2_PHY_TST_CTRL1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000034, MIPI_CSI2_PHY_TST_CTRL1);&amp;nbsp;&amp;nbsp;&amp;nbsp;/* &amp;lt;--&amp;nbsp;900 MHz */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000002, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0x00000000, MIPI_CSI2_PHY_TST_CTRL0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Put back high to enable MIPI D-PHY */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_PHY_SHUTDOWNZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_DPHY_RSTZ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt; mipi_csi2_write(info, 0xffffffff, MIPI_CSI2_CSI2_RESETN);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/***** Put Camera sensor into MIPI STOPSTATE&amp;nbsp;*****/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/* Wait Camera MIPI lines to be in state LP-11 (STOPSTATE) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;while (i++&amp;lt;10 &amp;amp;&amp;amp; ((status = mipi_csi2_dphy_status(mipi_csi2)) &amp;amp; 0x430) != 0x430)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;msleep(10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;if (i &amp;gt;= 10) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;dev_err(dev, "Error w/ MIPI CSI2 clock (0x%08x)\n", status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;return -1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;/***** Re-enable the Camera sensor here *****/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 11px;"&gt;i = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; /* Wait for MIPI stable */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; while (i++&amp;lt;10 &amp;amp;&amp;amp; ((status1 = mipi_csi2_get_error1(mipi_csi2)) ||&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 150px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;(&lt;SPAN&gt;status2 = mipi_csi2_get_error2(mipi_csi2)&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;msleep(10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;/* In case it was missed and to satisfy the compiler. */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;&lt;SPAN&gt;status2 = mipi_csi2_get_error2(mipi_csi2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;if (i &amp;gt;= 10) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;dev_err(dev, "mipi csi2 can not reveive data correctly! (0x%08x)\n", status);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt; return -1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 11px; font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still get errors from &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI_ERROR1|2&lt;/SPAN&gt; then increase the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CSI2_PHY_TST_CTRL1&lt;/SPAN&gt; speed.&amp;nbsp; The MIPI D-PHY&amp;nbsp;should have no problems if set above the measured/calculated value.&amp;nbsp; After the camera has been enabled you may notice&amp;nbsp;&lt;SPAN&gt;MIPI_CSI_PHY_STATE changing states between &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00000330&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00000300&lt;/SPAN&gt; as data is being fed into the MIPI D-PHY.&amp;nbsp; Probing with an oscilloscope should also reveal MIPI packets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you do not see any packet being transmitted then there is a good chance that your camera is not configured correctly.&amp;nbsp; The&amp;nbsp;OmniVision&amp;nbsp;cameras are known to not transmit when incorrectly configured.&amp;nbsp; Try configuring the camera for just sending test images.&amp;nbsp; For the OV5675, write &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x80&lt;/SPAN&gt; to register&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x4503&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It&amp;nbsp;is recommended that the camera sensor be placed into the MIPI &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;STOPSTATE&lt;/SPAN&gt;.&amp;nbsp; The OV5675 can be set to this state by disabling the software i.e. writing &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x00&lt;/SPAN&gt; to register &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x0100&lt;/SPAN&gt;.&amp;nbsp; Optionally, restart the OV5675's software by writing &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x01&lt;/SPAN&gt; to register &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0x0103&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I initially decided to configure the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CCM_ANALOG_PLL_VIDEO&lt;/SPAN&gt; clock since it is mentioned in the &lt;STRONG&gt;MIPI-CSI2 Peripheral&lt;/STRONG&gt; document example (link was provided&amp;nbsp;above).&amp;nbsp; The&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CCM_ANALOG_PLL_VIDEO&lt;/SPAN&gt;&amp;nbsp;clock&amp;nbsp;(a.k.a. PLL5 - default 630 MHz) and can be adjusted &lt;SPAN&gt;by (18.5.1.3.4 Audio / Video PLL from IMXSDLRM),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;PLL5 output frequency = Fref * (DIV_SELECT + NUM/DENOM)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the clock is connected to the display output, I decide NOT to continue down this path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;The next step is configuring the CSI-2/IPU Gasket.&amp;nbsp; I might be wrong here, but according to&amp;nbsp;38.4.3.6.2 in the &lt;/SPAN&gt;&lt;A href="https://www.nxp.com/doc/IMX6SDLRM"&gt;Application Processor Reference Manual&lt;/A&gt;&lt;SPAN style="color: #800000;"&gt;: non-gated mode should be selected for MIPI.&amp;nbsp; I am uncertain if &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;CSI2IPU_SW_RST[CLK_SEL]&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IPU_CSI0_SENS_CONF[CSI0_EXT_VSYNC]&lt;/SPAN&gt; are related.&amp;nbsp; According to &lt;A _jive_internal="true" href="https://community.nxp.com/thread/432525"&gt;this post&lt;/A&gt; the VSYNC is not required.&amp;nbsp; I know they are not the same thing, however something must be used to determine the EOF (End Of Frame).&amp;nbsp; The EOF and VSYNC&amp;nbsp;should come from the MIPI [short] packets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the pixel clock between the gasket and IPU must be configured.&amp;nbsp; Documentation seems to be limited on exactly how to do this.&amp;nbsp; Here is one confusing line provided by NXP,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;hsp_clk &amp;gt; ccm_pixel_clk/0.9 &amp;gt; (mipi_clk_lane frequency /(8bits*2))*Data_lane_number&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now&lt;SPAN&gt;&amp;nbsp;the only reference to &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt; in IMX6SDLRM is in table 18.4 System Clocks under &lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_CORE&lt;/SPAN&gt;.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Turns out that the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt; is&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu_hsp_clock&lt;/SPAN&gt;&amp;nbsp;for the iMX6SDL and that the&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;hsp_clk&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;gt;&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ccm_pixel_clk&lt;/SPAN&gt;/0.9 rule only applies to iMX6DQ.&amp;nbsp; As stated &lt;A _jive_internal="true" href="https://community.nxp.com/thread/356520"&gt;here in question 2&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From table 42-1 in the IMX6SDLRM the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;pixel_clk&lt;/SPAN&gt; root is set to&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu1_ipu_hsp_clk_root&lt;/SPAN&gt;.&amp;nbsp;&amp;nbsp;Just checking the Linux &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;clk_summary&lt;/SPAN&gt; did not reveal this clocks frequency,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;cat /sys/kernel/debug/clk/clk_summary | grep hsp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can see the routing for this clock in 18.3 of the IMX6SDLRM which shares with&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_PIXEL_CLK&lt;/SPAN&gt;...&amp;nbsp; Y&lt;SPAN&gt;ou wont be able&amp;nbsp;to find "&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;pixel"&lt;/SPAN&gt; in the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;clk_summary&lt;/SPAN&gt; either.&amp;nbsp; There is an &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ipu1_pclk[01]&lt;/SPAN&gt; entry however.&amp;nbsp; ...Taking a step back,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;CSCDR3[IPU1_HSP_CLK_SEL] --&amp;gt;&amp;nbsp;CSCDR3[IPU1_HSP_PODF] --&amp;gt;&amp;nbsp;IPU1_HSP_CLK_ROOT &amp;amp;&amp;nbsp;MIPI_PIXEL_CLK&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;^--&amp;gt; PFD1(540),&amp;nbsp;MMDC CH0, PFD2(396), or PLL3(480) / 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Turns out that the these two clocks are,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;CSCDR3[0x020C403C] =&amp;nbsp;0x00014e41&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;ipu1_hsp_clk_sel = 0x3 (540M PFD)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;ipu1_hsp_podf&amp;nbsp; &amp;nbsp; = 0x1 (/2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;==&amp;gt; 540/2 = 270 MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This clock can be read from the terminal,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;$&amp;nbsp;cat /sys/kernel/debug/clk/clk_summary | grep -E "ipu1_sel|ipu1_podf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;ipu1_sel 0 1 540000000 0 0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ipu1_podf 0 1 270000000 0 0 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;So&amp;nbsp;&lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IPU1_HSP_CLK_ROOT&lt;/SPAN&gt; and &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MIPI_PIXEL_CLK&lt;/SPAN&gt; are 270MHz which is the maximum speed for these clocks.&amp;nbsp; Now we can confirm the condition mentioned above,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; font-size: 13px;"&gt;IPU1_HSP_CLK (&lt;STRONG&gt;270 MHz&lt;/STRONG&gt;) &amp;gt; 900 MHz / (8 (bits/cycle) x 2 (DDR)) x 2 (Lanes) = &lt;STRONG&gt;112.5&amp;nbsp;MHz&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pressing on, the IPU must be configured.&amp;nbsp; The goal is to transfer the camera image directly to memory since the IPU cannot process Bayer/Raw pixel format.&amp;nbsp; This is okay since the GPU can be used to convert to other formats (more on that later).&amp;nbsp; So the goal is to go from&amp;nbsp;CSI2IPU --&amp;gt; SMFC --&amp;gt; IDMAC --&amp;gt; GPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First confirm that&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;IOMUXC_GPR1[MIPI_IPU1_MUX]&lt;/SPAN&gt; is &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;0&lt;/SPAN&gt; for "enable MIPI to IPU1 CSI0—the virtual channel is fixed to 0".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 15:27:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761688#M118330</guid>
      <dc:creator>natesigrist</dc:creator>
      <dc:date>2018-05-16T15:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6[DL] Troubleshooting MIPI CSI2 and Working with Bayer</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761689#M118331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" data-content-finding="Community" data-userid="245798" data-username="natesigrist" href="https://community.nxp.com/people/natesigrist"&gt;Nate&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i.MX6DL doesn't support ISP function, so it requires camera module supports ISP with the function of image format conversion. I checked OV5675 from OV website, and fount it's output format is RAW, I am not sure if ISP has been added to camera module you are using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; By default, our linux BSP supports OV5642, OV5640 etc, these 2 camera modules' output format are both YUV.&amp;nbsp; I have ever ported OV5645 to I.MX6Q/I.MX6DL, see the link, please!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-172999"&gt;Porting ov5645 to android jb4.2.2&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is from OV official website:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/746iB75BAFE16488E844/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;&lt;P&gt;TIC weidong sun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 03:27:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761689#M118331</guid>
      <dc:creator>weidong_sun</dc:creator>
      <dc:date>2018-06-05T03:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6[DL] Troubleshooting MIPI CSI2 and Working with Bayer</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761690#M118332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is ISP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know it is a long post, but I stated above that the camera is Bayer 10-bit and that I intend to use the GPU to do the color conversion.&amp;nbsp; The only course to take here is to get the image data to&amp;nbsp;the GPU as quickly as possible (Camera --&amp;gt; MIPI --&amp;gt; IDMAC --&amp;gt; RAM/GPU).&amp;nbsp; Skip any of the IPU functions as they are not helpful here.&amp;nbsp; This is most likely going to be the trend with this processor since it is difficult to find a camera sensor that outputs in other formats.&amp;nbsp; Besides, Bayer is a common format that should have been supported by the iMX6 processor family.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At present, I have a working board with a camera that outputs YUV422 but is capable of outputing Bayer 10-bit.&amp;nbsp; I will try to get this working before I come back to this post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 15:21:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761690#M118332</guid>
      <dc:creator>natesigrist</dc:creator>
      <dc:date>2018-06-05T15:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6[DL] Troubleshooting MIPI CSI2 and Working with Bayer</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761691#M118333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got hit with the dreaded "Assumed Answered" again.&amp;nbsp; What gives NXP?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 19:08:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-DL-Troubleshooting-MIPI-CSI2-and-Working-with-Bayer/m-p/761691#M118333</guid>
      <dc:creator>natesigrist</dc:creator>
      <dc:date>2018-06-11T19:08:49Z</dc:date>
    </item>
  </channel>
</rss>

