raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
782 stars 164 forks source link

Zero sequence error on RPI zero W #905

Open trieska opened 6 months ago

trieska commented 6 months ago

I have python program which is sending image over mqtt but also can save image to disk I am using pizerow with original picamera, did install python3-picamera2 I did check, everything is updated

shortly my program doing these steps

 from picamera2 import Picamera2

object init, as you can see that I am saving mqtt config to separate variable to quick used later

self.picam2 = Picamera2()
self.mqtt_config = self.picam2.create_still_configuration(main={"size": (800, 600)})
self.picam2.configure(self.picam2.create_still_configuration())

here is saving method, this one is working fine

def save_photo(self):
    file_name = self.create_file_name()
    self.picam2.capture_file(file_name)

and here is send method, but time to time this one hang on second line "switch_mode_and_capture"

def send(self, client):
    data = io.BytesIO()
    self.picam2.switch_mode_and_capture_file(self.mqtt_config, data, format='jpeg')
    client.publish(self.getTopic(), data.getvalue())
    data.close()

here is output from system log when is hang on

  INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-BGR888 (1) 1296x972-SGBRG10_CSI2P
  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
  INFO V4L2 v4l2_videodevice.cpp:1820 /dev/video0[20:cap]: Zero sequence expected for first frame (got 1)

othewise looks like this:

INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-BGR888 (1) 1296x972-SGBRG10_CSI2P
INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
INFO Camera camera.cpp:1033 configuring streams: (0) 2592x1944-BGR888 (1) 2592x1944-SGBRG10_CSI2P
INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected unicam format: 2592x1944-pGAA

what do you think? what could be problem? should I change my program? thanks

Lilneo786 commented 6 months ago

the switch_mode_and_capture_file method hanging, might be related to how the PiCamera2 library interacts with the Raspberry Pi's camera hardware. Check the camera configuration using the raspistill command to capture an image. This can help identify if the issue is specific to the Python program or if it's related to the camera hardware or configuration.

Make sure that your Raspberry Pi's firmware and libraries are up-to-date by running the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
davidplowman commented 6 months ago

