v4l2 does not find connected camera (VIDIOC_S_FMT)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

v4l2 does not find connected camera (VIDIOC_S_FMT)

1,137 Views
DYD
Contributor I

It seems that my code does not recognize a camera detected to it (with no I2C).

For a project I am trying to connect a camera with a Google Coral board running mendel. However there is a bridge between this camera and the board which converts the camera output to MIPI. In my code I try to adjust the fmt parameters by calling VIDIOC_S_FMT here:

        CLEAR(fmt);   // set the format of the v4l2 video

    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;

    if (-1 == xioctl(fd, VIDIOC_G_FMT, &fmt))
            errno_exit("VIDIOC_G_FMT");

    printf("fmt.fmt.pix.width = %d\n", fmt.fmt.pix.width);
    printf("fmt.fmt.pix.pixelformat = %d\n", fmt.fmt.pix.pixelformat);

    printf("Set RGB888\r\n");
    fmt.fmt.pix.width       = 640; //replace
    fmt.fmt.pix.height      = 483; //replace
    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;; //replace
    fmt.fmt.pix.field       = V4L2_FIELD_ANY;

    printf("fmt fields adjusted\n");
    printf("fmt.type = %d\n", fmt.type);

    if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt)){
              switch (errno) {
              case EAGAIN:
                      printf("EAGAIN\n");
                      break;

              case EINVAL:
                      printf("EINVAL, fmt.type field is invalid\n");
                      break;

              case EBADR:
                      printf("EBADR\n");
                      break;

              case EBUSY:
                      printf("EBUSY\n");
                      break;

              /* fall through */
            }
            errno_exit("VIDIOC_S_FMT");
    }

However, this gives the following output with the error:

fmt.fmt.pix.width = 0
fmt.fmt.pix.pixelformat = 0
Set RGB888
fmt fields adjusted
fmt.type = 1
VIDIOC_S_FMT error 19, No such device

Hence I think the board just does not recognize the fact that a camera is connected. If I do: v4l2-ctl -d0 --list-formats-ext I get :

ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

Is my thinking correct? And if so, why could it be that the board does not recognize the camera?

0 Kudos
Reply
1 Reply

1,114 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello DYD,

You can send your issue at: coral-support@google.com.

 

Regards

 

0 Kudos
Reply