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/AM5718: AM5718 custom board interfacing with camera sensor

Part Number: AM5718

Tool/software: Linux

Hi All,

We have developed one custom board based on AM5718 soc for interfacing of camera sensor.

Now We are able to get the data from sensor in which we get the whole frame using below yavta command. Now we need to get the sensor data line by line instead of whole image so please provide us the details how we got the sensor data line by line.
Command : yavta -f SGRBG8 -s 4208x3120 --capture=1 --file=image.raw -F /dev/video0

FYI: we are currently using TI-cal driver.
LINK:processors.wiki.ti.com/.../Linux_Core_CAL_User's_Guide

Thanks,

Simit

  • Hello,

    Sensor data read line by line is not supported.
    Refer the below thread(at the end of the page 2):
    e2e.ti.com/.../747473

    BR
    Margarita
  • Hi,

    Margarita

    Thanks for the reply.

    We are using yavta application with ti-cal driver to get the image data using MMAP.So that we need to use memcpy.which is comparetively very slow.

    Now to improove speed we want to use V4L2_MEMORY_DMABUF instead of V4L2_MEMORY_MMAP.So is there any example that i can use.

    Or is there any specific application which would help me to achive this.Would i need to change anything in driver to get DMA BUF work.

    Thanks,

    Simit

  • Hello,

    This is what ti-cal supports:
    - Supports MMAP buffers (allocated by kernel from global CMA pool) and also allows to export them as DMABUF
    - Supports DMABUF import (Reusing buffers from other drivers)

    You are search for something like this demo :
    psdk/example-applications/dual-camera-demo-1.0/loopback.c right?
    software-dl.ti.com/.../Examples_and_Demos_Application_Demos.html

    BR
    Margarita
  • hi,

    -Supports MMAP buffers (allocated by kernel from global CMA pool) and also allows to export them as DMABUF

    how do i configure this .

    You are search for something like this demo :
    psdk/example-applications/dual-camera-demo-1.0/loopback.c right?
    -> No , i want to remove the use of memcpy in my application to improve speed .So that as per my search i got to know about dmabuf so i want to know about it in more details. So i can use it in my existing yavta application and boost up the speed.

    Thanks,
    Simit
  • Hi,

    Margarita

    This is just Gentle reminder.

    Thanks,

    Simit

  • Hello Simit,

    Please take a look into these answers:
    e2e.ti.com/.../2293561
    e2e.ti.com/.../2168020
    I would recommend you to take a look again in my previous answer (guide and the demo).

    BR
    Margarita

  • Thanks Margarita,

    We have checked your suggested link and we tried to compile the dual-camera app but we got some dependency issue.
    can you guide me how we will compile this app for our custom am5718 board.
    We are using kernel : Linux am57xx-evm 4.9.59-ga75d8e9305

    Thanks,
    SImit
  • Hello,

    The source code could be found in example-applications folder.
    You could try to build it by enter in ti-processor-sdk-linux-am57xx-evm-0x.00.00.x and execute make dual-camera-demo
    or follow this guide:
    processors.wiki.ti.com/.../Processor_SDK_Building_The_SDK but use
    MACHINE=am57xx-evm bitbake dual-camera-demo instead of MACHINE=<target-board> bitbake arago-core-tisdk-image

    BR
    Margarita
  • Hello,

    Thanks for the support.
    I have installed successfully dual-camera-demo but when i run it on using below command
    $dual_camera -platform linuxfb 1
    It will give me below error

    Capture 0: Opened Channel

    Capture 0: Capable of streaming

    VIDIOC_G_PARM: Inappropriate ioctl for device
    first camera detection failed

    Capture 1: Opened Channel

    Capture 1: Capable of streaming

    Capture 1: Init done successfully

    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    Running the demo on am57xx processor
    Segmentation fault (core dumped)

          OR


    $dual_camera -platform linuxfb 0
    Capture 0: Opened Channel

    Capture 0: Capable of streaming

    VIDIOC_G_PARM: Inappropriate ioctl for device
    first camera detection failed

    Capture 1: Opened Channel

    Capture 1: Capable of streaming

    Capture 1: Init done successfully

    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    ERROR:v4l2_queue_buffer:425: VIDIOC_QBUF failed: Bad address (-1)
    Running the demo on am57xx processor
    Segmentation fault (core dumped)

    Now i have gone through the code and find that it needs 2 video node so i have enabled second node by using "modprobe vivid".

    But Still the issue is same.

    One more thing that i want to know is is that possible to change this application for one video input only?
    What changes needs to be done to do so.

    Thanks,
    Simit

  • Hello,

    There is no need 2 cameras to be connected. I can run it with camera module(vip)+evm without second camera.
    Please take a look is this patch applied git.ti.com/.../a0af4124c35edb2713887f4d3ec14a30844b3f99

    My point was to refer the code of this demo and what it demonstrates that you could use in your demo.

    BR
    Margarita
  • Hello,

    I am testing dual_camera app with ti_vpe driver.and it gives me following error.

    root@am57xx-evm:~# dual_camera -platform linuxfb -1

    main_1
    Cannot open /dev/video1 device
    first camera detection failed

    Capture 1: Opened Channel

    Capture 1: Capable of streaming

    VIDIOC_G_PARM: Inappropriate ioctl for device
    No camera detected
    main_0
    Unable to figure out framebuffer device. Specify it manually.
    linuxfb: Failed to initialize screen
    Segmentation fault (core dumped)

    would you please guide me on this.Because when i try to check dual-camera app with my sensor driver it will failed too.So just to see the demo i am trying to port it with ti_vpe.

    Is there any other way to port this application with only one connector and also with ti_cal?

    Thanks,

    Simit

  • Hello,

    There is one demo that you could check

    Use CAL to capture a 1280x800 YUYV video stream and display it on an HDMI display using DMABUF buffers.

    dmabuftest -s 36:1920x1080 -c 1280x800@YUYV -d /dev/video1

    Hope this helps.

    BR
    Margarita
  • Hello,

    Thanks for the support.

    Our board is not contain any display connector (i.e. HDMI).

    Thanks,

    Simit

  • Hello Margarita,

    Gentle reminder.

    we followed Example which was suggest and we try lots but still we did not get any success.
    can you help for just simple example of reading sensor data from sensor and stored in buffer using DMA? it would be great help us because we are new to DMA.

    Thanks & Best Regards,
    Simit
  • Hello,

    Unfortunately, we don’t have any AM57x EVM board with CSI-2 interface so I can not give a try.
    But any v4l2 based capture application can be used, so please refer the demos like dual-camera demo and dmabuftest for example.

    BR
    Margarita
  • Hello,

    it will be enough if you will provide us the simple DMA based captured example for ti-vpe [parallel connection which is available on evaluation board] 

    Thanks,

    Simit


  • Hi magrita/manisha,

    we took the reference of your suggested example[dual-camera-demo] and modify this code for just capture and save to jpg image. Right now we are success to capture the camera image in jpeg file when cmem is false but this method still took much time to copy buffer. we try with enabling cmem macro but code gives "segmentation fault"[run time error] during the "jpegWrite(cap_buf, status.num_jpeg, v4l2_device->width, v4l2_device->height)" api call. Please find attached zip file which contain our modified code.

    it would be great help if you will review our code and guide us for required changes to stored camera image in jpeg.

    Thanks,

    Simit

    git.zip

  • Hello,

    I have tried on my side our dual_camera demo:



    root@am57xx-evm:/usr/bin# ./dual_camera -platform linuxfb 1
    CRTCs size: 800x480

    Capture 0: Opened Channel

    Capture 0: Capable of streaming

    Capture 0: Init done successfully


    Allocating memory from CMEM pool
    CMEM buffer pointer is 0xb3015000
    fourcc:1448695129, fb_id 61

    Allocating memory from CMEM pool
    CMEM buffer pointer is 0xb2f2a000
    fourcc:1448695129, fb_id 63

    Allocating memory from CMEM pool
    CMEM buffer pointer is 0xb2e3f000
    fourcc:1448695129, fb_id 64

    Capture 1: Opened Channel

    Capture 1: Capable of streaming

    VIDIOC_G_PARM: Inappropriate ioctl for device
    Only one camera detected
    Running the demo on am57xx processor
    w=800, h=600
    ...

    But the resolution in my case is 640c480
    I have not modified nothing in the demo.
    Are you able to capture lower resolution?
    Are you using the latest version of dual_camera demo in latest PSDK?

    git.ti.com/.../loopback.c

    BR
    Margarita

  • Hello,

    In additional for psdk 4x you could check these threads:
    e2e.ti.com/.../659808
    e2e.ti.com/.../672041

    BR
    Margarita
  • Hi Margarita,

    Thanks a lot for the support.
    Now i am able to capture images using loopback example.
    But one thing is that when i will try to capture frames of different resolution in 1 minute then for different resolution speed is same.

    Like if i will set resolution 640*480 then in 1 minute i am able to call process_frame 1773 times .And if i change resolution to 4208*3120 still the execution of process_frame is 1779 times.

    So would you please let me know is there any changes need to be done for different resolution.

    What i have observed is that in this scenario it will stuck many times in DEQUEUE process .Is there any limitation of ti-cal.or camera sensor while capturing data ?

    Thanks,
    Simit
  • Hi Margarita,

    i am working on dual-camera-demo to achiieve functionality i want to. So i have made many changes which is here attached.

    One problem that i am facing in this is when ever i will try to set different format from existing one i will get the below error.

    VIDIOC_S_FMT: Device or resource busy

    I have tried many methods to solve this issue will you please guide me to overcome this problem.

    Will you please look at below attached code .Specially loopback.c in function int main(). Where i want to set different resolution after capture successfully one image.

    One thing that i want to mention here is i don't want to close fd of device whenever i will set resolution.So that's why i have made some changes in exit sequence.

    Thanks,

    Simit

    dual-camera-demo-modified.zip

  • Hello,

    Please open a new thread about this question.
    Thank you!

    BR
    Margarita