Hello,
I have a custom board based on TI's AM5728 EVM. I am using the latest Linux PSDK 6.03 on it. I have ported the OV5640 Camera on the custom board.
I am trying to capture using yavta test but I am failing to do so. The capture file is producing incorrect output.
Following are device tree entries that I have used -
clk_ov5640_fixed: clk_ov5640_fixed {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
};
clk_ov5640: clk_ov5640 {
compatible = "gpio-gate-clock";
#clock-cells = <0>;
clocks = <&clk_ov5640_fixed>;
enable-gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>;
};
&vin3a {
vin3a_ep: endpoint {
remote-endpoint = <&cam>;
slave-mode;
};
};
&vip2 {
status = "okay";
};
&i2c3 {
status = "okay";
clock-frequency = <400000>;
ov5640@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
clock-names = "xclk";
clocks = <&clk_ov5640>;
powerdown-gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
port {
cam: endpoint {
bus-width = <8>;
data-shift = <2>;
hsync-active = <1>;
vsync-active = <1>;
pclk-sample = <1>;
remote-endpoint = <&vin3a_ep>;
};
};
};
};
I have enabled ov5640 driver in the kernel and I am taking care of all its dependencies as well. I am using the same driver code which is present in Linux 6.03 PSDK. Path for the driver is -
~./ti-processor-sdk-linux-am57xx-evm-06.03.00.106/board-support/linux-4.19.94+gitAUTOINC+be5389fd85-gbe5389fd85/drivers/media/i2c/ov5640.c
After booting to the kernel with the above changes, I am getting -
1. Camera device detected at i2c
root@am57xx-evm:~# i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
70: -- -- -- -- -- -- -- --
2. video devices getting registered
root@am57xx-evm:~# dmesg | grep vpe [ 8.201657] vpe 489d0000.vpe: loading firmware vpdma-1b8.bin [ 8.351831] vpe 489d0000.vpe: Device registered as /dev/video0 root@am57xx-evm:~# root@am57xx-evm:~# root@am57xx-evm:~# dmesg | grep vip [ 9.275527] vip 48990000.vip: loading firmware vpdma-1b8.bin [ 9.302388] vip 48990000.vip: VPDMA firmware loaded root@am57xx-evm:~# root@am57xx-evm:~# root@am57xx-evm:~# dmesg | grep ov5640 [ 1.676556] gpio-clk clk_ov5640: GPIO lookup for consumer enable [ 1.676563] gpio-clk clk_ov5640: using device tree for GPIO lookup [ 1.676591] of_get_named_gpiod_flags: parsed 'enable-gpios' property of node '/clk_ov5640[0]' - status (0) [ 7.796208] ov5640 2-003c: GPIO lookup for consumer powerdown [ 7.796215] ov5640 2-003c: using device tree for GPIO lookup [ 7.796239] of_get_named_gpiod_flags: parsed 'powerdown-gpios' property of node '/ocp/i2c@48060000/ov5640@3c[0]' - status (0) [ 7.796260] ov5640 2-003c: GPIO lookup for consumer reset [ 7.796265] ov5640 2-003c: using device tree for GPIO lookup [ 7.796275] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp/i2c@48060000/ov5640@3c[0]' [ 7.796285] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp/i2c@48060000/ov5640@3c[0]' [ 7.796291] ov5640 2-003c: using lookup tables for GPIO lookup [ 7.796296] ov5640 2-003c: No GPIO consumer reset found [ 7.804753] ov5640 2-003c: 2-003c supply DOVDD not found, using dummy regulator [ 7.816059] ov5640 2-003c: Linked as a consumer to regulator.0 [ 7.827176] ov5640 2-003c: 2-003c supply AVDD not found, using dummy regulator [ 7.837283] ov5640 2-003c: 2-003c supply DVDD not found, using dummy regulator [ 9.310109] vin3a: Port A: Using subdev ov5640 2-003c for capture root@am57xx-evm:~# root@am57xx-evm:~# root@am57xx-evm:~# root@am57xx-evm:~# root@am57xx-evm:~# ls -lart /dev/video* crw-rw---- 1 root video 81, 0 Apr 19 02:13 /dev/video11 crw-rw---- 1 root video 81, 1 Apr 19 02:13 /dev/video10 crw-rw---- 1 root video 81, 3 Apr 19 02:13 /dev/video1 crw-rw---- 1 root video 81, 2 Apr 19 02:13 /dev/video0
3. v4l2-ctl able to print complete sensor information
root@am57xx-evm:~# v4l2-ctl -d /dev/video1 --all
Driver Info:
Driver name : vip
Card type : vip
Bus info : platform:vip2:vin3a:stream0
Driver version : 4.19.94
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (camera 1: ok)
Video Standard = 0x00ffb0ff
PAL-B/B1/G/H/I/D/D1/K
NTSC-M/M-JP/M-KR
SECAM-B/D/G/H/K/K1/L/Lc
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'NV12' (Y/CbCr 4:2:0)
Field : None
Bytes per Line : 640
Size Image : 460800
Colorspace : SMPTE 170M
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 640, Height 480
Default : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Crop Capability Video Output:
Bounds : Left 0, Top 0, Width 640, Height 480
Default : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Selection Video Capture: crop, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: compose, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: compose_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: compose_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: crop, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: compose, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: compose_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Output: compose_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 4
User Controls
contrast 0x00980901 (int) : min=0 max=255 step=1 default=0 value=0 flags=slider
saturation 0x00980902 (int) : min=0 max=255 step=1 default=64 value=64 flags=slider
hue 0x00980903 (int) : min=0 max=359 step=1 default=0 value=0 flags=slider
white_balance_automatic 0x0098090c (bool) : default=1 value=1 flags=update
red_balance 0x0098090e (int) : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
blue_balance 0x0098090f (int) : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
exposure 0x00980911 (int) : min=0 max=65535 step=1 default=0 value=1770 flags=inactive, volatile
gain_automatic 0x00980912 (bool) : default=1 value=1 flags=update
gain 0x00980913 (int) : min=0 max=1023 step=1 default=0 value=704 flags=inactive, volatile
horizontal_flip 0x00980914 (bool) : default=0 value=0
vertical_flip 0x00980915 (bool) : default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=3 default=1 value=1
0: Disabled
1: 50 Hz
2: 60 Hz
3: Auto
Camera Controls
auto_exposure 0x009a0901 (menu) : min=0 max=1 default=0 value=0 flags=update
0: Auto Mode
1: Manual Mode
Image Processing Controls
pixel_rate 0x009f0902 (int64) : min=0 max=2147483647 step=1 default=55969920 value=55969920 flags=read-only
test_pattern 0x009f0903 (menu) : min=0 max=1 default=0 value=0
0: Disabled
1: Color bars
root@am57xx-evm:~#
root@am57xx-evm:~#
root@am57xx-evm:~#
root@am57xx-evm:~#
root@am57xx-evm:~# v4l2-ctl -d /dev/video1 --list-formats
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'NV12' (Y/CbCr 4:2:0)
[1]: 'UYVY' (UYVY 4:2:2)
[2]: 'YUYV' (YUYV 4:2:2)
[3]: 'VYUY' (VYUY 4:2:2)
[4]: 'YVYU' (YVYU 4:2:2)
[5]: 'RGB3' (24-bit RGB 8-8-8)
[6]: 'RGB4' (32-bit A/XRGB 8-8-8-8)
[7]: 'BGR3' (24-bit BGR 8-8-8)
[8]: 'BGR4' (32-bit BGRA/X 8-8-8-8)
PROBLEM -
I am trying to run yavta test and capture the stream in a file. When I try to play the file on my PC using ffplay, I am getting a complete green screen or pink screen on the player.
I am using the following command to capture the stream -
root@am57xx-evm:~# yavta -c60 -fYUYV -Fsample.yuv -s640x480 /dev/video1 Device /dev/video1 opened. Device `vip' on `platform:vip2:vin3a:stream0' is a video output (without mplanes) device. Video format set: YUYV (56595559) 640x480 (stride 1280) field none buffer size 614400 Video format: YUYV (56595559) 640x480 (stride 1280) field none buffer size 614400 8 buffers requested. length: 614400 offset: 0 timestamp type/source: mono/EoF Buffer 0/0 mapped at address 0xb6d77000. length: 614400 offset: 614400 timestamp type/source: mono/EoF Buffer 1/0 mapped at address 0xb6ce1000. length: 614400 offset: 1228800 timestamp type/source: mono/EoF Buffer 2/0 mapped at address 0xb6c4b000. length: 614400 offset: 1843200 timestamp type/source: mono/EoF Buffer 3/0 mapped at address 0xb6bb5000. length: 614400 offset: 2457600 timestamp type/source: mono/EoF Buffer 4/0 mapped at address 0xb6b1f000. length: 614400 offset: 3072000 timestamp type/source: mono/EoF Buffer 5/0 mapped at address 0xb6a89000. length: 614400 offset: 3686400 timestamp type/source: mono/EoF Buffer 6/0 mapped at address 0xb69f3000. length: 614400 offset: 4300800 timestamp type/source: mono/EoF Buffer 7/0 mapped at address 0xb695d000. 0 (0) [-] top 0 614400 B 657.437839 657.437878 2.906 fps ts mono/EoF 1 (1) [-] top 1 614400 B 657.779121 657.779173 2.930 fps ts mono/EoF 2 (2) [-] top 2 614400 B 658.120407 658.120464 2.930 fps ts mono/EoF 3 (3) [-] top 3 614400 B 658.461686 658.461724 2.930 fps ts mono/EoF 4 (4) [-] top 4 614400 B 658.802970 658.803023 2.930 fps ts mono/EoF 5 (5) [-] top 5 614400 B 659.144251 659.144288 2.930 fps ts mono/EoF 6 (6) [-] top 6 614400 B 659.485532 659.485569 2.930 fps ts mono/EoF 7 (7) [-] top 7 614400 B 659.826816 659.826871 2.930 fps ts mono/EoF 8 (0) [-] top 8 614400 B 660.168097 660.168136 2.930 fps ts mono/EoF 9 (1) [-] top 9 614400 B 660.509379 660.509414 2.930 fps ts mono/EoF 10 (2) [-] top 10 614400 B 660.850660 660.850695 2.930 fps ts mono/EoF 11 (3) [-] top 11 614400 B 661.191948 661.191989 2.930 fps ts mono/EoF 12 (4) [-] top 12 614400 B 661.533226 661.533260 2.930 fps ts mono/EoF 13 (5) [-] top 13 614400 B 661.874507 661.874543 2.930 fps ts mono/EoF 14 (6) [-] top 14 614400 B 662.215794 662.215850 2.930 fps ts mono/EoF 15 (7) [-] top 15 614400 B 662.557072 662.557124 2.930 fps ts mono/EoF 16 (0) [-] top 16 614400 B 662.898358 662.898392 2.930 fps ts mono/EoF 17 (1) [-] top 17 614400 B 663.239637 663.239676 2.930 fps ts mono/EoF 18 (2) [-] top 18 614400 B 663.580919 663.580956 2.930 fps ts mono/EoF 19 (3) [-] top 19 614400 B 663.922201 663.922234 2.930 fps ts mono/EoF 20 (4) [-] top 20 614400 B 664.263484 664.263520 2.930 fps ts mono/EoF 21 (5) [-] top 21 614400 B 664.604769 664.604821 2.930 fps ts mono/EoF 22 (6) [-] top 22 614400 B 664.946048 664.946083 2.930 fps ts mono/EoF 23 (7) [-] top 23 614400 B 665.287331 665.287370 2.930 fps ts mono/EoF 24 (0) [-] top 24 614400 B 665.628616 665.628670 2.930 fps ts mono/EoF 25 (1) [-] top 25 614400 B 665.969895 665.969933 2.930 fps ts mono/EoF 26 (2) [-] top 26 614400 B 666.311181 666.311237 2.930 fps ts mono/EoF 27 (3) [-] top 27 614400 B 666.652459 666.652496 2.930 fps ts mono/EoF 28 (4) [-] top 28 614400 B 666.993741 666.993777 2.930 fps ts mono/EoF 29 (5) [-] top 29 614400 B 667.335027 667.335081 2.930 fps ts mono/EoF 30 (6) [-] top 30 614400 B 667.676306 667.676343 2.930 fps ts mono/EoF 31 (7) [-] top 31 614400 B 668.017591 668.017643 2.930 fps ts mono/EoF 32 (0) [-] top 32 614400 B 668.358871 668.358908 2.930 fps ts mono/EoF 33 (1) [-] top 33 614400 B 668.700153 668.700187 2.930 fps ts mono/EoF 34 (2) [-] top 34 614400 B 669.041439 669.041473 2.930 fps ts mono/EoF 35 (3) [-] top 35 614400 B 669.382718 669.382755 2.930 fps ts mono/EoF 36 (4) [-] top 36 614400 B 669.724003 669.724054 2.930 fps ts mono/EoF 37 (5) [-] top 37 614400 B 670.065281 670.065315 2.930 fps ts mono/EoF 38 (6) [-] top 38 614400 B 670.406564 670.406601 2.930 fps ts mono/EoF 39 (7) [-] top 39 614400 B 670.747850 670.747901 2.930 fps ts mono/EoF 40 (0) [-] top 40 614400 B 671.089130 671.089169 2.930 fps ts mono/EoF 41 (1) [-] top 41 614400 B 671.430411 671.431623 2.930 fps ts mono/EoF 42 (2) [-] top 42 614400 B 671.771694 671.771730 2.930 fps ts mono/EoF 43 (3) [-] top 43 614400 B 672.112980 672.113029 2.930 fps ts mono/EoF 44 (4) [-] top 44 614400 B 672.454258 672.454290 2.930 fps ts mono/EoF 45 (5) [-] top 45 614400 B 672.795539 672.795581 2.930 fps ts mono/EoF 46 (6) [-] top 46 614400 B 673.136825 673.136857 2.930 fps ts mono/EoF 47 (7) [-] top 47 614400 B 673.478103 673.478132 2.930 fps ts mono/EoF 48 (0) [-] top 48 614400 B 673.819389 673.819421 2.930 fps ts mono/EoF 49 (1) [-] top 49 614400 B 674.160669 674.160695 2.930 fps ts mono/EoF 50 (2) [-] top 50 614400 B 674.501950 674.501976 2.930 fps ts mono/EoF 51 (3) [-] top 51 614400 B 674.843232 674.843261 2.930 fps ts mono/EoF 52 (4) [-] top 52 614400 B 675.184516 675.184546 2.930 fps ts mono/EoF 53 (5) [-] top 53 614400 B 675.525801 675.525851 2.930 fps ts mono/EoF 54 (6) [-] top 54 614400 B 675.867080 675.867107 2.930 fps ts mono/EoF 55 (7) [-] top 55 614400 B 676.208362 676.208390 2.930 fps ts mono/EoF 56 (0) [-] top 56 614400 B 676.549648 676.549684 2.930 fps ts mono/EoF 57 (1) [-] top 57 614400 B 676.890928 676.890965 2.930 fps ts mono/EoF 58 (2) [-] top 58 614400 B 677.232213 677.232262 2.930 fps ts mono/EoF 59 (3) [-] top 59 614400 B 677.573490 677.573518 2.930 fps ts mono/EoF Captured 60 frames in 20.479839 seconds (2.929710 fps, 1800014.106820 B/s). 8 buffers released.
Also, I don't get why I am getting 2.930 fps in the output of yavta command. I am setting fps to 30 as default in the probe() function of the driver code (attached below).
fmt = &sensor->fmt;
fmt->code = MEDIA_BUS_FMT_YUYV8_2X8;
fmt->colorspace = V4L2_COLORSPACE_SRGB;
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
fmt->width = 640;
fmt->height = 480;
fmt->field = V4L2_FIELD_NONE;
sensor->frame_interval.numerator = 1;
sensor->frame_interval.denominator = ov5640_framerates[OV5640_30_FPS];
sensor->current_fr = OV5640_30_FPS;
sensor->current_mode =
&ov5640_mode_data[OV5640_MODE_VGA_640_480];
sensor->last_mode = sensor->current_mode;
sensor->ae_target = 52;
I am using the following command to play the steam on my PC -
ffplay -pixel_format yvyu422 -video_size 640x480 -i yuyvOLD.yuv
ffplay version 4.2.4-1ubuntu0.1 Copyright (c) 2003-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[rawvideo @ 0x7fe9ac000bc0] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'yuyvOLD.yuv':
Duration: 00:00:02.40, start: 0.000000, bitrate: 122880 kb/s
Stream #0:0: Video: rawvideo (YVYU / 0x55595659), yvyu422, 640x480, 122880 kb/s, 25 tbr, 25 tbn, 25 tbc
Also, the output I am getting is completely green and pink images on the player.


Please note that I don't have any display device connected to the custom board as of now. Hence, I am first capturing the stream in a file and then playing it on PC.
Kindly suggest why I am getting the incorrect output. Also, is there any other utility by which I can capture correctly from the camera device?
Regards,
Devashish