avafinger / cap-v4l2

capture frames from CMOS camera ov5640 / ov8865 using V4l2 and OpenCV
19 stars 20 forks source link

sometimes getting this error while capturing video using v4l2: v4l2: errno: 0 - check sensor, something wrong. #3

Open harshil1991 opened 5 years ago

harshil1991 commented 5 years ago

Sometimes I am getting below error, while capturing 1080p@25 based NV12 raw data using cap-v4l2 ,

v4l2: errno: 0 - check sensor, something wrong. this log is specified in cap.c file at 439 line no.

please note that I am capturing data using OV8865 on Bananapi - M3.

avafinger commented 5 years ago

Please, provide more info:

harshil1991 commented 5 years ago

Thanks for replying,

Here is the output of uname:

uname -a Linux bpi-iot-ros-ai 3.4.39-BPI-M3-Kernel #1 SMP PREEMPT Sat May 26 10:03:38 UTC 2018 armv7l armv7l armv7l GNU/Linux

and yes there is /dev/video0 entry exist when I got error.

harshil1991 commented 5 years ago

I am also getting below error message on dmesg:

[ 917.499773] [VFE]capture video first frame done! [ 917.499801] [VFE_WARN]Only two buffer left for csi [ 917.533087] [VFE]capture video mode! [ 917.566401] [VFE]capture video first frame done! [ 917.566430] [VFE_WARN]Only two buffer left for csi [ 917.599715] [VFE]capture video mode! [ 917.633030] [VFE]capture video first frame done! [ 917.633060] [VFE_WARN]Only two buffer left for csi [ 917.666344] [VFE]capture video mode! [ 917.699656] [VFE]capture video first frame done! [ 917.699684] [VFE_WARN]Only two buffer left for csi [ 917.732972] [VFE]capture video mode! [ 917.766286] [VFE]capture video first frame done! [ 917.766316] [VFE_WARN]Only two buffer left for csi [ 917.799599] [VFE]capture video mode! [ 917.832911] [VFE]capture video first frame done! [ 917.832940] [VFE_WARN]Only two buffer left for csi [ 917.866227] [VFE]capture video mode! [ 917.899540] [VFE]capture video first frame done! [ 917.899570] [VFE_WARN]Only two buffer left for csi [ 917.932853] [VFE]capture video mode! [ 917.966168] [VFE]capture video first frame done! [ 917.966196] [VFE_WARN]Only two buffer left for csi [ 917.999481] [VFE]capture video mode! [ 918.032795] [VFE]capture video first frame done! [ 918.032824] [VFE_WARN]Only two buffer left for csi [ 918.066109] [VFE]capture video mode! [ 918.099424] [VFE]capture video first frame done! [ 918.099457] [VFE_WARN]Only two buffer left for csi [ 918.132752] [VFE]capture video mode! [ 918.168987] [VFE]vfe_close [ 918.180300] [ov8865_4lane]CSI_SUBDEV_PWR_OFF! [ 918.180331] [VFE]mclk off [ 918.241949] [VFE]..........................vfe clk close!....................... [ 918.242205] [VFE]vfe_close end

avafinger commented 5 years ago

Can you get the errors in dmesg when you get "v4l2: errno: 0 - check sensor, something wrong" ?

harshil1991 commented 5 years ago

yes

avafinger commented 5 years ago

rc = 0 (from select) means the timeout expires before capture a new frame. Try to increase the timeout and see what happens:

    FD_ZERO(&fds);
    FD_SET(fd, &fds);

    tv.tv_sec = **5**; <==== from 2
    tv.tv_usec = 0;
harshil1991 commented 5 years ago

ok sure let me check

harshil1991 commented 5 years ago

After doing this changes, tested code 3 times, issue is not happening. so closing this issue.

avafinger commented 5 years ago

I would like to mention the issue is in Kernel CSI code and not cap issue.

harshil1991 commented 5 years ago

yes, because I am getting same error after running for an hour.

harshil1991 commented 5 years ago

Can you help me out where will be issue on CSI code?

avafinger commented 5 years ago

CSI code is complex and not a trivial task. this requires an experienced kernel developer. Please provide details of you what are doing and what you want to achieve. Maybe there are other approaches to solve the problem.