External trigger not working: black screen, libcamera timeout on Arducam Pivariety Raspberry Pi Bullseye

Hi everyone, I’m trying to get external triggering working on my Arducam Pivariety camera (the mono version) and I’m completely stuck. I’m feeding a 100 microsecond pulse at the documented voltage, but all I get is a black screen with no capture. libcamera-still just reports a timeout and then tries to restart. I also can’t find the rpi_apps.yaml file anywhere in my project folders like the docs mention.

Here’s my setup:
Hardware Revision: c03111
Kernel: 6.1.21-v8+
OS: bullseye
Arch: aarch64
Camera: arducam-pivariety (mono)

I was following this guide: External Trigger Mode - Arducam Wiki

Any ideas?

Thanks for the details. Can you confirm exactly what commands you ran to put the camera into trigger mode, and what timeout setting you used? Also, could you paste the full output from your libcamera-still command? The error text matters a lot here.

Sure. I set external trigger mode with:

v4l2-ctl -d /dev/v4l-subdev0 -c trigger_mode=1

Then I set the timeout variable with:

export LIBCAMERA_SET_TIMEOUT=1000000

(though I did also mistype it once as LIAMERA_SET_TIMEOUT by accident)

Then I ran:

libcamera-still -t 0 --shutter 1000

It still timed out. Here’s the full output:

Made X/EGL preview window
[0:03:37.338864420] [1852] INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4225-f155393c
[0:03:37.395143455] [1854] WARN CameraSensorProperties camera_sensor_properties.cpp:243 No static properties available for ‘arducam-pivariety’
[0:03:37.395244233] [1854] WARN CameraSensorProperties camera_sensor_properties.cpp:245 Please consider updating the camera sensor properties database
[0:03:37.415204603] [1854] ERROR IPAProxy ipa_proxy.cpp:149 Configuration file ‘arducam-pivariety_mono.json’ not found for IPA module ‘raspberrypi’
[0:03:37.588079173] [1854] INFO RPI raspberrypi.cpp:1485 Registered camera /base/soc/i2c0mux/i2c@1/arducam_pivariety@c to Unicam device /dev/media2 and ISP device /dev/media1
[0:03:37.589252451] [1852] INFO Camera camera.cpp:1028 configuring streams: (0) 1280x400-YUV420
[0:03:37.663573467] [1854] INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0mux/i2c@1/arducam_pivariety@c - Selected sensor format: 1280x400-Y10_1X10 - Selected unicam format: 1280x400-Y10P
[0:03:38.909779772] [1854] WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[17:cap]: Dequeue timer of 1000000.00us has expired!
[0:03:38.909934439] [1854] ERROR RPI raspberrypi.cpp:2022 Unicam has timed out!
[0:03:38.909975754] [1854] ERROR RPI raspberrypi.cpp:2023 Please check that your camera sensor connector is attached securely.
[0:03:38.910011772] [1854] ERROR RPI raspberrypi.cpp:2024 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!

There are a couple of important clues in that log. The warning about ‘No static properties available for arducam-pivariety’ and especially the error ‘Configuration file arducam-pivariety_mono.json not found for IPA module raspberrypi’ tell me the Arducam-specific libcamera isn’t installed properly. The stock libcamera doesn’t know about this sensor. So the Arducam libcamera install never completed successfully.

Let’s start untangling that. Can you try removing the current libcamera0 package?

sudo apt remove libcamera0

Paste the output here.

Okay, I ran sudo apt remove libcamera0 and got this:

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
libcamera-apps : Depends: libcamera0 (>= 0~git20230310+1ca234a8) but it is not going to be installed
libcamera-dev : Depends: libcamera0 (= 0~git20230512+8689dd6b-1) but it is not going to be installed
libcamera-tools : Depends: libcamera0 (>= 0~git20230302+923f5d70) but it is not going to be installed
python3-libcamera : Depends: libcamera0 (>= 0~git20230302+923f5d70) but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).

Should I run apt --fix-broken install like it says?

This is the core problem, and I’d hold off on --fix-broken install for now. Your system has conflicting libcamera packages from different versions. Notice the version conflict: libcamera-dev wants 0~git20230512+8689dd6b-1, but 0~git20230512+f155393c-1 is what’s present. Leftover packages from different builds are fighting each other, which is exactly why the Arducam libcamera install never completed.

Have you tried running the Arducam install script for libcamera? Something like:

./install_pivariety_pkgs.sh -p libcamera_dev

If so, what did it print?

Yes, I tried ./install_pivariety_pkgs.sh -p libcamera_dev and got this:

Hardware Revision: c03111
Kernel Version: 6.1.21-v8+
OS Codename: bullseye
ARCH: aarch64
Downloaded libcamera_links.txt (7874 bytes), libcamera0_0_git20230724+ad9428b4-1_armhf.deb (654648 bytes), libcamera-dev_0_git20230724+ad9428b4-1_armhf.deb (24408 bytes)
libcamera-dev : Depends: libcamera0 (= 0~git20230512+8689dd6b-1) but 0~git20230512+f155393c-1 is to be installed
python3-libcamera : Depends: libcamera0 (>= 0~git20230720+bde9b04f) but 0~git20230512+f155393c-1 is to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

That last error is the giveaway: ‘Could not open lock file /var/lib/dpkg/lock-frontend - are you root?’. The install script needs root privileges. Can you check whether you’ve actually been running these commands with sudo? The package removal and install steps all need sudo, otherwise dpkg can’t acquire its lock and the install silently fails partway through.

Honestly I’m pretty new to Linux, and I think I’ve been missing sudo in several places. Some commands I ran without it, and that’s when I got the Permission denied errors. Let me go back and run everything properly as root.

That explains a lot. Here’s the full procedure to get a clean, matching set of libcamera packages:

  1. First remove the conflicting package:
    sudo apt remove libcamera0

  2. Then re-run the Arducam install script as root:
    sudo ./install_pivariety_pkgs.sh -p libcamera_dev

Also make sure you’re following the getting-started section of the Arducam libcamera guide: libcamera and rpicam-apps - Arducam Wiki

That should give you a consistent set of Arducam libcamera packages.

I’ll try that, thanks. One question though - the log also said ‘Please check that your camera sensor connector is attached securely’ and ‘try another cable and/or sensor’. Could the timeout actually be a physical connection problem rather than a software issue?

Good question. The ‘Unicam has timed out!’ message can point to a physical connection issue (connector/cable/sensor seating), but in your case the primary unresolved issue is almost certainly the incomplete Arducam libcamera install and the dependency conflicts. Fix the install first, then re-test the trigger.

If it still fails after the clean reinstall, please generate a bug report so we can dig deeper:

  1. Reboot your device.
  2. wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
  3. chmod +x ./arducam-camera-bug-report
  4. ./arducam-camera-bug-report
  5. Send the generated arducam-bug-report.txt file to [email protected] for further analysis.

To summarize: the black screen on external trigger is very likely a symptom of the Arducam libcamera not being installed correctly, caused by conflicting package versions (libcamera0 0~git20230512+f155393c-1 vs the expected 0~git20230512+8689dd6b-1) plus several commands being run without sudo. Remove the conflicting libcamera0 with sudo, re-run the Arducam install script as root, and then re-test trigger_mode=1 with the external trigger. If the Unicam timeout still persists after a clean install, run the bug report tool and send the output to [email protected].