Posts: 1
Joined: Mon Oct 22, 2018 1:11 pm

Pi camera 1.3 crashes and requires reboot to use again

Mon Oct 22, 2018 1:13 pm

My raspberry pi camera 1.3 is connected to a Rpi 3B+ and I have a script that has the camera take a picture every 5 minutes and save it to a network location. Once in a while, the camera will crash which will be brought back to life by my script. After a couple crashes though, the script doesn't seem to be able to bring the camera back online (but the script doesn't throw an exception for some reason).

I close the script, kill all relevant processes then run the script again but the camera stays dead. I thought maybe the GPU memory was the issue but it is set at 256MB and apparently that should be more than enough.

The only way to fix this seems to be to reboot the pi but obviously that is not ideal.

The script I am running is here:

Code: Select all

from picamera import PiCamera
from time import sleep
from datetime import datetime
import am2320

def main():
    flag = 0
    camera = PiCamera()
    camera.resolution = (2592, 1944)
    while 1:
        dateString = datetime.strftime(datetime.now(), '%Y%m%d')
        timeString = datetime.strftime(datetime.now(), '%H%M')
        flag = getPicture(camera, dateString, timeString)
        while flag == 1:
            camera = PiCamera()
            camera.resolution = (2592, 1944)
            flag = getPicture(camera, dateString, timeString)
        for x in range(1, 5): #90*20 = 1800seconds

def getPicture(camera, ds, ts):
        camera.capture('PATH' % (ds, ts))
        return 0
        print("camera crashed... restarting")
        return 1
Please help!

PS. another thing is when this happens and I reboot the pi, the pi boots into a camera preview and refuses VNC connection, which means I have to pull the power on the pi to get it to restart

Edit: It happened at 15/10/2018 16:30 BST. This time I didn't get a single "camera crashed... restarting" but the camera stopped recording anyways for some reason. Here is the dmesg: pastebin.com/ZpHB4W1P

Posts: 1
Joined: Tue Oct 23, 2018 12:55 pm

Re: Pi camera 1.3 crashes and requires reboot to use again

Tue Oct 23, 2018 1:02 pm

I have a very similar bug. When I stop a camera capture process, the process hangs and I need to reboot to make the camera work again. And this only on the RPI3b+, works well on the RPI3.

Return to “Troubleshooting”