Display output from mipi camera

Hi,

I started using torizon to test the OV5640 Camera Module. I followed the guide mentioned here and here but could not get an output in the display. When trying the gstreamer command I get

root@apalis-imx8-06438733:/# gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! xvimagesink
Setting pipeline to PAUSED ...
No protocol specified
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Could not open display (null)
Setting pipeline to NULL ...
Freeing pipeline ...

The HDMI display is either blank or Portainer. I tried killing other docker images running but the results are the same. Any ideas?

Greetings @lsionzon,

I believe you’re having the same issue as seen here: https://www.toradex.com/community/questions/51496/ov5640-camera-module-integration.html?smartspace=torizon

In short you need to use waylandsink instead of xvimagesink. This is because xvimagesink is meant for X-based graphics stacks which Torizon doesn’t use in it’s containers.

Try a pipeline similar to this: gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! waylandsink -v

Best Regards,
Jeremias

Hi @jeremias.tx ,

I tried as you’ve suggested but still got the same error. Btw, does portainer running during startup be a problem with this? How can I disable all containers during startup. Restart-policy option does not work.

HI @lsionzon,

Yes it would be best to disable all other running containers when trying other graphical type containers. Currently we start Portainer on boot using a systemd service. This can be disabled with the following command: sudo systemctl disable docker-compose.

After that you can manually stop the containers from the command line.

Also what version of the OV5640 camera module are you using?

Please let me know if you continue to have further problems.

Best Regards,
Jeremias

Hi @jeremias.tx ,

The systemd command works and portainer is now disabled during startup.
I am still experiencing the same problem with the display though. It still says

root@apalis-imx8-06438733:/# gst-launch-1.0 v4l2src device='/dev/video4' ! video/x-raw,format=RGB16,width=1920,height=1080,framerate=30/1 ! waylandsink -v
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
WARNING: from element /GstPipeline:pipeline0/GstWaylandSink:waylandsink0: Could not initialise Wayland output
Additional debug info:
gstwaylandsink.c(333): gst_wayland_sink_find_display (): /GstPipeline:pipeline0/GstWaylandSink:waylandsink0:
Failed to create GstWlDisplay: 'Failed to connect to the wayland display '(default)''
Setting pipeline to NULL ...
Freeing pipeline ...

As for the camera module we are using Pcam 5C, it has the same sensor and connects via the MIPI CSI-2 interface. Using kernel 4.14.159, I was able to capture pictures and videos to file without modification to the kernel or DTB image.

Best Regards,

Leonardo

Hi @lsionzon , if you are using the camera module I sent you, wouldn’t it be OV5640 Camera Module V1.1B? Did you get correct output with that?

Is this the camera module with the same pinout and sensor used for introduction to TOA that Uchiumi-san found?

Let’s try to get our OV5640 Camera Module V1.1B working first and then confirm with the other cam, if sounds good.

I agree that it seems to be an “issue” with the waylandsinc but kindly confirm this info.

Kind regards,
Alvaro.

Hi @alvaro.tx ,

I think there’s nothing wrong with the camera. It can capture stills and video to file without modification to the kernel or DTB. I am having trouble with outputing to the main display though. GStreamer reports that it can’t connect to the display.

Best Regards,
Leonardo

Hi @lsionzon,

What is your Dockerfile and docker-compose file that you are using?

Can you try the Dockerfile and docker-compose files that the customer in this community post shared: https://www.toradex.com/community/questions/51496/ov5640-camera-module-integration.html?smartspace=torizon

But with the pipeline change.

Best Regards,
Jeremias

Hi @jeremias.tx and @alvaro.tx

I tried the docker-compose file in the linked provided and didn’t worked at first. I found the root cause to be my setup. I connected my host PC and the module to a single monitor and was switching display sources between them. I ran the docker-compose command in my host PC and when I switch I didn’t see the output from the camera. My guess is that Wayland or the kernel detected no active displays when I switched over to my host PC. If I run the docker-compose command in the module itself and it being the active display, the docker compose file worked perfectly.

Best Regards,
Leonardo

Noted. Thanks for the feedback @lsionzon !