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.

select() timeout in V4L2 video capture example

Other Parts Discussed in Thread: TVP5146

I'm trying to use a dm355-leopardboard to capture images.

When I execute the capture example from the Video for Linux Two API Specification, it always time's out on the select() call. I'm not sure where to start looking for the cause of this problem. The ccdc and camera are passing registration.

[    2.020000] vpfe_init
[    2.020000] vpfe-capture: vpss clock vpss_master enabled
[    2.030000] vpfe-capture: vpss clock vpss_slave enabled
[    2.040000] vpfe-capture vpfe-capture: v4l2 device registered
[    2.040000] vpfe-capture vpfe-capture: video device registered
[    2.050000] mt9v113 1-003c: Detected a mt9v113 chip ID 2280
[    2.170000] mt9v113 1-003c: mt9v113 1-003c decoder driver registered !!
[    2.180000] vpfe-capture vpfe-capture: v4l2 sub device mt9v113 registered
[    2.190000] vpfe_register_ccdc_device: DM355 CCDC
[    2.190000] DM355 CCDC is registered with vpfe.

Furthermore, by inspecting the electrical interface to the camera, I have verified that the camera is transmitting pixel data.

What things would cause select() to timeout? Should I look for something in the drivers?

I'm using kernel version  Arago/2.6.31+2.6.32-rc2-r52+gitr.

