First successful test

A project log for Raspberry Pi camera on Orange Pi Plus board

Convert MIPI CSI-2 2 lanes into DVP using a FPGA.

jcamdr70jcamdr70 10/09/2016 at 00:110 Comments

The test start by building a bad looking DVP cable than can be inserted into the Orange Pi Plus's camera interface and that split each signal into individual wire that can be connected into the Lattice MachX03 development board. I use a 24 pins 0.5mm spacing cable compatible with the Oraneg Pi Plus camera connector and soldered a wrapping wire on each signal using a microscope. I discovered that the flat cable is not build to survive the temperature required to solder wires on it. With a lot of caution I first heat the wire and then briefly touch the flat cable contact. The wrapping wires are soldered to standard wires that can be connected to headers and covered with thermoretractable sleeve. I protected the fragile par of the assembly with a lot of glue.

Headers need to be soldered into the Lattice MachX03 board. Curiously, the board have a mini USB connector that is obsolete since 2007. Luckily, a Omnivision distributor was kind enough to lend to my a OV5640 development kit, saving me from building an other bad looking cable to connect the OV5647 sensor of the Rasberry PI camera. The OV5640 is not exactly the same sensor as the OV5647 used into the Raspberry Pi camera, but share far enough features to validate this test. The OV5640, support the DVP mode in addition to the MIPI mode, so my first try was to directly connect the OB5640 development kit to the Orange Pi Plus using my kludge cable. I discovered that the cable need copper sheet shielding to work properly up to a clock of about 66MHz. That speed is enough to support low resolutions only. Higher resolutions require higher clock that my cable is unable to carry with enough integrity.

Next stage was to use the FPGA as a bypass of the DVP signals. This is very simple to program into the FPGA and will validate that it can carry the signals to the H3 processor. Again I have to shield the cables with copper sheet. I observed that the clock signals need to be keep away from the data signals to avoid cross-talk.

Finally I connected the OV5640 to the MachXO3 using MIPI CSI-2 twisted pairs instead of the DVP wires. I programmed the FPGA with the appropriate MIPI to DVP IP core from Lattice and started the application "motion" to grab image on the Orange Pi Plus. Since the OV5640 Linux driver for the H3 processor configure the sensor into DVP mode, I used the Omnivision development kit base board as a second I2C master to reprogram the sensor in MIPI mode after the Linux driver. Unfortunately, nothing append even at low resolution.

By comparing the DVP output signals of the FPGA from the DVP output of the OV5640 in DVP mode (that worked), I discovered that the HSYNC and VSYNC signals was not as expected. I need to change the I2C configuration of the Omnivision development board to fix the synchronization signals shape. Now I get an image but highly saturated by green and violet, a typical issue when chroma and luma bytes are swapped. I fixed that by changing an other register of the OV5630 and I started getting good pictures, but only a low resolution.

By doing this test, I learned that FPGA pins used to carry input clock signals need to be carefully selected. Also the MIPI-CSI signals input are supported only on a precise bank of the FPGA. The next stage will be to modify the Linux driver to directly support the MIPI configuration of the sensor to get ride of the second I2C master.