tytyty
Posts: 38
Joined: Wed Aug 30, 2017 4:40 am

I am transplanting a new sensor to raspberry pi

Wed Aug 30, 2017 6:02 am

HI,
I would like to transplant a new sensor to raspberry pi.The camera sensor is EV76C560.
I'm looking for an example of SENSOR in the raspberry pi kernel,but i can't find it.
If i want to transplant the sensor EV76C560,what should i do?

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

Re: I am transplanting a new sensor to raspberry pi

Wed Aug 30, 2017 10:05 am

I think you're going to struggle with that choice of sensor as according to https://www.e2v.com/content/uploads/201 ... 76C560.pdf it has
Output format 8 or 10 bits parallel plus synchronization
The Pi doesn't have a parallel camera interface, and the bitrate required to implement such is generally going to be too high to use the normal GPIO pins for.
The Pi camera modules use the MIPI CSI-2 interface which there is a dedicated receiver for, and I'm in the process of upstreaming a driver for it.

Secondly that sensor appears to use SPI for control. All the examples I know of in the kernel use I2C for control - there's a whole directory of them in the kernel tree, although they are a mix of parallel and CSI sensors. The corresponding SPI directory has one driver for an SDI serialiser, and another for a DVB-T tuner.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

tytyty
Posts: 38
Joined: Wed Aug 30, 2017 4:40 am

Re: I am transplanting a new sensor to raspberry pi

Thu Aug 31, 2017 3:12 am

HI,
Thank you for your reply.
Firstly ,i already know that through SPI to control registers in the drive.Do I need to do the V4L2 in the drive?
Secondly,OV5647 can be used properly on raspberry pie,but Why can't I find the driver for OV5647 in raspberry pi kernel?
Thirdly, i now want to preview the image or take pictures, using the new SNESOR.Is the test program using C or Python?
Do you have the similar test program for app?

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

Re: I am transplanting a new sensor to raspberry pi

Thu Aug 31, 2017 10:05 am

tytyty wrote:
Thu Aug 31, 2017 3:12 am
HI,
Thank you for your reply.
Firstly ,i already know that through SPI to control registers in the drive.Do I need to do the V4L2 in the drive?
V4L2 is the standard approach for media devices under Linux. Anything else and you need to provide all the supporting framework.

V4L2 supports subdevices, so you normally have one subdevice controlling the sensor, and another controlling the hardware that receives the images and writes it to memory. The subdevice for writing CSI2 to memory is in the process of being upstreamed to the mainline Linux kernel. The sensor subdevice will be up to you if it hasn't been done already by someone else.
tytyty wrote: Secondly,OV5647 can be used properly on raspberry pie,but Why can't I find the driver for OV5647 in raspberry pi kernel?
Because all the control and processing is done in the closed source GPU firmware, and the drivers for the OV5647 and IMX219 sensors are in there.
I'll point you at the PiCamera library docs as it gives a clear explanation of how the Pi camera stack is works, and in particular the "division of labour" section.
tytyty wrote: Thirdly, i now want to preview the image or take pictures, using the new SNESOR.Is the test program using C or Python?
Do you have the similar test program for app?
If you must use a parallel sensor, then you've got a huge amount of work trying to get a driver working, or you need to look at something like the TI SN65LVDS315 chip which will convert parallel to CSI1/CCP2 that is supported by the Pi.

How much expertise do you have in image processing? If very little then you'll have a step learning curve and a long way to go.
Assuming you aren't looking at a mono sensor, then you'll be dealing with Bayer filters in the sensor, so now we have to control black level, gains, shutter speed, white balance, demosaic the image, and numerous other stages. It is not a trivial task, and you may or may not be able to utilise the hardware blocks.

There is an alternative to V4L2 written at a point where I wasn't sure we could write a fully open driver for the receiver peripheral. viewtopic.php?f=43&t=109137 details the MMAL vc.ril.rawcam component, and with the associated raspiraw app you can extract the raw images from CSI2 sensors. It can also runs the images through the "vc.ril.isp" component that wraps the ISP (Image Sensor Pipeline), but there aren't that many controls exposed on that yet for full control over the processing.
I'd suggest having a look through that so you can make a judgement call as to whether undertaking this is really a sensible option.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

tytyty
Posts: 38
Joined: Wed Aug 30, 2017 4:40 am

Re: I am transplanting a new sensor to raspberry pi

Tue Sep 05, 2017 1:18 am

HI,
Thank you for your reply.
My main problem is that I can't write EV76C560's drive for raspberry pi.Can you provide a suitable driver example for me to refer to?
I always think camera drive in raspberry pie is different from regular。
My idea now is to write this EV76C560's driver first.

Return to “General discussion”