Thanks,
David
  •  

    Hi,

     

    Are you able to capture images from the camera using your v4l2 application.Also if you could please share your application with me.I am also struggling to

    do the capture from dm368 evm board.Let me see if i am also facing similar issues as you are facing.Also are you using aptina sensor.

     

    Thanks and Regards,

    Mayank

     

     

     

  • Hi David,

     

     

    I also tried running the similar application on my DM368 evm board.But i am getting error message like given below:

     

    ./v4l2capture.out                                                            
    Cannot identify '/dev/video': 2, No such file or directory

     

    If you got similar error message before and how did you rectify that.In my /dev dircetory there are video0,video2,video3 devices showing.

     

     

    Thanks and Regards,

    Mayank

  •  

     

    Dear David,

     

    Please help me in getting the output image.I am also using DM355 leopard board with aptina mt9m112 image sensor daughter card.

    Please tell me the steps how can i run v4l2 application on tis kind of set up.Should we need to implement the driver for the image sensor first.

    Also what could be the steps for first testing the vpfe and then the image sensor and then finally getting the desired output image.

     

    Thanks and Regards,

    Mayank

  • Mayank,

    I welcome the offer to work through this together! I still have not been able to capture an image.

    Let's start with some basic information. My setup is as follows:

    • DM355 LeopardBoard
    • Aptina mt9v113 VGA sensor board from Leopard Imaging.
    • Kernel version Arago/2.6.31+2.6.32-rc2-r52+gitr

    Please provide the same details for your setup.

    Where did you find the capture example? The one in the spec. hosted at bytesex (http://v4l2spec.bytesex.org/spec/a16706.htm) is different than the one at linuxtv (http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html).

    From the error message you are getting ("Cannot identify '/dev/video': 2, No such file or directory") it appears that you are using the bytesex version. I ran into the same problem. You have to pass the device name as a parameter as such: ./v4l2capture.out -d /dev/video0. The linuxtv version defaults to video0. Does this help?

    When I run the bytesex example, it always time's out at the select() call in mainloop(). It appears that the vpfe-capture driver isn't capturing pixels. Any idea what would cause this error?

    The linuxtv version doesn't give the select() timeout error, but instead, reports problems with the buffers. Using the default options, I get "mmap error 22, Invalid argument" and using the -u option, I get "VIDIOC_QBUF error 22, Invalid argument".

    Here are the steps I've taken:

    1. Get the kernel to register the imager during boot up. Initially the vpfe-capture driver registered fine, but the imager always failed registration as a sub device. I eventually concluded that the mt9v113 and mt9m112 imager drivers included in my kernel version did not support the v4l2 sub device framework.
    2. I created a mt9v113 driver and it now registers correctly (see my initial post).
    3. I used an oscilloscope to verify that the sensor is transmitting pixel data.
    4. At this point, I moved on to the v4l2 capture examples which give the errors described above.

    I'm reasonably sure that the imager is correctly transmitting the image. It seems to be a problem on the vpfe side. It would be nice if I could test the vpfe without the imager. I vaguely remember reading that the vpfe had a test image mode. Perhaps that can be used to test the vpfe by itself.

    I look forward to your response.

    David

     

  •  

    Dear David,

     

    Thanks for your response.I am still stuck up in getting the image with DM355.

    I tried to run the v4l2 application but i was getting the segmentation fault.

    Please clear my following queries:

    1. Get the kernel to register the imager during boot up. Initially the vpfe-capture driver registered fine, but the imager always failed registration as a sub device. I eventually concluded that the mt9v113 and mt9m112 imager drivers included in my kernel version did not support the v4l2 sub device framework.

                 How did you get the kernel to register the image during boot up.There are mt9m112/3 related .c and .h files in linux/media/video/drivers/davinci and also i can enable the mt9m112/3 drivers in SOC camera support in make menuconfig options.But even after doing this i am not able to get mt9v113/mt9m112 registered as device.There are no drivers generated in /dev dircetory related to these imagers. Also v4l2 application is failing.

     

    1. I created a mt9v113 driver and it now registers correctly (see my initial post).

    Do you refer to any driver file to write the driver for mt9v113 file.Please refer me to that file.Also how did you register it.Did you created the .ko file for the same and inserted it into the kernel manually using the insmod or did you try any other method.

    1. I used an oscilloscope to verify that the sensor is transmitting pixel data.

    Is there any code or program or method that the mt9v113 daughter card attached to DM355 board can be detected.Right now i am totally clueless on this issue.

    1. At this point, I moved on to the v4l2 capture examples which give the errors described above.

    Are you able to overcome your issue and get the captured image.

    Thanks and Regards,

    Mayank Agarwal

     

  • MAYANK AGARWAL said:
    How did you get the kernel to register the image during boot up.There are mt9m112/3 related .c and .h files in linux/media/video/drivers/davinci and also i can enable the mt9m112/3 drivers in SOC camera support in make menuconfig options.But even after doing this i am not able to get mt9v113/mt9m112 registered as device.There are no drivers generated in /dev dircetory related to these imagers. Also v4l2 application is failing.

    I too was excited to see that driver, but in the end I concluded that it isn't written in a way that is compatible with the V4L2 subdevice framework. I found this

    http://processors.wiki.ti.com/index.php/DaVinci_PSP_03.01_Linux_Installation_User_Guide#Video_capture

    so decided to use the MT9T031 driver as a starting point to create a driver for the MT9V113.

    MAYANK AGARWAL said:
    Also how did you register it.Did you created the .ko file for the same and inserted it into the kernel manually using the insmod or did you try any other method.

    I added the new driver to the build files and to menuconfig. Now I can select it into the build process using menuconfig. You'll need to adjust the board file to point to the new camera.

    MAYANK AGARWAL said:
    Is there any code or program or method that the mt9v113 daughter card attached to DM355 board can be detected.

    Not that I know of. The only success I've had is as described above.

    MAYANK AGARWAL said:
    Are you able to overcome your issue and get the captured image.

    Not yet, I've spent the last couple days reading the V4L2 spec in detail. I have a much better understanding now. My next step is to dive back into the source code.

    The link I gave above says "The vpfe capture from MT9T031 requires following bootargs to be set:- vpfe_capture.interface=1. By default, vpfe capture has this variable set to 0 for tvp5146 capture.". Do you know where the code is checking this bootarg?

    David

     

  •  

     

    Hi David,

     

    Thanks for your previous mail.I am from India.

     

    I modified the board-dm355-evm.c file and in it give support for mt9m111(i2c_register_board_info) sensor in the same way as mt9t031(the code for which  is already present in the file).

    After that if i have to write an application calling the functions in mt9m111.c in order to detect image sensor.Or if i have to make modification in other files.Even

    after doing above my v4l2application is giving the same output segmentation fault somewhere in vpfe_open.

    According to what i have studied tvp5146 is serving as i2c master and we can configure mt9m111 as slave in order to make communication between the sensor

    and dm355.Is there any TI data sheet which explains how can i configure it as slave.I am not sure of my understanding also.

    In your case if you got the board to detect the image sensor,what extra settings or changes you did in order to do this.

     

     

     

    Thanks and Regards,

    Mayank

     

     

  • MAYANK AGARWAL said:

    I modified the board-dm355-evm.c file and in it give support for mt9m111(i2c_register_board_info) sensor in the same way as mt9t031(the code for which  is already present in the file).

    Are you using the evm or leopardboard? If you are using the leopardboard, you need to modify board-dm355-leopard.c.

    That's the only file you should have to change to get the board to look for a different image sensor. However, I don't think the mt9m111.c is compatible with the vpfe-capture driver. When I compared mt9t031.c to mt9m111.c they didn't look very similar.

    I doubt the tvp5146 is in master mode. I read somewhere that Linux does not support i2c slave mode. The evm has two image capture devices, the tvp5146 and the mt9t031. The bootarg I mentioned above let's you choose one or the other. The leopard board doesn't have the tvp5146, so you can disable the associated code.

    Here is my board file.

    5428.board-dm355-leopard.zip

  • hi

    David Novak

    hope u r still reading e2e

    i want to insert mt9v113 support in mt leopard board dm365

    for this i ve tried numerous ways but not succeded

    can u share ur mt9v113.c

    file

    it would be a gr8 help

    thanxx

    kailash