-
- Posts: 52
- Joined: Thu Sep 29, 2022 8:15 am
unable to detect ov5640 in Raspberry Pi
Im using raspberry Pi 4, I had compiled kernel 5.15.70 and I included ov5640 as dynamic module(configured using make menuconfig ) and after that I used ov5647.v5647dtsi and ov5647-overlay.dts files and created ov5640.dtsi and ov5640-overlay.dts and just replaced texts, i.e, ov5647 with ov5640 and 36 address with 3c, and after compiling generated dtbo file is copied to /boot/overlays/ and added dtoverlay=ov5640 and rebooted, after rebooting I2c device nodes were created but when i try to load driver, it loads successfully but when no video device nodes were found, and one more thing is in dmesg I didnt seen any error.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
Does it respond when probed with "i2cdetect -y 10"?
Have you added "dtoverlay=ov5640" to /boot/config.txt? Camera autodetection only works for Rasbperry Pi camera modules (ov5647, imx219, and imx477).
Have all the V4L2 devices probed? Check "sudo cat /sys/kernel/debug/v4l2-async/pending_async_subdevices" - you should get ov5640 and unicam listed, but with nothing after the colon.
Did the overlay apply? Check "sudo vcdbg log msg" for any dt related errors. If nothing obvious, then add "dtdebug=1" to /boot/config.txt to get more debug from the dt process.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
Libcamera Error:
Code: Select all
Setting pipeline to PAUSED ...
[0:11:41.847873650] [1665] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3865-3fad116f
[0:11:41.870382270] [1669] WARN CameraSensor camera_sensor.cpp:212 'ov5640 10-003c': Recommended V4L2 control 0x009a0922 not supported
[0:11:41.870472917] [1669] ERROR V4L2 v4l2_subdevice.cpp:387 'ov5640 10-003c': Unable to get rectangle 2 on pad 0: Inappropriate ioctl for device
[0:11:41.870538064] [1669] WARN CameraSensor camera_sensor.cpp:239 'ov5640 10-003c': The PixelArraySize property has been defaulted to 2592x1944
[0:11:41.870579212] [1669] ERROR V4L2 v4l2_subdevice.cpp:387 'ov5640 10-003c': Unable to get rectangle 1 on pad 0: Inappropriate ioctl for device
[0:11:41.870639600] [1669] WARN CameraSensor camera_sensor.cpp:250 'ov5640 10-003c': The PixelArrayActiveAreas property has been defaulted to (0, 0)/2592x1944
[0:11:41.870683452] [1669] ERROR V4L2 v4l2_subdevice.cpp:387 'ov5640 10-003c': Unable to get rectangle 0 on pad 0: Inappropriate ioctl for device
[0:11:41.870723599] [1669] WARN CameraSensor camera_sensor.cpp:258 'ov5640 10-003c': Failed to retrieve the sensor crop rectangle
[0:11:41.870755655] [1669] WARN CameraSensor camera_sensor.cpp:264 'ov5640 10-003c': The sensor kernel driver needs to be fixed
[0:11:41.870785840] [1669] WARN CameraSensor camera_sensor.cpp:266 'ov5640 10-003c': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[0:11:41.870831043] [1669] ERROR CameraSensor camera_sensor.cpp:287 'ov5640 10-003c': Mandatory V4L2 control 0x009e0902 not available
[0:11:41.870871283] [1669] ERROR CameraSensor camera_sensor.cpp:287 'ov5640 10-003c': Mandatory V4L2 control 0x009e0901 not available
[0:11:41.870904357] [1669] ERROR CameraSensor camera_sensor.cpp:295 'ov5640 10-003c': The sensor kernel driver needs to be fixed
[0:11:41.870933597] [1669] ERROR CameraSensor camera_sensor.cpp:297 'ov5640 10-003c': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[0:11:41.871495073] [1669] ERROR RPI raspberrypi.cpp:1184 Failed to register camera ov5640 10-003c: -22
ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Could not find any supported camera on this system.
Additional debug info:
../src/gstreamer/gstlibcamerasrc.cpp(354): gst_libcamera_src_open (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
libcamera::CameraMananger::cameras() is empty
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
Code: Select all
gst-launch-1.0 libcamerasrc ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! autovideosink
so what to so now?
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
The log messages tell you the issue
Code: Select all
[0:11:41.870831043] [1669] ERROR CameraSensor camera_sensor.cpp:287 'ov5640 10-003c': Mandatory V4L2 control 0x009e0902 not available
[0:11:41.870871283] [1669] ERROR CameraSensor camera_sensor.cpp:287 'ov5640 10-003c': Mandatory V4L2 control 0x009e0901 not available
0x009e0901 is V4L2_CID_VBLANK
Without those it is not possible to configure frame rate, and as exposure time is normally set in units of lines you can't set exposure either.
It looks like the driver may have been updated to support these controls in the 6.0 kernel release - https://github.com/raspberrypi/linux/co ... c/ov5640.c. You could try cherry-picking all the changes back from 6.0 to 5.15, or try building 6.0.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
and I came to know that libcamera main purpose was to ISP, and ov5647 does not have that, but ov5640 has ISP, so instead of using libcamera and writing helper classes for libcamera, its better to use v4l2.
So I planned to use v4l2, so for testing I used Raspberry Pi supported camera ov5647
So I conncted ov5647 to MIPI interface and runned this command
command:
Code: Select all
gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! autovideosink
Code: Select all
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(659): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.112955084
Setting pipeline to NULL ...
Freeing pipeline ...
dmesg log:
Code: Select all
unicam fe801000.csi : failed to start media pipeline: -22
I'm able to stream ov5647 with libcamera why not with v4l2?
if v4l2 works with ov5647, I will try to give a try with ov5640,
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
Media Controller separates setting the format for multiple points down the pipeline, and requires you to set the resolution and format on each pad in the chain. libcamera will do this for you, but v4l2src won't.
You can disable Media Controller for ov5647 by loading with "dtoverlay=ov5647,media-controller=0" (and removing "camera_auto_detect=1" if present).
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
This is my /boot/config.txt
Code: Select all
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Automatically load overlays for detected cameras
#camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Disable compensation for displays with overscan
disable_overscan=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
[all]
kernel=kernel-subhash.img
dtoverlay=ov5647
media-controller=0
and in terminal i followed the process which they shown viewtopic.php?t=322076
v4l2-ctl -v width=640,height=480,pixelformat=YUYV --device /dev/videoX
X : I used all numbers present under /dev/video*
and after that I tried
media-ctl -v -d /dev/media4 -V ''\''ov5640 10-0036'\'':0 [fmt:SRGGB10_1X10/640x480 field:none]'
after /dev/media0 I tried with /dev/meida,1,2,3,4 but I got error seeting failed
for /dev/media0
Code: Select all
Opening media device /dev/media0
Enumerating entities
looking up device: 81:15
looking up device: 81:14
Found 2 entities
Enumerating pads and links
Setting up format SRGGB10_1X10 640x480 on pad ov5647 10-0036/0
Format set: SGBRG10_1X10 640x480
I tried to stream using
command :
Code: Select all
gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! autovideosink
Error:
Code: Select all
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(659): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.036154596
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...
Code: Select all
[ 1669.355628] unicam fe801000.csi: Wrong width or height 3840x2160 (remote pad set to 640x480)
[ 1669.355650] unicam fe801000.csi: Failed to start media pipeline: -22
command:
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)640, height=(int)480, format=(string)UYVY' ! videoconvert ! autovideosink
Then again I got same error
and dmesg log:
Code: Select all
unicam fe801000.csi: Failed to start media pipeline: -22
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
Not what I wrote.Subhash_24 wrote: ↑Mon Oct 03, 2022 8:22 amThis is my /boot/config.txt
Code: Select all
[all] kernel=kernel-subhash.img dtoverlay=ov5647 media-controller=0
Code: Select all
dtoverlay=ov5647,media-controller=0
Code: Select all
dtoverlay=ov5647
dtparam=media-controller=0
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
ok this is the sequence I followed
1. dtoverlay=ov5647,media-controller=0 added to /boot/config.txt
2. v4l2-ctl -v width=640,height=480,pixelformat=pGAA --device /dev/video0
I got pixelformat information using
command:
Code: Select all
v4l2-ctl --device /dev/video0 --all
Code: Select all
.
.
.
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'pGAA' (10-bit Bayer GBGB/RGRG Packed)
Field : None
Bytes per Line : 800
Size Image : 384000
Colorspace : Raw
Transfer Function : Default (maps to None)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
.
.
.
command:
Code: Select all
media-ctl -v -d /dev/media1 -V ''\''ov5647 10-0036'\'':0 [fmt:SGBRG10_1X10/640x480 field:none]'
output:
Code: Select all
Opening media device /dev/media3
Enumerating entities
looking up device: 81:15
looking up device: 81:14
Found 2 entities
Enumerating pads and links
Setting up format SGBRG10_1X10 640x480 on pad ov5647 10-0036/0
Unable to set format: Operation not permitted (-1)
Unable to setup formats: Operation not permitted (1)
4. I run gstreamer to stream, but still I'm facing error but this time error is little different, I'm not getting failed to allocate memory error now, but still getting Internal data stream error.
command:
Code: Select all
gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! autovideosink
Code: Select all
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GgstreamerstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000436181
Setting pipeline to NULL ...
Freeing pipeline ...
5. I run gstreamer to stream, with adding width and height
command :
Code: Select all
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)640, height=(int)480' ! autovideosink
6. I run gstreamer , by adding width, height and format, I'm unable to stream, and got online output with some warning
command:
Code: Select all
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)640, height=(int)480, format=(string)pGAA' ! autovideosink
Code: Select all
WARNING: erroneous pipeline: could not link v4l2src0 to autovideosink0, v4l2src0 can't handle caps video/x-raw, width=(int)640, height=(int)480, format=(string)pGAA
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
Correct. You've just disabled Media Controller, therefore expecting it to do anything useful is a bit daft.Subhash_24 wrote: ↑Mon Oct 03, 2022 10:07 am3. after that I tried this
command:operation not permitted error thrownCode: Select all
media-ctl -v -d /dev/media1 -V ''\''ov5647 10-0036'\'':0 [fmt:SGBRG10_1X10/640x480 field:none]'
output:even trying with sudo I got same thing so I left this commandCode: Select all
Opening media device /dev/media3 Enumerating entities looking up device: 81:15 looking up device: 81:14 Found 2 entities Enumerating pads and links Setting up format SGBRG10_1X10 640x480 on pad ov5647 10-0036/0 Unable to set format: Operation not permitted (-1) Unable to setup formats: Operation not permitted (1)
GStreamer has very limited support for Bayer formats.Subhash_24 wrote:4. I run gstreamer to stream, but still I'm facing error but this time error is little different, I'm not getting failed to allocate memory error now, but still getting Internal data stream error.
command:Code: Select all
gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! autovideosink
I checked dmesg log I'm did not see any log related to this,Code: Select all
Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /GstPipeline:pipeline0/GgstreamerstV4l2Src:v4l2src0: Internal data stream error. Additional debug info: ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming stopped, reason not-negotiated (-4) Execution ended after 0:00:00.000436181 Setting pipeline to NULL ... Freeing pipeline ...
Converting a Bayer image into a usable YUV or RGB image is far more than the simple videoconvert does. (This is the whole reason we have libcamera).
Because you're still not addressing the issue of the image format.Subhash_24 wrote:5. I run gstreamer to stream, with adding width and height
command :got same error, and again I did not see any log in dmesgCode: Select all
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)640, height=(int)480' ! autovideosink
Exactly - it can't handle "format=(string)pGAA"Subhash_24 wrote:6. I run gstreamer , by adding width, height and format, I'm unable to stream, and got online output with some warning
command:output:Code: Select all
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)640, height=(int)480, format=(string)pGAA' ! autovideosink
Code: Select all
WARNING: erroneous pipeline: could not link v4l2src0 to autovideosink0, v4l2src0 can't handle caps video/x-raw, width=(int)640, height=(int)480, format=(string)pGAA
You can stream ov5647 using V4L2 - "v4l2-ctl --stream-mmap=3 --stream-count=1000 --stream-to=file.raw" will give you a stream of raw Bayer images.
ov5640 can give you processed YUYV images, and those you can pass through GStreamer as-is.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
Re: unable to detect ov5640 in Raspberry Pi
OV5647 was used in the Raspberry Pi Camera v1. The Pi firmware will autodetect the official Pi cameras and automatically load the overlay. OV5640 isn't one of them so you need to load the overlay for it yourself.Subhash_24 wrote: ↑Thu Oct 06, 2022 4:52 pmHello @6by9 can you tell me why we need to add dtoverlay=ov5640, inorder to detect ov5640, why it is not the same case with ov5647, where we are not even setting dtoverlay in config.txt but it is getting detected? but not the same with ov5640 even copying ov5640.dtbo to /boot/overlays/
-
- Posts: 8
- Joined: Mon Sep 26, 2022 11:36 am
Re: unable to detect ov5640 in Raspberry Pi
Code: Select all
The Pi firmware will autodetect the official Pi cameras
Re: unable to detect ov5640 in Raspberry Pi
All you can do is disable that autodetection by setting camera_auto_detect=0 in /boot/config.txt. You can't make it autoload the ov5640 overlay.Subhash_24 wrote: ↑Thu Oct 06, 2022 5:25 pmDont we have control on that?Code: Select all
The Pi firmware will autodetect the official Pi cameras
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 18374
- Joined: Wed Dec 04, 2013 11:27 am
- Location: Cambridge, ZZ9 Plural Z Alpha
Re: unable to detect ov5640 in Raspberry Pi
OV5640 is not an official Pi camera module.Subhash_24 wrote: ↑Thu Oct 06, 2022 5:25 pmDont we have control on that?Code: Select all
The Pi firmware will autodetect the official Pi cameras
The firmware is closed source, so no you can't add it. You can manually add the relevant "dtoverlay=..." line to load the overlay.
I'm not interested in doing contracts for bespoke functionality - please don't ask.