Author Topic: IMX219 MIPI CSI Camera FPGA rx implementation, Datasheet Discrepancy  (Read 168 times)

0 Members and 1 Guest are viewing this topic.

Offline RoadRunner

  • Frequent Contributor
  • **
  • Posts: 269
  • Country: de
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.


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/diy-imx219-4-lane-mipi-breakout-board-raspberry-pi-camera-fpga-4-lane-mipi-csi.html



I have just published a Project with Lattice FPGA interfacing to IMX219 Raspberry pi camera.

As this is a RAW camera sensor , to get color outof the image Debayer / demosaic need to be performed .

But the problem is datasheet of the camera is quite ambiguous when it comes to what bayer patter this camera has. IMX219 datasheet incorrectly mention output as to be either GBRG or RGGB. but linux driver code says  IMX219 Camera only output BGGR ,  MEDIA_BUS_FMT_SBGGR10_1X10 .

Problem is if i set FPGA's debayer filter input format to BGGR live image comes good in colors. but Test patterns which are defined in camera datasheet have R and B channels exchanged.
And when i set FPGA's debayer filter type to RGGB test pattern comes exactly as the camera datasheet but live image have R and B channels exchanged so what ever is actually blue will look red and what ever is red will look blue in live image.

Image attached to this post shows the issue.


Datasheet can be found here.
https://github.com/circuitvalley/mipi_csi_receiver_FPGA/tree/master/Camera%20Datasheet

My question is anyone worked with this kind of camera or may be this exact camera can shine some light on what is wrong.

I have published two youtube videos, but i am still new bie to videos.






Regards
« Last Edit: February 16, 2020, 10:04:01 pm by RoadRunner »
 
The following users thanked this post: lukego

Offline RoadRunner

  • Frequent Contributor
  • **
  • Posts: 269
  • Country: de
Re: IMX219 MIPI CSI Camera FPGA rx implementation, Datasheet Discrepancy
« Reply #1 on: February 25, 2020, 07:20:38 pm »
Just in case if someone is interested i have found solution to the problem with help from Raspberry pi. Solution is Flipping image changes the bayer pattern also but it only affect data from sensor array. As test pattern is auto generated test pattern bayer pattern is fixed.

If you some one is interested i have made another video showing quality and frame rate up to 1000FPS at low resolution.






As this camera sensor does not have auto exposure or white balance control. I will be possibly implementing some algorithm in FPGA. If Someone has any know how. How to approach  problem of auto exposure in FPGA please shine some light.

Regards
« Last Edit: February 25, 2020, 07:41:00 pm by RoadRunner »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf