Camera problems

Hello again! (I really need to stop in here when things are good so I am not just the guy who has problems!!) Right now I am having an issue getting a camera to play nice. I picked up an Arducam IMX519 (Amazon.com: Arducam for Raspberry Pi Camera 16MP IMX519 Camera Module with 140°(D) Wide Angle M12 Lens for Raspberry Pi and OpenHD : Electronics) and have been kicking it around for a bit with no luck. I ran the command to capture a still image and received an error. The command I tried was :

gst-launch-1.0 qtiqmmfsrc camera=0 num-buffers=150 ! videoconvert ! jpegenc ! filesink location=test_csi1.jpg

The error received was this:

gbm_create_device(192): Info: backend name is: msm_drm
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstQmmfSrc:qmmfsrc0: Camera service has died !
Additional debug info:
/Tachyon/build-qti-distro-ubuntu-fullstack-debug/tmp-glibc/work/aarch64-oe-linux/gstreamer1.0-plugins-qti-oss-qmmfsrc/1.0-r0/gst-plugin-qmmfsrc/qmmf_source.c(522): qmmfsrc_event_callback (): /GstPipeline:pipeline0/GstQmmfSrc:qmmfsrc0
Execution ended after 0:00:20.497937411
Setting pipeline to NULL ...
Freeing pipeline ...

Any thoughts, ideas, or sad faces appreciated.

Hi @NetApex !

Appreciate you giving the camera a try! I have a very similar camera that does work. It looks like the one you have just has a wide angle lens, so hopefully the rest of the hardware works the same. Lets check the obvious stuff first.

  1. Are you using the 22 pin cable as shown in the camera setup docs? I noticed the camera you linked only ships with the 15 pin 1.0 mm pitch cable. This connector only has 2 CSI lanes and wont work with tachyon. You need the 22 pin 0.5 mm pitch cable with all 4 lanes. I have a set of these just to make sure I have a cable that will work with any SBC.
  2. Are you using the CSI1 slot? You can use the DSI/CSI2 slot, but will need to configure the port for CSI operation first
  3. Before launching the gst pipeline, you will need to do the following:
export XDG_RUNTIME_DIR=/run/user/root

I noticed this wasnt explicit in the docs, I will make a note to add it!
Additionally, if you do not want to run the pipeline under root/ sudo, you can add your user to the video group

$ sudo usermod -a -G video particle

(ill add this to the docs as well).

As the particle user in the video group, I can run the following pipeline (it will run continuously, so control-c to interrupt it and close the pipeline) and record still images:

particle@tachyon-fd6e0b17:~$ gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf \
> ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 \
> ! jpegenc \
> ! multifilesink location=/home/particle/snapshot.jpg
gbm_create_device(192): Info: backend name is: msm_drm
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
Waiting for EOS...
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:00:07.310100969
Setting pipeline to NULL ...
Freeing pipeline ...

I can run your pipeline, but I think the missing video encoding parameters just result in a blank image

gst-launch-1.0 qtiqmmfsrc camera=0 num-buffers=150 ! videoconvert ! jpegenc ! filesink location=test_csi1.jpg
gbm_create_device(192): Info: backend name is: msm_drm
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:52.012122961
Setting pipeline to NULL ...
Freeing pipeline ...

Can you try with explicit video format parameters like in the example pipeline? Once you can confirm the hardware is working, I would experiment with different pipeline parameters.

The last comment ill make is about the specific error

ERROR: from element /GstPipeline:pipeline0/GstQmmfSrc:qmmfsrc0: Camera service has died !

You can check and restart the camera service via

particle@tachyon-fd6e0b17:~$ systemctl status qmmf-server.service
● qmmf-server.service - QMMF Server Service
     Loaded: loaded (/usr/bin/qmmf-server; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-06-18 04:29:47 CST; 1 years 0 months ago
   Main PID: 3301 (C3-0-Handler)
      Tasks: 19 (limit: 5763)
     Memory: 333.6M
     CGroup: /system.slice/qmmf-server.service
             └─3301 /usr/bin/qmmf-server

Warning: some journal files were not opened due to insufficient permissions.

It should automatically restart if it crashes, but just in case you can manually restart it via

$ sudo systemctl restart qmmf-server.service

Ill add these notes to the caveats section as well.

so tl;dr

  • Check the cable / CSI connector
  • Run the EXPORT command above before using the pipeline + run as root or in video group
  • Try the example pipeline to see if the hardware works at all, then experiment with extra parameters
  • Manually check/restart the camera service if needed

Let me know how things go!

Hello sbrust, thanks for the reply. Ok let's go through this!

  1. Yes I am using the 22 pin cable (which even though it specifically said would not be included, was actually included in the box lol. I had a spare anyway, so I guess I still have a spare for later.)
  2. I am also using the CSI slot. I am hoping to need a LOT more of these, and wanted the path of least resistance. One less bit of code that has to be run means one less chance of something being forgotten. Plus who knows, I might need to someday add a screen.
  3. This was something I needed to do so thank you for that part!!

Right now I am still running everything as root. I will add a user once I get everything working... and see if I break something doing that by forgetting a permission somewhere.

When I run the example, things seem to be going well. I hit CTRL-C and I get

EOS on shutdown enabled -- Forcing EOS on the pipeline

(I then went out to grab food and came back to the same status.)

As for the error about the camera service. It does start back up each time, but I think the dying might have been caused by the lack of the export command earlier? (Just spitballing, no facts to back it up) It hasn't happened since though so that's my logic.

When I run the example, things seem to be going well. I hit CTRL-C and I get

EOS on shutdown enabled -- Forcing EOS on the pipeline

(I then went out to grab food and came back to the same status.)

To be clear, the pipeline did not exit and things hung at that point?
Was there a file created on disk where you specified? Just curious if the hardware captured anything.

I had to hit control C again to get anything to happen which stopped the process and it then created a byte file.

Can you share the exact pipeline command you are running? Did it create an actual image file?
Ill get the same camera and see if I can reproduce the problem.

Sure thing!

gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! jpegenc ! multifilesink location=snapshot.jpg

Which this time lead to :

So I guess that it still does die from time to time. Anyway, once I got to the waiting for the EOS again it hung up so I had to control-c. That brought up the critical error of it trying to stop while in a paused state instead of a null state (which makes sense), so I had to control-c again to get out of that. When I break things, I break them good it seems. This time, it didn't create any file.

Thanks, I will test out the same hardware when I receive it and see if I can reproduce the problem

1 Like

I really hope it is just something dumb that I am doing wrong.

Apologies for the delay, it took a while for the camera to arrive.
I tested the hardware and I see the same thing as you: the pipeline hangs when interrupted and no image file is written. So it seems something is different with this camera compared to other IMX 519 cameras. We will have to debug this a little bit and see whats going on.

I know its not ideal to buy a new camera, but this camera does work if you need to get something working right now while we investigate.

1 Like

I appreciate you taking the time to test it. I'll grab the other one for now just so I can move forward. I'm glad that I could be helpful in beta testing (Sorry to bring up problems though)

I received the new camera and wouldn't you know it... running the command you have above gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! jpegenc ! multifilesink location=test_image.jpg
and it too hung stopping the pipeline. I am starting to think I am camera cursed.

Apologies for the delays over the US holiday.

After talking with our hardware team, the issue may be with the CSI cable itself. We may be out of tolerances with the PHY on the SG560D so camera behavior may be unreliable. Ill share any new developments as soon as I get them, sorry for all the trouble!

1 Like