hardware environment: CPU: i.MX53, camera: OV5640
purpose: use the video for linux(v4l2) interface to get the picture with 2592x1944
dirver files: ov5640_camera.ko mxc_v4l2_capture.ko
test program: mxc_v4l2_capture.out
add device file normal, at the end will creat /dev/video0 file
root@freescale /$modprobe ov5640_camera
root@freescale /$modprobe mxc_v4l2_capture.out
m=0, rf=30, size = 640*480 …pass
root@freescale /unit_tests$ ./mxc_v4l2_capture.out 00.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 640x480
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_v4l_close: release resource
m=1, rf=30, size = 320*240 …pass
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -m 1 01.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 320x240
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_v4l_close: release resource
m=2, rf=30, size = 720x480 …pass
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -m 2 02.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 720x480
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_v4l_close: release resource
m=3, rf=30, size = 720x576 …pass
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -m 3 03.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 720x576
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_v4l_close: release resource
m=4, rf=30, size = 1280x720 … fail, mxc_v4l_dqueue timeout
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -fr 30 -m 4 04.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 1280x720
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00100000
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF failed.
ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued
VIDIOC_QBUF failed
mxc_ipu mxc_ipu: warning: disable ipu dma channel 20 during its busy state
mxc_v4l_close: release resource
m=5, fr=15, size = 1920x1080 … fail, mxc_v4l_dqueue timeout
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -fr 15 -m 5 05.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 1920x1080
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00100000
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF failed.
ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued
VIDIOC_QBUF failed
mxc_ipu mxc_ipu: warning: disable ipu dma channel 20 during its busy state
mxc_v4l_close: release resource
m=6, fr=15, size = 2592x1944 …fail, mxc_v4l_dqueue timeout
root@freescale /unit_tests$ ./mxc_v4l2_capture.out -fr 15 -m 6 06.jpg
in_width = 176, in_height = 144 device name is Mxc Camera
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_camera
sensor frame size is 2592x1944
sensor frame format is YUYV
Width = 176 Height = 144 Image size = 3YUV4208016
pixelformat = 842093913
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF failed.
ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued
VIDIOC_QBUF failed
mxc_v4l_close: release resource
Why the picture size bigger than 720x576 will happen timeout error ? How to fix it?
I have never used "big" capture mode to make "small" movies. So, I´m not sure it would be supported.
You need to make sure you´re using a correct configuration set to control your camera. Take a look on your camera driver and see if the frame rate are supported for a capture mode, and what would be the standard width x height.
In addition, imx53 can encode up to 720p, it won´t encode 2592x1944.
I just want to take the photos, then I need to preview. So I use the capture mode. Do you has the better method to take photos?
Thank you very much !
As I remember ./mxc_v4l2_capture.out does not take photos. It make movies.
And, it would be better to determinate width and height of it. Something like:
./mxc_v4l2_capture.out -m 4 -h 640 -w 480
Please, see usage in order to make sure you have a correct command line.
./mxc_v4l2_capture.out -m 4 -h 640 -w 480
If the command line just like you say, then about the ov5640, the mode 4 , width = 1280, height = 720, it's the 720P, i.MX53 can encode up to it. And your command should like this:
./mxc_v4l2_capture.out -m 4 -ow 640 -oh 480
Excute the command, it's correct. But if I excute following command:
./mxc_v4l2_capture.out -m 4 -ow 1280 -oh 720
It will happend the error like front what I said. I didn't modify the drivers ov5640 or mxc_v4l2_capture. I used the bsp was L2.6.35_11.09.01_ER_source that it is download from freescale.com.
hum. Maybe you need to take care of frame rate as well.
Sorry, I don´t have a board over here to test, and i don´t remember the complete usage for this unit-test. But, unit-test is a very-very simple, and maybe it only work great for some parameter range.
In addition, take a look on this file:
linux-2.6-imx.git - Freescale i.MX Linux Tree
Here you can see all supported capture modes:
enum ov5642_mode {
ov5642_mode_MIN = 0,
ov5642_mode_VGA_640_480 = 0,
ov5642_mode_QVGA_320_240 = 1,
ov5642_mode_NTSC_720_480 = 2,
ov5642_mode_PAL_720_576 = 3,
ov5642_mode_720P_1280_720 = 4,
ov5642_mode_1080P_1920_1080 = 5,
ov5642_mode_QSXGA_2592_1944 = 6,
ov5642_mode_QCIF_176_144 = 7,
ov5642_mode_MAX = 7
};
If you look for "720P" you will see that there is only one table definition to configure camera with 1280_720 resolution and 30 FPS.
So, if you try to use capture mode = 4 and 15 FPS, camera will not work.
Yes, if I use capture mode = 4 and 15 fps, camera will not work. But the demo default is 30 fps, so if I did not set it, it can be 30fps. So the camera shoud be work, but it cannot.
Pass freescale FAE's help, to change the input channel can take the bigger pictures, unfortunately, the colors has lost. And I have no idea to fix it.
Can anyone help me ?
hi billyhe,
can you able to capture low resolutions such as 240p, 480p. If it so you can able to ccapture 720p also.
can you conform me whether you are using default driver file or customised one.
thanks,
shan
Hi shanmugamsundar,
Yes, I can capture the picture less than or equal to 1080P, and I use the default driver with ov5640.
Thanks.
ok now tell me your issues and what you want to do b'coz i am working on the same platform i.mx535 and ov5640. i've come across the issues what ever you are facing. i hope i can help you
Thanks
shan
Thank you very much! Now I used the unit test to capture the picture. The command like this
./mxc_v4l2_capture.out -m 6 -fr 15 -i 1 -iw 2560 -ih 1920 -ow 2560 -oh 1920 -c 20 2592.yuv
then I used the mxc_v4l2_output.out to play the .yuv file, but it is non-distinct image.
If the mode is 5(1080P), it is no problem.
my mistake,
720p and 1080p are not work, esle is ok.
./mxc_v4l2_capture -iw 640 -ih 480 -ow 640 -oh 480 -m 0 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 vga.yuv
./mxc_v4l2_capture -iw 320 -ih 240 -ow 320 -oh 240 -m 1 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 320240.yuv
./mxc_v4l2_capture -iw 720 -ih 480 -ow 720 -oh 480 -m 2 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 720480.yuv
./mxc_v4l2_capture -iw 720 -ih 576 -ow 720 -oh 576 -m 3 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 720576.yuv
./mxc_v4l2_capture -iw 1280 -ih 720 -ow 1280 -oh 720 -m 4 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 720p.yuv
./mxc_v4l2_capture -iw 1920 -ih 1080 -ow 1920 -oh 1080 -m 5 -i 1 -r 0 -c 5 -fr 30 -d /dev/video0 1080p.yuv
./mxc_v4l2_capture -iw 2592 -ih 1944 -ow 2592 -oh 1944 -m 6 -i 1 -r 0 -c 5 -fr 15 -d /dev/video0 2592.yuv
if i==0
I can capture the picture less than or equal to 720*576.