So close (yet still far) from getting the OV5640 camera working on an Orange Pi PC

Recommended Posts

Hi everyone,


I bought this Orange Pi PC with this OV5640 5MP camera module.

I've been following the other threads online for directions on getting it to work, and I'm up to the point where there exists a /dev/video0 entry, but I'm unable to use it through avafinger's cap-v4l2 program, opencv, or fswebcam. The best I can get is a black image from it.


What I've done so far:

  • Editted the [twi2] and [csi0] sections of my script.fex file, converted it back to script.bin with fex2bin
  • sudo modprobe ov5640
  • sudo modprobe vfe_v4l2


this is the output of dmesg following boot, and this is the output of v4l2-ctl --all.

Here's a link to my current script.fex. I've tried many different variations of the [csi0] section to no avail so far.


cap-v4l2 fails with the error message:

v4l2: errno: 22 - check sensor, something wrong.
v4l2: failed to retrieve frame.

fswebcam gives me:

Error setting pixel format.
VIDIOC_S_FMT: Operation not permitted

 and opencv fails with:

mmap: Invalid argument
munmap: Invalid argument
/dev/video0 does not support memory mapping
VIDEOIO ERROR: V4L: can't open camera by index 0
munmap: Invalid argument
/dev/video0 does not support memory mapping




I've been trying for over a week now and I'm basically out of ideas. Does anyone have any suggestions?

Thanks in advance.

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?



Finally got it working; here's the new script.fex.


Also need to remember to run:

sunxi-pio -m "PA17<1><0><1><1>"        # AVDD / CSI_PWR_EN
sunxi-pio -m "PG13<1><0><1><1>"        # DOVDD / AFCC_EN

before loading ov5640 and vfe_v4l2.


The opencv error is still there though, so i'll have to figure out a workaround to pipe the image data in from ffmpeg or something.

Link to post
Share on other sites
This topic is now closed to further replies.