Jump to content

OV5640 camera with Orange Pi


mattday

Recommended Posts

Hi,

 

I got a very similar result for the same camera as @Vladimir Petrovic, but with Orange Pi Zero Plus 2 H3 . 

 [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
sensor_remove ov5640 sd = d5126a80!
... similar later ...

 [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
sensor_remove ov5640 sd = d5be42c0!

And some other addresses like that a couple of other times. Maybe while modprobe or reboot.

Link to comment
Share on other sites

I'm able to use both OV5640 and GC2035 on Orange Pi PC Plus v1.1 with ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i

 

I can't seem to get either GC2035 or OV5640 to work on Orange Pi Zero Plus v1.0 H3 with ARMBIAN 5.38 stable Ubuntu 16.04.3 LTS 3.4.113-sun8i 

 

I noticed there's a change in the circuit schematics:

In Orange Pi PC Plus v1.1, CSI-PWR-EN is on PA17

In Orange Pi Zero Plus v1.0, CSI-PWR-EN is on PA8

 

image.thumb.png.47ecb7c13aa96a72e2153cd3a005bffd.png

Link to comment
Share on other sites

On 6/16/2018 at 2:42 AM, Chen Wang said:

I'm able to use both OV5640 and GC2035 on Orange Pi PC Plus v1.1 with ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i

 

I can't seem to get either GC2035 or OV5640 to work on Orange Pi Zero Plus v1.0 H3 with ARMBIAN 5.38 stable Ubuntu 16.04.3 LTS 3.4.113-sun8i 

 

I noticed there's a change in the circuit schematics:

In Orange Pi PC Plus v1.1, CSI-PWR-EN is on PA17

In Orange Pi Zero Plus v1.0, CSI-PWR-EN is on PA8

 

 

Hi Chen,

 

Can you post your tutorial to use both OV5640 and GC2035 on Orange Pi PC Plus?

Link to comment
Share on other sites

On 6/12/2018 at 12:51 AM, mostly said:

Faced exactly the same issue. The solution is here: 

 

On my on my Opi Zero plus2 H3 I built v4l2loopback with kernel sources, and now after modprobe I have /dev/video0 Hurraaay.

 

But modprobe --remove vfe_v4l2 is still Segmentation fault, and because of that, it can't even shut down properly :(

 

I tried motion and cheese, neither could read video from /dev/video0 , so I'm stuck again. In motion's log I have this:

[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_get_capability: - READWRITE
[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_get_capability: - STREAMING
[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_select_input: name = "loopback", type 0x00000002, status 00000000
[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_select_input: - CAMERA
[1] [WRN] [VID] [Jun 21 14:45:25] v4l2_select_input: Device doesn't support VIDIOC_G_STD
[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_set_pix_format: Config palette index 17 (YU12) doesn't work.
[1] [NTC] [VID] [Jun 21 14:45:25] v4l2_set_pix_format: Supported palettes:
[1] [ERR] [VID] [Jun 21 14:45:25] v4l2_set_pix_format: Unable to find a compatible palette format.
[1] [NTC] [VID] [Jun 21 14:45:25] vid_v4lx_start: Using V4L1
[1] [NTC] [ALL] [Jun 21 14:45:25] image_ring_resize: Resizing pre_capture buffer to 1 items

The code I'm using for enable:

sudo sunxi-pio -m "PA8<1><0><1><1>"
sudo sunxi-pio -m "PE15<1><0><1><0>"
sudo sunxi-pio -m "PE14<1><0><1><1>"
sudo modprobe gc2035
sudo modprobe vfe_v4l2
sleep 5
sudo modprobe -f v4l2loopback devices=2

@Chen WangHow do you tell if the board is a v1.0 or a v1.1 ? Do you use this code for enabling too, or is it with PA17?

Link to comment
Share on other sites

Quite after a lot of reading and trying, I checked back my camera module, and found out, that somewhere in the process, I forgot that I have an ov5640, NOT a gc2035.

So I changed fex to

vip_dev1_mname = "ov5640"

reboot

and run

sudo sunxi-pio -m "PA8<1><0><1><1>"
sudo sunxi-pio -m "PE15<1><0><1><0>"
sudo sunxi-pio -m "PE14<1><0><1><1>"
sudo modprobe ov5640 frame_rate=2
sudo modprobe vfe_v4l2
sleep 5
sudo modprobe -f v4l2loopback

And voila, camera is working on my Orange Pi Zero Plus 2 H3. Thank you Armbian, thank you all :)

Link to comment
Share on other sites

I tried to install ov5640 on orange pi one, 

 

after running 

 

sudo modprobe ov5640 frame_rate=2

sudo modprobe vfe_v4l2

 

then install the https://github.com/avafinger/cap-v4l2

 

i throw this error

 

Quote

./cap 1280 720 4 1 -999 -1 -1
---- cap parameters -----
width: 1280
height: 720
v4l2 buffers: 4
exposure: -999
hflip: -1
vflip: -1
Mode: V4L2_MODE_VIDEO
v4l2: failed to open the camera.

 

Link to comment
Share on other sites

2 minutes ago, Vladimir Petrovic said:

Ok. This is annoying.  Can someone post working fex file for opi one with ov5640 from official oraneg pi seller on alli. I've changed flat cable to mach pins on opi zero and camera module and nothing still. No /dev/video0 and dmesg gives me an no maching chip found. I've tried and twi reg setups from all the posted fex files and still nothing removed and added AF regs but no /dev/video0. I'm afraid that I've burned camera module because the original flat cable was twisted so it was inverted pins. Pics are attached.

IMG_20180714_113005.jpgmodule bought from opi alli shop

IMG_20180714_113434.jpginverted cable that maches pins

IMG_20180714_113015.jpgoriginal and twisted cable

IMG_20180714_113214.jpgoriginal cabele not maches the pins on module and opi one

 

Link to comment
Share on other sites

can you suggest any android image for testing if camera module is not fried? Also i figured out that twi addres does not want to change in bin file made from edited fex. When I write 0x78 in fex it compile to 120 (done bin2fex again on bin file I've created from modified fex)

Link to comment
Share on other sites

To get OV5640 working for your Allwinner H3 based board:

 

Step 1. Update the fex file

The file is usually located in /boot directory, name could be script.bin or *.bin depends on the os. 

Use bin2fex to convert the bin file to fex file. (If you don't have fex2bin, do "apt install sunxi-tools")

 

the fex file is just a text file, search for "[csi0]", it stands for Camera Serial Interface 0.

if you are using Orange Pi Zero Plus2 H3 board with OV5640 camera, you can use the following setting, if you are using a different board, you need to check the board schematic to make sure the pins(port:Pxnn<n><default><default><default>) defined in the fex file are in line with what's in the schematic(you can refer to my previous post in this thread on where in the schematic to check) and update them accordingly.

twi address(vip_dev0_twi_addr), voltage settings(vip_dev1_iovdd_vol,vip_dev1_avdd_vol,vip_dev1_dvdd_vol,vip_dev1_afvdd_vol) are described in OV5640 datasheet(8.3 DC characteristics https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf). 

 

Once done, use fex2bin to convert the fex file to bin file. Reboot the board to load the updated bin file.

[csi0]
vip_used = 1
vip_mode = 0
vip_dev_qty = 1
vip_define_sensor_list = 0
vip_csi_pck = port:PE00<2><default><default><default>
vip_csi_mck = port:PE01<2><default><default><default>
vip_csi_hsync = port:PE02<2><default><default><default>
vip_csi_vsync = port:PE03<2><default><default><default>
vip_csi_d0 = port:PE04<2><default><default><default>
vip_csi_d1 = port:PE05<2><default><default><default>
vip_csi_d2 = port:PE06<2><default><default><default>
vip_csi_d3 = port:PE07<2><default><default><default>
vip_csi_d4 = port:PE08<2><default><default><default>
vip_csi_d5 = port:PE09<2><default><default><default>
vip_csi_d6 = port:PE10<2><default><default><default>
vip_csi_d7 = port:PE11<2><default><default><default>
vip_csi_sck = port:PE12<2><default><default><default>
vip_csi_sda = port:PE13<2><default><default><default>
vip_dev0_mname = "ov5640"
vip_dev0_pos = "rear"
vip_dev0_lane = 2
vip_dev0_twi_id = 2
vip_dev0_twi_addr = 120
vip_dev0_isp_used = 0
vip_dev0_fmt = 0
vip_dev0_stby_mode = 0
vip_dev0_vflip = 1
vip_dev0_hflip = 1
vip_dev0_iovdd = ""
vip_dev0_iovdd_vol = 1800000
vip_dev0_avdd = ""
vip_dev0_avdd_vol = 2800000
vip_dev0_dvdd = ""
vip_dev0_dvdd_vol = 1500000
vip_dev0_afvdd = ""
vip_dev0_afvdd_vol = 0
vip_dev0_power_en = port:PA08<1><default><default><default>
vip_dev0_reset = port:PE14<1><default><default><default>
vip_dev0_pwdn = port:PE15<1><default><default><default>
vip_dev0_flash_en =
vip_dev0_flash_mode =
vip_dev0_af_pwdn =
vip_dev0_act_used = 0
vip_dev0_act_name = "ad5820_act"
vip_dev0_act_slave = 24
vip_dev1_mname = ""
vip_dev1_pos = "front"
vip_dev1_lane = 1
vip_dev1_twi_id = 0
vip_dev1_twi_addr =
vip_dev1_isp_used = 0
vip_dev1_fmt = 1
vip_dev1_stby_mode = 0
vip_dev1_vflip = 0
vip_dev1_hflip = 0
vip_dev1_iovdd = ""
vip_dev1_iovdd_vol = 2800000
vip_dev1_avdd = ""
vip_dev1_avdd_vol = 2800000
vip_dev1_dvdd = ""
vip_dev1_dvdd_vol = 1500000
vip_dev1_afvdd = ""
vip_dev1_afvdd_vol = 2800000
vip_dev1_power_en =
vip_dev1_reset =
vip_dev1_pwdn =
vip_dev1_flash_en =
vip_dev1_flash_mode =
vip_dev1_af_pwdn =

 

Step 2. Load the drivers

 

modprobe ov5640
modprobe vfe_v4l2

 

check dmesg, the normal log should look like this:

[   24.397287] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[   35.772109] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[   35.849649] [OV5640@lex]sensor_init 0x0
[   35.897182] [OV5640@lex]CSI_SUBDEV_STBY_ON!
[   35.906344] [OV5640@lex]sensor_s_release_af
[   35.927791] [OV5640@lex]disalbe oe!

At this point you should have a working /dev/video0

 

 

 

Link to comment
Share on other sites

Spoiler

 

On 7/17/2018 at 8:14 PM, Chen Wang said:

To get OV5640 working for your Allwinner H3 based board:

 

Step 1. Update the fex file

The file is usually located in /boot directory, name could be script.bin or *.bin depends on the os. 

Use bin2fex to convert the bin file to fex file. (If you don't have fex2bin, do "apt install sunxi-tools")

 

the fex file is just a text file, search for "[csi0]", it stands for Camera Serial Interface 0.

if you are using Orange Pi Zero Plus2 H3 board with OV5640 camera, you can use the following setting, if you are using a different board, you need to check the board schematic to make sure the pins(port:Pxnn<n><default><default><default>) defined in the fex file are in line with what's in the schematic(you can refer to my previous post in this thread on where in the schematic to check) and update them accordingly.

twi address(vip_dev0_twi_addr), voltage settings(vip_dev1_iovdd_vol,vip_dev1_avdd_vol,vip_dev1_dvdd_vol,vip_dev1_afvdd_vol) are described in OV5640 datasheet(8.3 DC characteristics https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf). 

 

Once done, use fex2bin to convert the fex file to bin file. Reboot the board to load the updated bin file.



[csi0]
vip_used = 1
vip_mode = 0
vip_dev_qty = 1
vip_define_sensor_list = 0
vip_csi_pck = port:PE00<2><default><default><default>
vip_csi_mck = port:PE01<2><default><default><default>
vip_csi_hsync = port:PE02<2><default><default><default>
vip_csi_vsync = port:PE03<2><default><default><default>
vip_csi_d0 = port:PE04<2><default><default><default>
vip_csi_d1 = port:PE05<2><default><default><default>
vip_csi_d2 = port:PE06<2><default><default><default>
vip_csi_d3 = port:PE07<2><default><default><default>
vip_csi_d4 = port:PE08<2><default><default><default>
vip_csi_d5 = port:PE09<2><default><default><default>
vip_csi_d6 = port:PE10<2><default><default><default>
vip_csi_d7 = port:PE11<2><default><default><default>
vip_csi_sck = port:PE12<2><default><default><default>
vip_csi_sda = port:PE13<2><default><default><default>
vip_dev0_mname = "ov5640"
vip_dev0_pos = "rear"
vip_dev0_lane = 2
vip_dev0_twi_id = 2
vip_dev0_twi_addr = 120
vip_dev0_isp_used = 0
vip_dev0_fmt = 0
vip_dev0_stby_mode = 0
vip_dev0_vflip = 1
vip_dev0_hflip = 1
vip_dev0_iovdd = ""
vip_dev0_iovdd_vol = 1800000
vip_dev0_avdd = ""
vip_dev0_avdd_vol = 2800000
vip_dev0_dvdd = ""
vip_dev0_dvdd_vol = 1500000
vip_dev0_afvdd = ""
vip_dev0_afvdd_vol = 0
vip_dev0_power_en = port:PA08<1><default><default><default>
vip_dev0_reset = port:PE14<1><default><default><default>
vip_dev0_pwdn = port:PE15<1><default><default><default>
vip_dev0_flash_en =
vip_dev0_flash_mode =
vip_dev0_af_pwdn =
vip_dev0_act_used = 0
vip_dev0_act_name = "ad5820_act"
vip_dev0_act_slave = 24
vip_dev1_mname = ""
vip_dev1_pos = "front"
vip_dev1_lane = 1
vip_dev1_twi_id = 0
vip_dev1_twi_addr =
vip_dev1_isp_used = 0
vip_dev1_fmt = 1
vip_dev1_stby_mode = 0
vip_dev1_vflip = 0
vip_dev1_hflip = 0
vip_dev1_iovdd = ""
vip_dev1_iovdd_vol = 2800000
vip_dev1_avdd = ""
vip_dev1_avdd_vol = 2800000
vip_dev1_dvdd = ""
vip_dev1_dvdd_vol = 1500000
vip_dev1_afvdd = ""
vip_dev1_afvdd_vol = 2800000
vip_dev1_power_en =
vip_dev1_reset =
vip_dev1_pwdn =
vip_dev1_flash_en =
vip_dev1_flash_mode =
vip_dev1_af_pwdn =

 

Step 2. Load the drivers

 

modprobe ov5640
modprobe vfe_v4l2

 

check dmesg, the normal log should look like this:

[   24.397287] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[   35.772109] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[   35.849649] [OV5640@lex]sensor_init 0x0
[   35.897182] [OV5640@lex]CSI_SUBDEV_STBY_ON!
[   35.906344] [OV5640@lex]sensor_s_release_af
[   35.927791] [OV5640@lex]disalbe oe!

At this point you should have a working /dev/video0

 

 

 

 

I am stucked in the dmesg output


[    9.887800] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[    9.902103] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[    9.970081] [OV5640@lex]sensor_init 0x0
[    9.970886] [OV5640@lex]sensor read retry=2
[    9.970896] [OV5640@lex]error at sensor_detect
[    9.970904] [OV5640@lex]chip found is not an target chip.
[    9.970914] [OV5640@lex]CSI_SUBDEV_PWR_OFF!

Edited by Tido
added Spoiler
Link to comment
Share on other sites

On 7/19/2018 at 2:47 PM, thanh_tan said:

[    9.970886] [OV5640@lex]sensor read retry=2
[    9.970896] [OV5640@lex]error at sensor_detect
[    9.970904] [OV5640@lex]chip found is not an target chip.

 

You should ensure:

 

a) Your sensor has the pins 180 reversed. discussed at the beginning of this thread,

b) twi2 is disabled, so the board can talk to the sensor via CSI,

c) the correct pin enabled for your u-boot version, read this thread,

 

if everything else fails you should try with Android to make sure your sensor is still working, maybe you try with another sensor.

 

Good luck

Link to comment
Share on other sites

On 9/28/2016 at 6:11 PM, Max said:

First of all thanks to everybody here. This is the most useful thread a find about my problem but still I have not figure out how to solve it. 

 

- I just received a nanopi M1 and the CAM500A. 

- I installed this debian image: http://www.mediafire.com/file/6a9wmjz826rvngw/nanopi-m1-debian-sd4g-20160907.img.zip

- I connected the camera as in the image:

  https://dl.dropboxusercontent.com/u/18065445/Tmp/nanopi-m1-cam500a.jpg

- followed these instructions:

   sudo bash

   cd /root/mjpg-streamer
   make
   ./start.sh

but I received the infamous:

   ERROR opening V4L interface: No such file or directory

   Init v4L2 failed !! exit fatal

   i: Init_VideoIn failed

 

modprobe ov5640 returns Module ov5640 not found

modprobe vfe_v4l2 produces no output

 

looking into /var/log/kern.log shows

[ov5640] error at senor_detect

[ov5640] chip found not an target chip

 

I tried two different new cameras (same models) and two different new nanopis (same models). So I have no reason to think it is a defective camera or connector.

 

I would appreciate if you could help me with the following:

1) does it look like I inserted the connector in the proper direction?

2) is there a known fix?

3) is there anything I can do to further debug this problem?

 

hi

I am grateful for the help that will be given to me.

Please help me with the launch of the cam500a by Nano Air.
 

I tried to use http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air#Connect_to_DVP_Camera_CAM500B guides and go along with it.

 

but I did not succeed .
I am very beginner and need help.

 

 

This is all that I get by following the guide http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air#Connect_to_DVP_Camera_CAM500B.

Spoiler

 


root@NanoPi-NEO-Air:~# cd /root/mjpg-streamer
root@NanoPi-NEO-Air:~/mjpg-streamer# make
make: svnversion: Command not found
make: Warning: File 'Makefile' has modification time 427105 s in the future
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o mjpg_streamer.o mjpg_streamer.c
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o utils.o utils.c
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall  mjpg_streamer.o utils.o -lpthread -ldl -o mjpg_streamer
chmod 755 mjpg_streamer
make -C plugins/input_uvc all
make[1]: Entering directory '/root/mjpg-streamer/plugins/input_uvc'
make[1]: Warning: File 'Makefile' has modification time 427103 s in the future
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o v4l2uvc.lo v4l2uvc.c
v4l2uvc.c: In function init_videoIn’:
v4l2uvc.c:88:23: warning: variable currentHeight set but not used [-Wunused-but-set-variable]
     int currentWidth, currentHeight = 0;
                       ^
v4l2uvc.c:88:9: warning: variable currentWidth set but not used [-Wunused-but-set-variable]
     int currentWidth, currentHeight = 0;
         ^
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o jpeg_utils.lo jpeg_utils.c
jpeg_utils.c: In function compress_yuv_to_jpeg’:
jpeg_utils.c:208:27: warning: v may be used uninitialized in this function [-Wmaybe-uninitialized]
             r = (y + (359 * v)) >> 8;
                           ^
jpeg_utils.c:209:26: warning: u may be used uninitialized in this function [-Wmaybe-uninitialized]
             g = (y - (88 * u) - (183 * v)) >> 8;
                          ^
jpeg_utils.c:209:20: warning: y may be used uninitialized in this function [-Wmaybe-uninitialized]
             g = (y - (88 * u) - (183 * v)) >> 8;
                    ^
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o dynctrl.lo dynctrl.c
gcc -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o input_uvc.so input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo -ljpeg
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/root/mjpg-streamer/plugins/input_uvc'
cp plugins/input_uvc/input_uvc.so .
make -C plugins/output_file all
make[1]: Entering directory '/root/mjpg-streamer/plugins/output_file'
make[1]: Warning: File 'Makefile' has modification time 427099 s in the future
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_file.so output_file.c
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/root/mjpg-streamer/plugins/output_file'
cp plugins/output_file/output_file.so .
make -C plugins/output_udp all
make[1]: Entering directory '/root/mjpg-streamer/plugins/output_udp'
make[1]: Warning: File 'Makefile' has modification time 427098 s in the future
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_udp.so output_udp.c
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/root/mjpg-streamer/plugins/output_udp'
cp plugins/output_udp/output_udp.so .
make -C plugins/output_http all
make[1]: Entering directory '/root/mjpg-streamer/plugins/output_http'
make[1]: Warning: File 'Makefile' has modification time 427097 s in the future
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o httpd.lo httpd.c
gcc -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_http.so output_http.c httpd.lo
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/root/mjpg-streamer/plugins/output_http'
cp plugins/output_http/output_http.so .
make -C plugins/input_file all
make[1]: Entering directory '/root/mjpg-streamer/plugins/input_file'
make[1]: Warning: File 'Makefile' has modification time 427094 s in the future
make[1]: Nothing to be done for 'all'.
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory '/root/mjpg-streamer/plugins/input_file'
cp plugins/input_file/input_file.so .
make: warning:  Clock skew detected.  Your build may be incomplete.
root@NanoPi-NEO-Air:~/mjpg-streamer# ./start.sh
MJPG Streamer Version: svn rev:
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 30
 i: Format............: YUV
 i: JPEG Quality......: 90
ERROR opening V4L interface: No such file or directory
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed
root@NanoPi-NEO-Air:~/mjpg-streamer#

What should i do

 

Edited by Tido
double post form here: https://forum.armbian.com/topic/8130-launch-cam500a-camera-by-nanopi-neo-air-solved/
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines