Arducam QuadCam 16MP IMX519 - Can't Focus

dmesg part 2
[ 3.680579] systemd[1]: Mounted POSIX Message Queue File System.
[ 3.681591] systemd[1]: Mounted RPC Pipe File System.
[ 3.682423] systemd[1]: Mounted Kernel Debug File System.
[ 3.683231] systemd[1]: Mounted Kernel Trace File System.
[ 3.685390] systemd[1]: Finished Restore / save the current clock.
[ 3.690953] systemd[1]: Finished Create list of static device nodes for the current kernel.
[ 3.693679] systemd[1]: [email protected]: Succeeded.
[ 3.695372] systemd[1]: Finished Load Kernel Module configfs.
[ 3.697690] systemd[1]: [email protected]: Succeeded.
[ 3.699224] systemd[1]: Finished Load Kernel Module fuse.
[ 3.708031] systemd[1]: Mounting FUSE Control File System…
[ 3.715497] systemd[1]: Mounting Kernel Configuration File System…
[ 3.723646] systemd[1]: Started File System Check Daemon to report status.
[ 3.739608] i2c_dev: i2c /dev entries driver
[ 3.742862] scsi 0:0:0:0: Direct-Access Samsung Flash Drive FIT 1100 PQ: 0 ANSI: 6
[ 3.744215] sd 0:0:0:0: [sda] 125313283 512-byte logical blocks: (64.2 GB/59.8 GiB)
[ 3.744570] sd 0:0:0:0: [sda] Write Protect is off
[ 3.744597] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 3.745419] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
[ 3.753536] systemd[1]: Finished Load Kernel Modules.
[ 3.754643] systemd[1]: Mounted FUSE Control File System.
[ 3.756187] sda: sda1
[ 3.758165] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 3.857946] systemd[1]: Starting Apply Kernel Variables…
[ 3.863800] systemd[1]: [email protected]: Succeeded.
[ 3.878148] systemd[1]: Finished Load Kernel Module drm.
[ 3.879314] systemd[1]: Mounted Kernel Configuration File System.
[ 3.902497] systemd[1]: Finished Apply Kernel Variables.
[ 3.912690] systemd[1]: Finished File System Check on Root Device.
[ 3.919402] systemd[1]: Starting Remount Root and Kernel File Systems…
[ 4.048388] systemd[1]: Started Journal Service.
[ 4.138385] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null). Quota mode: none.
[ 4.209278] systemd-journald[145]: Received client request to flush runtime journal.
[ 4.224560] systemd-journald[145]: File /var/log/journal/bb4dee56fef747aa97310e5f81e20a87/system.journal corrupted or uncleanly shut down, renaming and replacing.
[ 5.903901] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 6.400756] mc: Linux media interface: v0.10
[ 6.483235] videodev: Linux video capture interface: v2.00
[ 6.592912] gpio-mux mux-controller: 8-way mux-controller registered
[ 6.764001] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.781885] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 6.781919] [vc_sm_connected_init]: start
[ 6.782904] [vc_sm_connected_init]: installed successfully
[ 6.787659] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.791699] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.803264] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.813353] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 6.814619] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 6.815469] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 6.817520] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 6.817561] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 6.817587] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 6.817610] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 6.817633] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 6.826247] bcm2835_audio bcm2835_audio: card created with 8 channels
[ 6.831724] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[ 6.832553] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[ 6.833296] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[ 6.834049] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[ 6.834105] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 6.834137] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 6.834172] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 6.834198] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 6.834622] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 6.879885] rpivid_hevc: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.910831] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 6.985485] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[ 7.025416] rpivid feb10000.codec: Device registered as /dev/video19
[ 7.032142] input: soc:shutdown_button@e as /devices/platform/soc/soc:shutdown_button@e/input/input4
[ 7.105130] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 7.105190] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 7.114020] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 7.114082] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 7.120193] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 7.120243] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 7.125981] brcmstb-i2c fef04500.i2c: @97500hz registered in polling mode
[ 7.128843] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[ 7.128925] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[ 7.139563] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[ 7.139644] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[ 7.152922] i2c i2c-22: Added multiplexed i2c bus 0
[ 7.179117] i2c 10-001a: Fixing up cyclic dependency with fe801000.csi
[ 7.180434] i2c i2c-22: Added multiplexed i2c bus 10
[ 7.185650] brcmstb-i2c fef09500.i2c: @97500hz registered in polling mode
[ 7.416877] [drm] Initialized v3d 1.0.0 20180419 for fec00000.v3d on minor 0
[ 7.684795] checking generic (3e3cf000 7f8000) vs hw (0 ffffffffffffffff)
[ 7.684827] fb0: switching to vc4 from simple
[ 7.828550] Console: switching to colour dummy device 80x30
[ 7.878786] vc4-drm gpu: bound fe400000.hvs (ops vc4_hvs_ops [vc4])
[ 7.927691] Registered IR keymap rc-cec
[ 7.928032] rc rc0: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0
[ 8.021457] input: vc4 as /devices/platform/soc/fef00700.hdmi/rc/rc0/input5
[ 8.086170] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 8.136231] cfg80211: Loaded X.509 cert ‘sforshee: 00b28ddf47aef9cea7’
[ 8.174915] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[ 8.341884] vc4-drm gpu: bound fef00700.hdmi (ops vc4_hdmi_ops [vc4])
[ 8.368234] Registered IR keymap rc-cec
[ 8.506210] rc rc1: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1
[ 8.506458] input: vc4 as /devices/platform/soc/fef05700.hdmi/rc/rc1/input6
[ 8.552734] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 8.568983] vc4-drm gpu: bound fef05700.hdmi (ops vc4_hdmi_ops [vc4])
[ 8.569591] vc4-drm gpu: bound fe004000.txp (ops vc4_txp_ops [vc4])
[ 8.570046] vc4-drm gpu: bound fe206000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 8.570563] vc4-drm gpu: bound fe207000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 8.571004] vc4-drm gpu: bound fe20a000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 8.571421] vc4-drm gpu: bound fe216000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 8.571869] vc4-drm gpu: bound fec12000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 8.594631] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 8.596962] usbcore: registered new interface driver brcmfmac
[ 8.629094] [drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
[ 8.867406] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 8.873185] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Nov 1 2021 00:37:25 version 7.45.241 (1a2f2fa CY) FWID 01-703fd60
[ 9.258585] Console: switching to colour frame buffer device 240x67
[ 9.258663] vc4-drm gpu: [drm] fb0: vc4drmfb frame buffer device
[ 9.639372] uart-pl011 fe201000.serial: no DMA platform data
[ 9.994774] 8021q: 802.1Q VLAN Support v1.8
[ 10.186599] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[ 10.188595] bcmgenet fd580000.ethernet eth0: Link is Down
[ 10.253067] Adding 102396k swap on /var/swap. Priority:-2 extents:1 across:102396k SSFS
[ 10.501955] imx519: loading out-of-tree module taints kernel.
[ 10.552320] pca954x 10-0070: probe failed
[ 10.556017] imx519 10-001a: Device found is imx519
[ 10.556770] imx519 10-001a: Consider updating driver imx519 to match on endpoints
[ 12.156960] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[ 17.183095] Bluetooth: Core ver 2.22
[ 17.183158] NET: Registered PF_BLUETOOTH protocol family
[ 17.183165] Bluetooth: HCI device and connection manager initialized
[ 17.183181] Bluetooth: HCI socket layer initialized
[ 17.183191] Bluetooth: L2CAP socket layer initialized
[ 17.183205] Bluetooth: SCO socket layer initialized
[ 17.196524] Bluetooth: HCI UART driver ver 2.3
[ 17.196540] Bluetooth: HCI UART protocol H4 registered
[ 17.196601] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 17.196792] Bluetooth: HCI UART protocol Broadcom registered
[ 17.530298] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 17.530311] Bluetooth: BNEP filters: protocol multicast
[ 17.530325] Bluetooth: BNEP socket layer initialized
[ 17.550838] NET: Registered PF_ALG protocol family
[ 17.591160] cryptd: max_cpu_qlen set to 1000
[ 17.861605] Bluetooth: RFCOMM TTY layer initialized
[ 17.861627] Bluetooth: RFCOMM socket layer initialized
[ 17.861646] Bluetooth: RFCOMM ver 1.11
[ 18.048831] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 31.835820] cam-dummy-reg: disabling
[ 44.900940] v3d fec00000.v3d: MMU error from client L2T (0) at 0x3601000, pte invalid