Yes, certainly make sure your software is fully up to date. It might also be worth trying a really simple script first (one that we could easily reproduce if it doesn't work), something like:

import io
import time
from picamera2 import Picamera2
picam2 = Picamera2()
preview_config = picam2.create_preview_configuration()
capture_config = picam2.create_still_configuration(main={"size": (800, 600)})
picam2.configure(preview_config)
data = io.BytesIO()
picam2.start()
time.sleep(2)
picam2.switch_mode_and_capture_file(capture_config, data, format='jpeg')

(I changed the initial non-capture configuration to a "preview" configuration. This will deliver frames more quickly. Keep the "still" configuration for actual captures.)

davidplowman commented 6 months ago

I've just got my hands on a Pi Zero W and tried the above, and it seems OK. Are you able to perform the same experiment? Thanks!

trieska commented 6 months ago

sorry for late response ...

I keep that pizero w updated.

Problem occurs from time to time. Last week or more app was able to send each image over mqtt without problem. But before that it froze for example 1 per week.

App is taking image each 5min and sending that over mqtt, I think thats should not be a problem. When saving images to files for timelapse video I am saving each 1min and that should be also ok. Anyway, problem occurs only while taking image and sending over mqtt, not calling save_photo method.

thanks for help

davidplowman commented 6 months ago

Thanks for the update. So your software is fully up to date (though on Bullseye, because there isn't a Bookworm for Pi Zero), and this error happens only sometimes. And when you get this "Zero sequence expected" error the system hangs, is that right?

Do you get these same errors using the simple script that I included, but wrapping the switch_mode_and_capture_file in a loop? That would give us something straightforward to try and reproduce.

Can you maybe also report the output of uname -a on your system. Thanks!

trieska commented 6 months ago

when I get that error only my app hangs, zero is still ok and I can ssh to it ...

sorry, I did not run your code because my app is running without problem for long time now, I dont know how to reproduce that problem. I will run it when it happen.

but question, I have not display attached to that zero, and I am running Lite version of raspbian, is it ok to use create_preview_configuration() ?

yes, it is bullseye

cat /etc/os-release 
  PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
  NAME="Raspbian GNU/Linux"
  VERSION_ID="11"
  VERSION="11 (bullseye)"
  VERSION_CODENAME=bullseye
  ID=raspbian
  ID_LIKE=debian
  HOME_URL="http://www.raspbian.org/"
  SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
  BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

uname -a
  Linux pizero7 6.1.70+ #1714 Thu Jan  4 14:46:40 GMT 2024 armv6l GNU/Linux
trieska commented 5 months ago

I did make changes in my code to follow your suggestion, hope that I did understand those correctly. What I did see is high CPU usage :-( And program did freeze again with same error.

here is complete class

class CameraSensor(Sensor):

    def __init__(self, sensorId, clientId):
        super().__init__(sensorId, clientId, "")
        self.picam2 = Picamera2()
        self.mqtt_config = self.picam2.create_still_configuration(main={"size": (800, 600)})
        self.picam2.configure(self.picam2.create_preview_configuration())

    def start(self):
        self.picam2.start()

    def stop(self):
        self.picam2.stop()

    def canSend(self, interval=240):
        return super().canSend(interval)

    def send(self, client):
        data = io.BytesIO()
        print('CameraSensor.send: A', flush=True)
        self.picam2.switch_mode_and_capture_file(self.mqtt_config, data, format='jpeg')
        print('CameraSensor.send: B', flush=True)
        client.publish(self.getTopic(), data.getvalue())
        print('CameraSensor.send: C', flush=True)
        data.close()
        print('CameraSensor.send: D', flush=True)

    def save_photo(self):
        file_name = self.create_file_name()
        print('CameraSensor.save_photo: A', flush=True)
        self.picam2.capture_file(file_name)
        print('CameraSensor.save_photo: B', flush=True)

    def create_file_name(self):
        current_datetime = datetime.now()
        name = current_datetime.strftime("%Y_%m_%d_%H_%M")
        name = "photo_" + name + ".jpg"
        file = Path(Path.home(), name)
        return file.absolute()

my main program is creating instance of this class and then in loop calling send and save_photo base on some condition.

I did leave debug prints there, program crash just after A, here is part from log, you can see I am calling send each 4minutes.

Feb 15 00:28:29 pizero7 python3[29513]: CameraSensor.send: A
Feb 15 00:28:29 pizero7 python3[29513]: [948:22:32.705170950] [29542]  INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-BGR888 (1) 1296x972-SGBRG10_CSI2P
Feb 15 00:28:29 pizero7 python3[29513]: [948:22:32.714287843] [29537]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGB>
Feb 15 00:28:30 pizero7 python3[29513]: [948:22:33.160652600] [29542]  INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
Feb 15 00:28:30 pizero7 python3[29513]: [948:22:33.167216523] [29537]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBR>
Feb 15 00:28:30 pizero7 python3[29513]: CameraSensor.send: B
Feb 15 00:28:30 pizero7 python3[29513]: CameraSensor.send: C
Feb 15 00:28:30 pizero7 python3[29513]: CameraSensor.send: D
Feb 15 00:32:31 pizero7 python3[29513]: CameraSensor.send: A
Feb 15 00:32:31 pizero7 python3[29513]: [948:26:35.088631148] [29542]  INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-BGR888 (1) 1296x972-SGBRG10_CSI2P
Feb 15 00:32:31 pizero7 python3[29513]: [948:26:35.096538055] [29537]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGB>
Feb 15 00:32:32 pizero7 python3[29513]: [948:26:35.529174974] [29542]  INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
Feb 15 00:32:32 pizero7 python3[29513]: [948:26:35.535687897] [29537]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBR>
Feb 15 00:32:32 pizero7 python3[29513]: CameraSensor.send: B
Feb 15 00:32:32 pizero7 python3[29513]: CameraSensor.send: C
Feb 15 00:32:32 pizero7 python3[29513]: CameraSensor.send: D
Feb 15 00:36:34 pizero7 python3[29513]: CameraSensor.send: A
Feb 15 00:36:34 pizero7 python3[29513]: [948:30:37.437311358] [29542]  INFO Camera camera.cpp:1033 configuring streams: (0) 800x600-BGR888 (1) 1296x972-SGBRG10_CSI2P
Feb 15 00:36:34 pizero7 python3[29513]: [948:30:37.445524265] [29537]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGB>
Feb 15 00:36:34 pizero7 python3[29513]: [948:30:37.639862070] [29537]  INFO V4L2 v4l2_videodevice.cpp:1820 /dev/video0[20:cap]: Zero sequence expected for first frame (got >
davidplowman commented 5 months ago

Hi, are you able to create a short self-contained example that will provoke the failure? If you are then we could try to reproduce the error. Thanks.

If you are able to supply an example script like this, could you also report the output of uname -a, cat /etc/os-release and libcamera-hello --version.

trieska commented 5 months ago

I did post outout of uname and cat command before, it is still same. here is output of libcamera-hello

libcamera-apps build: 7e4d3d71867f 17-07-2023 (07:34:37)
libcamera build: v0.0.5+83-bde9b04f

it is hard to reproduce, it happen randomly

davidplowman commented 5 months ago

Hi again, I understand it happens only randomly. However, if you can post a short self-contained script that causes the error (randomly) then we would be happy to try it. Thanks!

osborngod commented 1 week ago

I got the same error too.

I want to shoot a time-lapse photography by using Raspberrypi 4b. This error occurs around every 1500 shots. I tested it three times, once with 1800 shots, once with 1400, and once with 1300. Here is my code:

from picamera2 import Picamera2, Preview
import time
import datetime
import os

path = "/home/pi/Desktop/Seed_Pictures/"
picam2 = Picamera2()
picam2.still_configuration.size = (1296, 972)
picam2.start_preview(None) 
picam2.start()
time.sleep(2)

x= 1399
error_num = ""
while True:
    x = x + 1
    time_now = datetime.datetime.now().__str__()[:-7]
    if not error_num:
        path1 = path + f"{x:05d}_{time_now}" + ".jpg"
    else:
        path1 = path + f"{x:05d}_{time_now}_{str(error_num)}" + ".jpg"
    try:
        picam2.start_and_capture_file( path1 ) 
        error_num = ""
    except:
        if error_num == "":
            error_num = 1
        else:
            error_num += 1

and program crash code:

[2:37:52.696787801] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-BGR888 (1) 1296x972-SGBRG10_CSI2P
[2:37:52.699459196] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[2:37:53.032708771] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[2:37:53.034414981] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
[2:37:58.160416837] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[2:37:58.162267211] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
[2:37:59.364609049] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-BGR888 (1) 1296x972-SGBRG10_CSI2P
[2:37:59.366956414] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[2:37:59.699411556] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[2:37:59.701024304] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
[2:38:04.861784979] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[2:38:04.863652445] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
[2:38:06.058624473] [3902]  INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-BGR888 (1) 1296x972-SGBRG10_CSI2P
[2:38:06.061322313] [3898]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[2:38:06.264445014] [3898]  INFO V4L2 v4l2_videodevice.cpp:1820 /dev/video0[15:cap]: Zero sequence expected for first frame (got 1)

here is output of uname -a, cat /etc/os-release and libcamera-hello --version.

rpicam-apps build: 49344f2a8d18 17-06-2024 (12:09:08)
libcamera build: v0.3.0+65-6ddd79b5

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
davidplowman commented 1 week ago

Thanks for the report. Just a couple of further questions:

Thanks!

osborngod commented 1 week ago

To confirm, is it the case that the camera system is locking up when you get this message? I think it's yes. Is there anything reported in dmesg when this happens? dmesg report:

[    5.914959] systemd[1]: Listening on systemd-journald-audit.socket - Journal Audit Socket.
[    5.915568] systemd[1]: Listening on systemd-journald-dev-log.socket - Journal Socket (/dev/log).
[    5.916249] systemd[1]: Listening on systemd-journald.socket - Journal Socket.
[    5.922349] systemd[1]: Listening on systemd-udevd-control.socket - udev Control Socket.
[    5.922947] systemd[1]: Listening on systemd-udevd-kernel.socket - udev Kernel Socket.
[    5.923689] systemd[1]: dev-hugepages.mount - Huge Pages File System was skipped because of an unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
[    5.944396] systemd[1]: Mounting dev-mqueue.mount - POSIX Message Queue File System...
[    5.948722] systemd[1]: Mounting sys-kernel-debug.mount - Kernel Debug File System...
[    5.953193] systemd[1]: Mounting sys-kernel-tracing.mount - Kernel Trace File System...
[    5.953849] systemd[1]: auth-rpcgss-module.service - Kernel Module supporting RPCSEC_GSS was skipped because of an unmet condition check (ConditionPathExists=/etc/krb5.keytab).
[    5.962327] systemd[1]: Starting fake-hwclock.service - Restore / save the current clock...
[    5.967699] systemd[1]: Starting keyboard-setup.service - Set the console keyboard layout...
[    5.972741] systemd[1]: Starting kmod-static-nodes.service - Create List of Static Device Nodes...
[    5.978079] systemd[1]: Starting modprobe@configfs.service - Load Kernel Module configfs...
[    5.983937] systemd[1]: Starting modprobe@dm_mod.service - Load Kernel Module dm_mod...
[    5.990376] systemd[1]: Starting modprobe@drm.service - Load Kernel Module drm...
[    5.996940] systemd[1]: Starting modprobe@efi_pstore.service - Load Kernel Module efi_pstore...
[    6.002663] systemd[1]: Starting modprobe@fuse.service - Load Kernel Module fuse...
[    6.007969] systemd[1]: Starting modprobe@loop.service - Load Kernel Module loop...
[    6.009279] systemd[1]: systemd-fsck-root.service - File System Check on Root Device was skipped because of an unmet condition check (ConditionPathExists=!/run/initramfs/fsck-root).
[    6.019359] systemd[1]: Starting systemd-journald.service - Journal Service...
[    6.036744] systemd[1]: Starting systemd-modules-load.service - Load Kernel Modules...
[    6.041892] systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
[    6.051128] systemd[1]: Starting systemd-udev-trigger.service - Coldplug All udev Devices...
[    6.063710] systemd[1]: Mounted dev-mqueue.mount - POSIX Message Queue File System.
[    6.067076] systemd[1]: Mounted sys-kernel-debug.mount - Kernel Debug File System.
[    6.069064] systemd[1]: Mounted sys-kernel-tracing.mount - Kernel Trace File System.
[    6.072122] systemd[1]: Finished fake-hwclock.service - Restore / save the current clock.
[    6.072137] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@redhat.com
[    6.080307] systemd[1]: Finished kmod-static-nodes.service - Create List of Static Device Nodes.
[    6.082807] systemd[1]: modprobe@configfs.service: Deactivated successfully.
[    6.084247] systemd[1]: Finished modprobe@configfs.service - Load Kernel Module configfs.
[    6.086075] systemd[1]: modprobe@dm_mod.service: Deactivated successfully.
[    6.086828] systemd[1]: Finished modprobe@dm_mod.service - Load Kernel Module dm_mod.
[    6.088999] systemd[1]: modprobe@drm.service: Deactivated successfully.
[    6.089886] systemd[1]: Finished modprobe@drm.service - Load Kernel Module drm.
[    6.091816] systemd[1]: modprobe@efi_pstore.service: Deactivated successfully.
[    6.092400] fuse: init (API version 7.39)
[    6.093279] systemd[1]: Finished modprobe@efi_pstore.service - Load Kernel Module efi_pstore.
[    6.095321] systemd[1]: modprobe@loop.service: Deactivated successfully.
[    6.096261] systemd[1]: Finished modprobe@loop.service - Load Kernel Module loop.
[    6.099544] systemd[1]: modprobe@fuse.service: Deactivated successfully.
[    6.100314] systemd[1]: Finished modprobe@fuse.service - Load Kernel Module fuse.
[    6.130323] i2c_dev: i2c /dev entries driver
[    6.138497] systemd[1]: Mounting sys-fs-fuse-connections.mount - FUSE Control File System...
[    6.143520] systemd[1]: Mounting sys-kernel-config.mount - Kernel Configuration File System...
[    6.144135] systemd[1]: systemd-repart.service - Repartition Root Disk was skipped because no trigger condition checks were met.
[    6.146986] EXT4-fs (mmcblk0p2): re-mounted f382bc55-e740-48d8-8770-2a65d2dc2900 r/w. Quota mode: none.
[    6.159027] systemd[1]: Finished systemd-remount-fs.service - Remount Root and Kernel File Systems.
[    6.161070] systemd[1]: Mounted sys-fs-fuse-connections.mount - FUSE Control File System.
[    6.162739] systemd[1]: Mounted sys-kernel-config.mount - Kernel Configuration File System.
[    6.164724] systemd[1]: systemd-firstboot.service - First Boot Wizard was skipped because of an unmet condition check (ConditionFirstBoot=yes).
[    6.165007] systemd[1]: systemd-pstore.service - Platform Persistent Storage Archival was skipped because of an unmet condition check (ConditionDirectoryNotEmpty=/sys/fs/pstore).
[    6.169420] systemd[1]: Starting systemd-random-seed.service - Load/Save Random Seed...
[    6.174887] systemd[1]: Starting systemd-sysusers.service - Create System Users...
[    6.188929] mc: Linux media interface: v0.10
[    6.276435] systemd[1]: Finished systemd-random-seed.service - Load/Save Random Seed.
[    6.277057] videodev: Linux video capture interface: v2.00
[    6.284606] systemd[1]: first-boot-complete.target - First Boot Complete was skipped because of an unmet condition check (ConditionFirstBoot=yes).
[    6.302187] systemd[1]: Started systemd-journald.service - Journal Service.
[    6.309563] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    6.311070] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    6.311098] [vc_sm_connected_init]: start
[    6.311869] [vc_sm_connected_init]: installed successfully
[    6.365947] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    6.444811] systemd-journald[265]: Received client request to flush runtime journal.
[    6.447366] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    6.569417] systemd-journald[265]: File /var/log/journal/5478151cc04c4ec8aa6c0177de0809ce/system.journal corrupted or uncleanly shut down, renaming and replacing.
[    8.013405] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[    8.016534] rpi-gpiomem fe200000.gpiomem: window base 0xfe200000 size 0x00001000
[    8.016894] rpi-gpiomem fe200000.gpiomem: initialised 1 regions as /dev/gpiomem
[    8.021037] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    8.035187] bcm2835_audio bcm2835_audio: card created with 8 channels
[    8.035864] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    8.035913] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    8.040442] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    8.044546] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    8.044594] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    8.046439] rpivid_hevc: module is from the staging directory, the quality is unknown, you have been warned.
[    8.052401] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    8.052465] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    8.060649] rpivid feb10000.codec: Device registered as /dev/video19
[    8.061319] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[    8.061372] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[    8.093154] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[    8.093225] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[    8.093395] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    8.095005] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    8.144951] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    8.154016] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    8.154060] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    8.154078] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    8.154091] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    8.154103] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    8.184052] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[    8.190194] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[    8.219182] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[    8.222388] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[    8.222432] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    8.222448] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    8.222461] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    8.222479] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    8.222778] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    8.573333] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    8.649290] Loaded X.509 cert 'benh@debian.org: 577e021cb980e0e820821ba7b54b4961b8b4fadf'
[    8.650326] Loaded X.509 cert 'romain.perier@gmail.com: 3abbc6ec146e09d1b6016ab9d6cf71dd233f0328'
[    8.651289] Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    8.710519] Loaded X.509 cert 'wens: 61c038651aabdcf94bd0ac7ff06c7248db18c600'
[    8.711594] alsactl[370]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
[    8.880987] brcmfmac: F1 signature read @0x18000000=0x15264345
[    8.891799] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    8.892746] usbcore: registered new interface driver brcmfmac
[    9.104553] Bluetooth: Core ver 2.22
[    9.104725] NET: Registered PF_BLUETOOTH protocol family
[    9.104745] Bluetooth: HCI device and connection manager initialized
[    9.104777] Bluetooth: HCI socket layer initialized
[    9.104800] Bluetooth: L2CAP socket layer initialized
[    9.104839] Bluetooth: SCO socket layer initialized
[    9.174710] Bluetooth: HCI UART driver ver 2.3
[    9.174740] Bluetooth: HCI UART protocol H4 registered
[    9.174844] Bluetooth: HCI UART protocol Three-wire (H5) registered
[    9.176792] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
[    9.177011] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
[    9.180186] Bluetooth: HCI UART protocol Broadcom registered
[    9.185443] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
[    9.186229] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Apr 15 2021 03:03:20 version 7.45.234 (4ca95bb CY) FWID 01-996384e2
[    9.296325] uart-pl011 fe201000.serial: no DMA platform data
[    9.536749] Bluetooth: hci0: BCM: chip id 107
[    9.537126] Bluetooth: hci0: BCM: features 0x2f
[    9.538291] Bluetooth: hci0: BCM4345C0
[    9.538320] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0000
[    9.541252] Bluetooth: hci0: BCM4345C0 'brcm/BCM4345C0.raspberrypi,4-model-b.hcd' Patch
[   10.296924] Bluetooth: hci0: BCM: features 0x2f
[   10.298277] Bluetooth: hci0: BCM43455 37.4MHz Raspberry Pi 3+-0190
[   10.298294] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0382
[   10.621625] Adding 204796k swap on /var/swap.  Priority:-2 extents:11 across:24272896k SS
[   10.921197] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   10.921226] Bluetooth: BNEP filters: protocol multicast
[   10.921249] Bluetooth: BNEP socket layer initialized
[   10.933750] Bluetooth: MGMT ver 1.22
[   10.965764] NET: Registered PF_ALG protocol family
[   12.549561] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[   12.550245] bcmgenet fd580000.ethernet eth0: Link is Down
[   12.568756] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[   14.167300] systemd-journald[265]: File /var/log/journal/5478151cc04c4ec8aa6c0177de0809ce/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.
[   16.679134] Bluetooth: RFCOMM TTY layer initialized
[   16.679174] Bluetooth: RFCOMM socket layer initialized
[   16.679195] Bluetooth: RFCOMM ver 1.11
[   99.350012] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[   99.457990] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[   99.562034] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[   99.666542] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[   99.774679] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[   99.775085] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[   99.775497] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[   99.775905] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[  188.419943] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[  188.527988] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[  188.631949] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[  188.735932] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[  188.839906] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[  188.840178] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[  188.840447] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[  188.840717] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[ 2706.587311] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[ 2706.695349] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[ 2706.799328] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[ 2706.903364] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[ 2707.007349] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[ 2707.007619] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[ 2707.007890] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[ 2707.008161] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[ 3267.021461] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[ 3267.129391] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[ 3267.233389] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[ 3267.337384] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[ 3267.441380] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[ 3267.441647] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[ 3267.441915] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[ 3267.442186] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[ 3798.482965] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[ 3798.590890] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[ 3798.698884] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[ 3798.806878] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[ 3798.914849] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[ 3798.915222] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[ 3798.915576] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[ 3798.915926] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[ 4762.147409] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[ 4762.255416] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[ 4762.359408] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[ 4762.463422] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52
[ 4762.567423] brcmfmac: brcmf_set_channel: set chanspec 0xd034 fail, reason -52
[ 4762.567700] brcmfmac: brcmf_set_channel: set chanspec 0xd038 fail, reason -52
[ 4762.567974] brcmfmac: brcmf_set_channel: set chanspec 0xd03c fail, reason -52
[ 4762.568252] brcmfmac: brcmf_set_channel: set chanspec 0xd040 fail, reason -52
[ 5144.545651] brcmfmac: brcmf_set_channel: set chanspec 0xd022 fail, reason -52
[ 5144.653649] brcmfmac: brcmf_set_channel: set chanspec 0xd026 fail, reason -52
[ 5144.758312] brcmfmac: brcmf_set_channel: set chanspec 0xd02a fail, reason -52
[ 5144.866383] brcmfmac: brcmf_set_channel: set chanspec 0xd02e fail, reason -52

3.Can you comment on what kind of a power supply you are using, and how long the camera ribbon cable is? (These are known sources of intermittent problems, so always good to rule them out.) camera ribbon cable is 15cm or 20cm. Power supply is 5V 3A Raspberry Pi power supply. 微信图片_20240708213957

4.Anything else noteworthy about your setup? Maybe the presence of other equipment that might cause interference, or anything that might help us to set up an experiment so as to try and repeat this behaviour. my camera setting is : sudo nano /boot/firmware/config.txt

camera_auto_detect=1
gpu_mem=128
start_x=1
davidplowman commented 1 week ago

Just for reference, you should probably remove gpu_mem=128 and start_x=1, though I don't particularly see them causing this kind of problem. Do you know where your ov5647 came from? (seeing as Raspberry Pi don't sell them any more)

osborngod commented 1 week ago

Just for reference, you should probably remove gpu_mem=128 and start_x=1, though I don't particularly see them causing this kind of problem. Do you know where your ov5647 came from? (seeing as Raspberry Pi don't sell them any more)

ok, i will remove gpu_mem=128 and start_x=1, and try again, but it will take some time to verify if it's feasible. I broght it from another person, I didn't know where he buy it.