AtomicSpider
Posts: 2
Joined: Thu May 19, 2016 1:41 pm

Raspberry Pi Camera CSI Interface details

Thu May 19, 2016 2:06 pm

Hi guys,

I'm working on a project where I need to stream video from Raspberry pi camera (RPI 8MP Camera V2) to a PC (the stream can be low resolution and low fps, as low as 1 frame per second). I cannot use Raspberry Pi for this project, rather I need to use basic microcontrollers/microprocessors etc.

I have a little idea about CSI interface, here's what I know so far:

-> RPI camera has two data lanes, one clock lane and one I2C port
-> I2C port is used to configure camera and send commands and the image/video data is received through data lanes.

Here are some questions:

-> What is the working voltage of RPI camera? (I could not find any data sheet)
-> What is the device address of RPI Camera? Also, a list of I2C command instructions.
-> Now, I think I can use any basic micro controller to send I2C commands but how do I handle the data from the data lanes? Which microcontroller/microprocessors would be suitable for this purpose?
-> Would I need any external buffer/ram chip for receiving data?


I know these sound like noob questions but I've never worked with these kind of things and I'd really appreciate any help.

Thanks,

ixc
Posts: 5
Joined: Thu May 12, 2016 6:00 pm

Re: Raspberry Pi Camera CSI Interface details

Thu May 19, 2016 4:43 pm

-> What is the working voltage of RPI camera? (I could not find any data sheet)
you can find pinout, working voltage(3V3) at raspberry pi schematic
https://www.raspberrypi.org/documentati ... chematics/
-> What is the device address of RPI Camera? Also, a list of I2C command instructions.
all data from sony imx219 (eg.: I2C registers) is under NDA

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2921
Joined: Thu Jul 11, 2013 2:37 pm

Re: Raspberry Pi Camera CSI Interface details

Thu May 19, 2016 8:03 pm

The Raspberry Pi camera module is a peripheral intended to connect only to a Raspberry Pi. There is no documentation available on the electrical or programmable interfaces for this peripheral.
Rockets are loud.
https://astro-pi.org

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 14879
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry Pi Camera CSI Interface details

Thu May 19, 2016 8:08 pm

ixc is correct that the datasheet of the IMX219 is under NDA, and unlike the OV5647 there is no leaked version that I'm aware of.

CSI2 is a specialised interface. If your chosen microcontroller doesn't have an appropriate interface you'll be looking at a chip such as Toshiba TC358746 as an interface, and even then you need a suitable parallel interface. There are FPGA implementations of a CSI2 receiver too, but neither are likely to be cheap. The sensor produces data at up to 2Gbit/s - not something that many microcontrollers can handle.

The other side of the issue is that the sensor produces a Bayer image which needs a significant amount of processing to produce the YUV or RGB image that I suspect you're expecting.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: Raspberry Pi Camera CSI Interface details

Fri May 20, 2016 12:25 am

...I've never worked with these kind of things...
As someone who has, here is my advice: the newly updated Raspberry Pi Zero can handle the RPi Camera and I do not think you will be able to find or make anything smaller, cheaper, or lower power that can do that. I mention size, cost and power because I assume that's why you are thinking microcontroller.

The self-contained small/cheap camera devices like dashcams use dedicated processors that are, in essence like a stripped down Raspberry Pi and if you look at their video quality you will find it is substantially inferior to what the RPi can deliver. In general, a microcontroller is not the right tool for the job. You could make your own FPGA design to interface with a CMOS camera sensor. It is possible and people have done it, but it is not a simple task and after some years of work you may end up with something like the Arducam which I find not nearly as good as the RPi camera, for almost any application. The only use case I see for the Arducam is an instant-on camera that has to run off batteries and draw current only during the actual exposure; but you still have to put up with the inferior image quality. If that's your application, better to use the RPi Zero, avoid Linux and program on the bare-metal to reduce the startup time, in my opinion.

I've seen one example of a microcontroller interfacing directly with a modern CMOS sensor, that is the Teensy 3.1 with an Aptina 1 Mpixel monochrome device, he managed to get a very low-res version of the image from it: https://forum.pjrc.com/threads/31029-Fe ... ll-images)

User avatar
Gavinmc42
Posts: 7691
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi Camera CSI Interface details

Fri May 20, 2016 4:22 am

Use the new Zero as serial or USB camera.

Or something like this
http://www.4dsystems.com.au/product/uCAM_II/

or this
http://www.cmucam.org/
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

AtomicSpider
Posts: 2
Joined: Thu May 19, 2016 1:41 pm

Re: Raspberry Pi Camera CSI Interface details

Sun May 22, 2016 2:43 am

ixc wrote:
-> What is the working voltage of RPI camera? (I could not find any data sheet)
you can find pinout, working voltage(3V3) at raspberry pi schematic
https://www.raspberrypi.org/documentati ... chematics/
-> What is the device address of RPI Camera? Also, a list of I2C command instructions.
all data from sony imx219 (eg.: I2C registers) is under NDA
Thanks, I was wondering why I couldn't find anything online.

User avatar
Gavinmc42
Posts: 7691
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi Camera CSI Interface details

Sun May 22, 2016 6:12 am

CSI - MiPi is standard, it is just high speed LVDS.
It is why you can have 1- 2m cables, Adafruit sell them.

Camera sensor I2C commands are the tricky bits.
I did find this, tells you what register values to set.
https://android.googlesource.com/kernel ... o/imx219.c
https://android.googlesource.com/kernel ... o/imx219.h

IMX219 does seem popular, LG use them, mostly xxxx.so blob files.
No point having register addresses and default values if you don't know what the registers do.
Some you could probably figure out and could also sniff the i2c commands.

There are previous IMXxxx sensors, I suspect some/most registers might stay the same.
Look for Android code for IMX111, IMX134 etc
Forensic code digging?
Not impossible, harder things have been done.
I just played with the QPUlib compiler yesterday.
https://github.com/mn416/QPULib
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Camera board”