@Ervin

Based on the information you’ve provided, I cannot identify any obvious errors.

However, to further investigate the issue, could you please test the camera again with manual focus and record a screen?

This will help us better understand the problem and find a solution.

Here are two images from the quad cam. The top left is using the command:
libcamera-still -t 0 --framerate 30 --autofocus-mode continuou

the bottom right is a pause in a video I took using the command:

libcamera-vid -t 10000 -o test.h264 --viewfinder-width 1920 --viewfinder-height 1080 --width 1920 --height 1080 --framerate 30 --autofocus-mode continuous --save-pts timestamp.pts

My goal is to take/record video but my impression is that libcamera-still is better quality. The resolution and colors look better in the still. Initially I thought it wasn’t focused very well but maybe its just the resolution. I tried the following:

libcamera-vid -n -t 10000 -o test.h264 --viewfinder-width 3840 --viewfinder-height 2160 --width 3840 --height 2160 --level 4.2 --framerate 30 --autofocus-mode auto --save-pts timestamp.pts --denoise cdn_off

but got the error

ERROR: *** failed to start output streaming ***

  1. Any thoughts? Do you think its focus? Resolution?
  2. Anything I could improve in my higher resolution command?

My problem was not auto-focus but the resolution. I was able to get 4K to work with the following command:

libcamera-vid -t 20000 --width 3840 --height 2160 --framerate 18 --mode 3840:2160 --codec mjpeg -o output1.mjpeg

