OpenWrt Forum Archive

Topic: Connecting MIPI camera from smartphone to devices running openWRT

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

My message is mainly addressed to coin-size computer hardware designers (something like VoCore, etc.). But also i would be happy to discuss this idea. Many old smartphones have an excellent camera module, for example Iphone camera module with autofocus. Unfortunately those cameras only provide MIPI CSI-2 interface. In theory such cameras could be connected to something like Raspberry Pi with bcm2835 processor, because it provides MIPI CSI-2 input port. It would be great

At the same time some excellent processors like mt7688 do not provide MIPI CSI-2 interface. There are many new coin-sized computers running OpenWrt, but without a decent camera support.

But there is an alternative way: many devices running OpenWrt provide USB port, and UVC devices could be connected to this port. Somebody would say: just buy an USB web camera and connect it. But I personally have two old smartphones, which costs nothing and only could be recycled. But both of them contain decent 5 megapixel camera module with autofocus. Those camera modules are in perfect condition (protected all time with smartphones enclosure). I agree to recycle my smartphones, but wait! I want to extract camera module and use it. I do not want this module to be melted down and recycled as some small piece of metal, plastic, etc.. It would be useless waste of energy, increase of pollution on Earth. I rather use it as wireless camera with stunning HD videos and photos.

It would be really great if some hardware developer make a breakout board containing some kind of USB Camera Controller with MIPI support. I am mostly interested in USB Camera Controllers with MIPI support, because all modern smartphone camera modules does not support DVP parallel interface.

I have an idea of connecting camera modules from old smartphones to computers/routers running openWRT using small breakout boards. Unfortunately to my knowledge there is no such board available.

Procedure may be as follows:

1. I2C sniffer is connected to smartphone MIPI camera configuration interface Smartphone must be powered on, then you configure it for best image quality in photo/video recording settings. All configuration registers sequence is saved to file (modern CMOS sensors have built-in microcontrollers with configuration registers)
2. MIPI camera is extracted from smartphone and connected to some breakout board based on USB Camera Controller chip. This chip could be instantly connected to USB port of OpenWrt running computer and provide UVC device access to camera module through V4L in linux.
3. if particular MIPI camera is not supported by USB Camera Controller IC, there is a way:
USB Camera Controller IC internal firmware contains configuration register sequences for particular MIPI cameras.
If USB Camera Controller IC SDK is available, those sequences could be altered (remember sniffed I2C data in first step).

It is well known that CMOS sensor manufacturers do not provide documentation of their products to hobbyists. Usually peoples stuck with obtaining right configuration sequence for CMOS camera modules. Some processors provide MIPI/CSI-2 interface, but it is either is undocumented or not available for hobby usage. Alternative way is to use a working smartphone and sniff I2C configuration data. It is obvious that if I2C configuration sequence is recorded and then played back to the CMOS sensor, it will start to transmit BAYER or MJPEG data over MIPI lanes.

The only thing left is to find good USB Camera Controller IC with SDK, put I2C configuration sequence into USB Camera Controller IC and do some fixes to UVC image format to ensure correct bridging between MIPI and USB UVC format.

As USB Camera Controller IC is a mass production chip, which could be found in millions of notebooks, webcameras, tablet PCs, prices of such breakout board could be very low. Also using such IC with USB hub IC allows to develop coin-sized computer with MIPI camera support and still having USB port available.

Here is a list of USB camera controllers I found:

USB2.0 camera controllers:

sm3732 - USB 2.0 PC Camera Controller (QFN40) MIPI: unknown
au3830 - USB 2.0 WEB Camera Controller (LQFP,QFN) MIPI: unknown
AU3822U - USB 2.0 NB-Cam Controller MIPI: unknown
AU3826 - USB 2.0 NB-Cam Controller MIPI: yes
M5608T - USB 2.0 NB-Cam Controller MIPI: unknown
AU3841 - USB 2.0 NB-Cam Controller MIPI: unknown
SN9C292A - USB2.0 H.264 Video Encoding Camera Controller (65pin LGA) MIPI: yes
SN9C291B - USB2.0 H.264 Video Encoding Camera Controller MIPI: yes
SN9C270M - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: yes
SN9C271M - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: yes
SN9C281M - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: yes
SN9C281A - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: no
SN9C270A - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: no
SN9C271A - USB 2.0 High-Speed (HS) compatible PC Camera controller MIPI: no
SN9C263 - USB 2.0 compatible PC Camera controller MIPI: no
SN98600 - SONIX SN98600 / 98601 / 98610 IP Camera SoC MIPI: yes
GL865A - USB 2.0 UVC/MJPG Camera Controller MIPI: yes
GL864A - USB 2.0 UVC Camera Controller MIPI: unknown
GL862EC - USB 2.0 PC Camera Controller MIPI: unknown


USB3.0 camera controllers (with MIPI interface):

RTS5825 - USB3.0 PC Camera Controller with Image Signal Processing and MJPEG Encoder
cyusb3064 - EZ-USB CX3 Programmable MIPI CSI-2 to USB 3.0 Camera Controller


IP camera SOC:

S3LM IP Camera SoC MIPI: yes
Hi3516A MIPI: yes
Hi3518 MIPI: no
GM8139 - High-Performance Solution for H.264 IP Camera Application MIPI: yes
GM8138/8138S - Cost-Effective Solution for H.264 IP Camera Application MIPI: yes
GM8136S/8135S - Economic H.264 IP Camera Application MIPI: yes

Mozart 330s Mozart 370s Mozart 385s Mozart 390s Mozart 395s - MIPI: unknown
R288C,R292C - H.264 Codec SoC with Dual Video Input Channel MIPI: yes
M388C,M392C - H.264 Encoder SoC with Integrated Fisheye Correction Function MIPI: yes

FH8810 - FH8810 high performance SoC for HD IPC - MIPI: yes
FH8830 - 2M/3M High Performance Camera SoC - MIPI: yes
FH8812 -  High Performance SoC for IP Camera - MIPI: yes
FH8620 - Low-Power、High Performance Wireless Camera SoC
FH8610 - FH8610: Low Cost、High Performance Wireless Camera SoC
FH8550M - High Performance 1080P ISP for CCTV - MIPI: yes

note that it is not full list. There are currently around 10 manufacturers and 100 of chip models.
Maybe it is good idea to stick with newer ones (USB3.0) to connect MIPI cameras from latest smartphones (8 megapixels and up):
Realtek RTS5825
Genesys logic GL865A

There is also cyusb3064 - EZ-USB CX3 Programmable MIPI CSI-2 to USB 3.0 Camera Controller
but it is more suited to high-end camera products, so it is more advanced and more _expensive_.

Some of USB camera controllers could compress bayer data to MJPEG/H264/etc.
So may be >8megapixel sensors could be connected over USB2.0 (as current devices running OpenWRT only provide USB2.0 port).

(Last edited by mrfdsp on 27 Dec 2016, 18:37)

If (most of) the rest of the phone still works, I think there are apps to convert an old smartphone into an IP camera.  Or you could write one.

The discussion might have continued from here.