EEVblog Electronics Community Forum

Electronics => Open Source Hardware => Topic started by: RoadRunner on February 16, 2020, 09:43:13 pm

Title: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on February 16, 2020, 09:43:13 pm
Since quite some time i have been involved with different type of camera sensors and interfacing to to various processors. In my recent project i took Raspberry PI Camera Sony IMX219 MIPI CSI and interfaced to FPGA and streamed over USB3.0 Link.

There are many MIPI CSI to parallel bridge designs available from many FPGA manufacturer but none of them are open source they either have some blackbox modules or uses some very application specific processor. So i made this design with cheap Lattice MachXO3LF FPGA.

I made my own camera board around the sensor from raspberry pi. As turned out IMX219 is 4 lane camera but raspberry pi's board only uses 2 lane mipi and I wanted 4 so that i can run mipi clock slower but still get full performance out of the camera.

This project is still work in progress, Image Quality, Maximum frame rate and Max resolution need improvement.
Project has seen few improvents since start, Can capture From VGA to Full 8Mpixel Video Stream, Frame rate ranging from 15 to 1000 FPS.
Now auto exposure and auto white blance correction is the next target to further improve Image Quality.

more details about the project can be found on my blog

https://www.circuitvalley.com/2020/02/imx219-camera-mipi-csi-receiver-fpga-lattice-raspberry-pi-camera.html (https://www.circuitvalley.com/2020/02/imx219-camera-mipi-csi-receiver-fpga-lattice-raspberry-pi-camera.html)

https://www.circuitvalley.com/2020/02/diy-imx219-4-lane-mipi-breakout-board-raspberry-pi-camera-fpga-4-lane-mipi-csi.html (https://www.circuitvalley.com/2020/02/diy-imx219-4-lane-mipi-breakout-board-raspberry-pi-camera-fpga-4-lane-mipi-csi.html)


I have published few youtube videos, but i am still new bie to videos.  Test are shown sensor FPS from 15 To 1000FPS from this tiny camera

https://www.youtube.com/watch?v=HxytsTGWODs (https://www.youtube.com/watch?v=HxytsTGWODs)


https://www.youtube.com/watch?v=GFmE3KYa5zs (https://www.youtube.com/watch?v=GFmE3KYa5zs)


https://www.youtube.com/watch?v=uRaHXo-Zu90 (https://www.youtube.com/watch?v=uRaHXo-Zu90)
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: laugensalm on February 27, 2020, 02:56:19 pm
That's some solid work, nice job! Good to see more MIPI implementations out in the open source..
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Scrts on March 03, 2020, 05:40:18 pm
Good job! If it was me, I would probable have gone with Cypress CX3...
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on March 04, 2020, 08:16:47 am
Good job! If it was me, I would probable have gone with Cypress CX3...

Yes I thought of doing that as well. But there are few issues.
I wanted to have this camera as UVC so that I need not to implement any custom solution on PC side.  As this camera only output raw and UVC does not support RAW. So if I would have gone with CX3. I need to implement a application on the PC side to convert from RAW to usable format. Then i would have also need to implement my solution for controlling  camera exposure and gain.

Second problem was availability of development board, FX3 board costs just a fraction of what a CX3 board goes for. Making custom board was a somewhat hassle with BGA and stuff.

But one very significant advantage CX3 would have offered, MAX theoretical bandwidth is higher compare to FX3. As with FX3 it is limited by 100Mhz 32bit GPIF,  while CX3 does have this bottle neck so can go higher up to what USB 3.0 Allows.

Regards
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoGeorge on March 04, 2020, 08:39:32 am
Nice!   :-+

Couldn't spot any, does your blog have an RSS/ATOM feed, please?  I would like to subscribe to it.
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on March 04, 2020, 08:57:39 am
Nice!   :-+

Couldn't spot any, does your blog have an RSS/ATOM feed, please?  I would like to subscribe to it.

Thanks
I have just added subscription button to Top Right hand side.

Hers is the link
http://feeds.feedburner.com/circuitvalley/bkTd (http://feeds.feedburner.com/circuitvalley/bkTd)
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoGeorge on March 04, 2020, 10:20:20 am
Added, thank you.   :)

Just FYI, my uBlock Origin blocks the two buttons like they were Facebook buttons or something, but I can still read the "Subscribe To Embedded Engineering Blog" label, which is a good hint there might be some blocked content there.  I didn't noticed uBlock to be doing that with feed buttons from other blogs.
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on March 04, 2020, 10:25:29 am
Added, thank you.   :)

Just FYI, my uBlock Origin blocks the two buttons like they were Facebook buttons or something, but I can still read the "Subscribe To Embedded Engineering Blog" label, which is a good hint there might be some blocked content there.  I didn't noticed uBlock to be doing that with feed buttons from other blogs.

Thanks for heads up , will check whats wrong.
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Vcky_electro on March 20, 2020, 06:23:36 pm
Great job.   :clap: :clap: :clap: :clap: 1000fps is really awesome..
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: jackthomson43 on May 03, 2020, 05:22:52 am
Great Job. I just Love the open source stuff. I have once tried to achieve it with Microcontroller (https://www.theengineeringprojects.com/2018/03/introduction-to-microcontrollers.html) but couldn't, for cameras we have to use microprocessors.
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 07:46:12 am
Hi,
I am implementing the imaged display by zynqberry (FPGA) + imx219. The basic implementation scheme  is csi2-rx + vdma + hdmi.
Hoever, the color of the  image on the monitor is bad.
I do not know what I can to improve the quality of the image.
One picture is from my phone and one picture is from FPGA. What should I do to make the picture from FPGA become the picture from my phone?
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 07:56:48 am
 :)
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 07:57:26 am
 :)
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 07:58:01 am
 :)
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on June 09, 2021, 08:58:14 am
Rasperry pi perform some color correction, You can look at pydng project how to fix color. Image with my design was also a bit yellowed and washed out. You can need do color correction and also black level correction. It is going to be a color matrix operation.

Is your design open source ?
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 09:06:14 am
Hi,
I understand. I will try in my further study, for I am a beginner of zynq.
Yes, my project is open source. The board is TE0726-03M zynqberry which provides the csi interface.
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: RoadRunner on June 09, 2021, 09:10:06 am
Hi,
I understand. I will try in my further study, for I am a beginner of zynq.
Yes, my project is open source. The board is TE0726-03M zynqberry which provides the csi interface.

Can you please point out where source is available?
Title: Re: Raspberry PI Camera IMX219 MIPI CSI 4 Lane interface to Lattice FPGA USB 3.0
Post by: Gloria on June 09, 2021, 09:13:09 am
I reference the demo provided by the board.
I would like to share with you if you like.