This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5708: Getting black & white image for RGB565 format from OV5640 camera with AM5708

Part Number: AM5708

Tool/software: Linux

Hi,

I'm using OV5640 Camera sensor on CSI2 interface of AM5708 based board.

When I select UYVY format from driver and take video from camera, I'm getting perfect video.

But, when I select RGB565 or RGB555 format from driver and take video from it, I'm getting black & white video.

These UYVY, RGB565 and RGB555 formats are supported from camera sensor.

So, I want to if AM5708 CSI interface supports this RGB565/RGB555 format or not ?

And if it does support this format, then what could be the problem ?

I'm using gstreamer pipeline for taking video from camera. Here are the command I'm using for it,

gst-launch-1.0 -e v4l2src device=/dev/video0 num-buffers=10 ! 'video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=30/1'  !  filesink location=/mnt/data/UYVY_1.yuv


gst-launch-1.0 -e v4l2src device=/dev/video0 num-buffers=10 ! 'video/x-raw, format=(string)RGB16, width=(int)1280, height=(int)720, framerate=30/1'  !  filesink location=/mnt/data/RGB16_1.rgb

Need some input on this.

Thanks,

Gunjal

  • Hello,

    Here you could check what are the formats that cal driver supports:
    processors.wiki.ti.com/.../Linux_Core_CAL_User's_Guide
    I would recommend you to try yavta.

    Hope this helps.

    BR
    Margarita
  • Hi,

    Thanks for the recommendation.

    However I'm getting similar output from yavta which I was getting from gstreamer pipeline.

    Here are the details of my problem,

    I'm selecting RGB565_LE mode from my driver.

    The commands I'm using to dump a video and it's output,

    root@board:~# yavta --enum-formats /dev/video0
    Device /dev/video0 opened.[  693.224071] ## v4l_fill_fmtdesc: pixelformat = 1346520914 ##
    
    Device `cal' on `platform:cal-000' is a video output (without [  693.232028] ## In RGB565
    mplanes) device.
    - Available formats:
            Format 0: RGB565 (50424752)
            Type: Video capture (1)
            Name: 16-bit RGB 5-6-5
            Frame size: 176x144 (1/15, 1/30)
            Frame size: 320x240 (1/15, 1/30)
            Frame size: 640x480 (1/15, 1/30)
            Frame size: 720x480 (1/15, 1/30)
            Frame size: 720x576 (1/15, 1/30)
            Frame size: 1024x768 (1/15, 1/30)
            Frame size: 1280x720 (1/15, 1/30)
            Frame size: 1920x1080 (1/15, 1/30)
            Frame size: 2592x1944 (1/15, 1/30)
    
    Video format: RGB565 (50424752) 1280x720 (stride 2560) field none buffer size 1843200
    
    root@board:~# yavta -c10 -fRGB565 -F/mnt/data/Y_RGB565_2.rgb -s1280x720 /dev/video0                                                                                                                   
    Device /dev/video0 opened.
    Device `cal' on `platform:cal-000' is a video output (without mplanes) device.
    Video format set: RGB565 (50424752) 1280x720 ([   71.547029] ## v4l_streamon ##
    stride 2560) field none buffer size 1843200
    Video format: RGB565 (50424752) 1280x720 (stride 2560) field none buffer size 1843200
    8 buffers requested.
    length: 1843200 offset: 0 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xb6c56000.
    length: 1843200 offset: 1843200 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xb6a94000.
    length: 1843200 offset: 3686400 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xb68d2000.
    length: 1843200 offset: 5529600 timestamp type/source: mono/EoF
    Buffer 3/0 mapped at address 0xb6710000.
    length: 1843200 offset: 7372800 timestamp type/source: mono/EoF
    Buffer 4/0 mapped at address 0xb654e000.
    length: 1843200 offset: 9216000 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xb638c000.
    length: 1843200 offset: 11059200 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xb61ca000.
    length: 1843200 offset: 12902400 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xb6008000.
    0 (0) [-] none 0 1843200 B 71.913254 71.913279 18.795 fps ts mono/EoF
    1 (1) [-] none 1 1843200 B 71.946588 71.990857 29.999 fps ts mono/EoF
    2 (2) [-] none 2 1843200 B 71.979923 72.068179 29.999 fps ts mono/EoF
    3 (3) [-] none 3 1843200 B 72.013259 72.145686 29.998 fps ts mono/EoF
    4 (4) [-] none 4 1843200 B 72.046594 72.223280 29.999 fps ts mono/EoF
    5 (5) [-] none 5 1843200 B 72.079927 72.300632 30.000 fps ts mono/EoF
    6 (6) [-] none 6 1843200 B 72.113263 72.379549 29.998 fps ts mono/EoF
    7 (7) [-] none 7 1843200 B 72.146596 72.457329 30.000 fps ts mono/EoF
    8 (0) [-] none 8 1843200 B 72.179932 72.534793 29.998 fps ts mono/EoF
    9 (1) [-] none 9 1843200 B 72.279936 72.612212 10.000 fps ts mono/EoF
    Captured 10 frames in 0.752163 seconds (13.294990 fps, 24505326.018960 B/s).
    8 buffers released.

    Then, when I play this video on local PC with ffplay, I'm getting following ouput.

    ffplay -v info -f rawvideo -pixel_format rgb565le -video_size 1280x720 Y_RGB565_2.rgb,

    And,

    ffplay -v info -f rawvideo -pixel_format bayer_rggb16le -video_size 1280x720 Y_RGB565_2.rgb,

    Playing with rgb565le format in ffplay, I'm not getting proper image.

    Playing with bayer_rggb16le format in ffplay, I'm getting the image but it's black & white.

    Can you tell me what could be the problem?

    Thanks,

    Gunjal

     

  • Here's the UYVY image to compare with,

  • Hello,

    Thank you for sharing the pictures.
    Let me confirm that the cal driver could capture in MEDIA_BUS_FMT_RGB565_2X8_LE but it seems it can(refer cal.c file).
    On other hand I have checked ov5640.c (in PSDK 5.02, linux version 4.14.79+) and it seems it could capture in sensor->fmt.code = MEDIA_BUS_FMT_UYVY8_2X8 only.

    BR
    Margarita

  • Yes, by default in ov5640.c driver configures as,

    sensor->fmt.code = MEDIA_BUS_FMT_UYVY8_2X8

    But, I changed in driver to MEDIA_BUS_FMT_RGB565_2X8_LE to test in RGB mode as it is given in ov5640 datasheet that it supports RGB565 and RGB555 modes.

  • Hello,

    I found this patch how to add RGB to ov5640.
    patchwork.kernel.org/.../
    but I can not find for which kernel version is.

    Hope this helps.

    BR
    Margarita
  • Thank you, it did help.
    I'm getting proper images in RGB565 format as well now.

    Regards,
    gunjal

  • Hello,

    I am glad that this issue is solved.
    Thank you!

    BR
    Margarita