During preview this creates a pretty nice looking file. However, when I try to play it in VLC, it only shows first frame. I tried to convert it with ffmpeg and how some luck but not great. Does Arducam have any recommendations on how to convert mjpeg file to mp4?

@Ervin

The reason for this issue is that the sampling rate is inconsistent with the actual playback rate of the software. To resolve this, you may need to find the correct way to play the file. You may want to consider asking for assistance on the official Raspberry Pi forum.They have a lot of experts on this.

Hi Edward,

Thanks for suggestion. I did submit a question to Raspberry Pi. They did help a bit with the mjpeg to mp4 conversion. But I noted another issue. Whether I take a h.264 1k video or mjpeg 4k video, one camera always looks good but the others look pretty bad. It can’t be focus since I’m always moving around and the same camera is always the good one. Possibly hardware or software? Any thoughts?

Here are still shots from the videos:

h.264

mjpeg

Clearly the bottom right is significantly better in each video, every video/every time.

Here are the commands I am using:

h.264
libcamera-vid -n -t 10000 -o test.h264 --save-pts timestamps.txt --width 1920 --height 1080 --autofocus-mode auto --sharpness

mjpeg
libcamera-vid -t 20000 --sharpness 2 --width 3840 --height 2160 --framerate 18 --mode 3840:2160 --codec mjpeg -o output1.mjpeg

Any thoughts would be appreciated.

@Ervin

Please adjust manually and record a video to check whether each camera’s focus function is working properly, following the example below.

Please don’t worry about this theme, they use the same repo, you just need to follow the red box

I ran the following commands:

prerequisites required

First of all, you need to make sure that your version is above 5.15.84

uname -r

Install the Camera Driver

wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p imx519_kernel_driver_low_speed

libcamera-dev and libcamera-apps Installation

./install_pivariety_pkgs.sh -p libcamera
./install_pivariety_pkgs.sh -p libcamera_apps
``.

sudo rebeoot

I am now at 

stevedalton@raspberrypi:~ $ uname -r
6.1.21-v8+



I then downloaded the manual focus python script:
Manual focus
Download the source code
git clone https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver.git

I think started a libcamera video with the following command:

stevedalton@raspberrypi:~ $ libcamera-vid -t 30000 -o test.h264 --save-pts timestamps.txt --width 1920 --height 1080 --autofocus-mode manual --sharpness 2


and started the manual focus script - 
# Press the Up/Down Arrow for focus adjustment, press “ctrl + c” to save, or “r” to reset
cd Arducam-Pivariety-V4L2-Driver/focus
python3 FocuserExample.py -d /dev/v4l-subdev1


unlike your video (which was very helpful to know what was supposed to happen), nothing happened to image.  It remained the same throughout the video.

I appreciate the held, and would be thankful if you can get me over this hump.

@Ervin

For video streaming, could you simply use the simplest command ‘libcamera-still -t 0’ and then switch to the manual focus script for control? I hope to be able to record a video like I did before.

Hi Edward,

Thanks for working with me. I have a 3.3 MB *.mkv file. But when I try to attach it there is an error that says:

Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png).

How did you post your video? Let me know and I will post.

But in running ‘libcamera-still -t 0’ and then trying to manual focus the video with the python script - nothing happened. to the appearance of the video - not like your video at all.

@Ervin

It may be that some formats are not supported, you can upload to the cloud disk, and then send me the sharing link.

@Edward

Here is the link to the video:

@Ervin

I’m still investigating the cause of the problem, so I’m not sure what’s causing it yet. It’s maybe a very serious issue, and I need to meet with the relevant people to try to reproduce and identify the root cause. I estimate that it will take 1-2 weeks to complete my investigation, and I will provide you with an update as soon as I have more information. Is it okay if I get back to you in 1-2 weeks with an update?

Thanks for the response. Yes, of course I will wait as I haven’t been able to make any progress myself. But I do hope to get it working soonest. Let me know if you have any suggestions and I will be willing to try them.

Hi Edward,

Any update on getting a similar environment set-up? I’ve been monitoring the board trying to find some solutions but none yet. Some help would be appreciated.

Thanks,
Eric

@Ervin

After communication, we can help you with remote support. I will private message you an email address, please send me an email.

I figured out the problem. It is the camera covers. This solution correlates to the blurriness 100% of the time. Take them off, the image is perfect. Put them on the image is blurry. I tried changing the height/width thinking the more zoomed in image might affect the view or focus. I also cleaned them. Physically they all look made correctly. I pressed them on hard. I also tried the cable under the red frame versus over. Nothing worked, but its extremely predictive. Have you seen this before? Any suggestions?

Any update on my problem with the camera covers. I ended up using them without the camera covers, capturing perfect images. But the plastic lens with the red edge came off after a while. It seems the plastic cover is a good protection mechanism. I replaced the damaged one with a new camera from a second set of cameras. Once again, great images without the covers but blurry on the ones I put the covers. Any thoughts?