AndyQ
Posts: 4
Joined: Tue Apr 24, 2012 5:50 pm

How to reset the camera?

Wed May 15, 2013 8:47 pm

When running raspistill -d -t 100000, after about 30 seconds the display freezes and a couple of errors are shown requiring a CTRL-C to kill the process.

However, at this point, the camera red led remains on and futher attempts to re-run raspistill result in nothing happening at all.

Is there anyway of resetting the camera to the off state?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Wed May 15, 2013 9:37 pm

Hmm. Sounds odd. What error messages were displayed?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

AndyQ
Posts: 4
Joined: Tue Apr 24, 2012 5:50 pm

Re: How to reset the camera?

Thu May 16, 2013 8:28 pm

OK the two errors are:
mmal: mmal_vc_port_parameter_set: failed to set port parameter 64:0:EINVAL
mmal: Argument is invalid

Just re-ran it for 30 seconds and the above errors get repeated 3 times before the preview screen closes, however raspistill is still running and the camera light is on. Pressing CTRL-C kills raspistill however the camera light remains on.

Any ideas?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Thu May 16, 2013 8:35 pm

None at all - I've never seen that problem.

If you run without -d does it run for longer? Might be a problem in the demo mode stuff picking something that's invalid, judging by the error. But there should be no way of 'breaking' it as you describe, so it's a bit odd.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Thu May 16, 2013 8:42 pm

Actually I just remembered I have seen those port set errors - they happen in demo mode, and should be harmless.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

AndyQ
Posts: 4
Joined: Tue Apr 24, 2012 5:50 pm

Re: How to reset the camera?

Thu May 16, 2013 8:44 pm

Running:
raspistill -t 30000 - runs fine and exits nicely.

Running:
raspistill -d -t 30000 - runs for about 20 seconds then preview freezes, errors appear then after approx 10 more seconds preview window disappears but raspistill doesn't exit. Need to reboot in order to switch the camera off or run raspistill/raspivid again.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Thu May 16, 2013 8:46 pm

AndyQ wrote:Running:
raspistill -t 30000 - runs fine and exits nicely.

Running:
raspistill -d -t 30000 - runs for about 20 seconds then preview freezes, errors appear then after approx 10 more seconds preview window disappears but raspistill doesn't exit. Need to reboot in order to switch the camera off or run raspistill/raspivid again.
So it is running for the requisite 30s, then trying to stop (preview disapears), but is failing to stop the camera. Odd. I've not seen that before.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

AndyQ
Posts: 4
Joined: Tue Apr 24, 2012 5:50 pm

Re: How to reset the camera?

Thu May 16, 2013 8:52 pm

Yeah and if you then try to run raspistill again, it hangs and doesn't display the preview window at all.

User avatar
Gert van Loo
Posts: 2486
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: How to reset the camera?

Thu May 16, 2013 9:47 pm

The camera does not have a reset itself, but there is a power enable GPIO.
James will know the details but setting the GPIO low and high against should totally reset the camera.

That is purely from a hardware point of view.
I have no idea what that will do if there is still SW running.

Engineer1
Posts: 2
Joined: Sat May 18, 2013 2:46 pm

Re: How to reset the camera?

Sat May 18, 2013 2:54 pm

Hello,

I too am having problems with the camera 'locking' up. If I CTRL-C when it's running raspivid then subsequent attempts to use it results in the following:

Code: Select all

[email protected] ~ $ mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Which GPIO is the power enable connected to? Is there a schematic for the module available?

Thanks a lot.

Steve.

GekkePrutser
Posts: 36
Joined: Sat Mar 23, 2013 5:09 pm

Re: How to reset the camera?

Thu Aug 08, 2013 7:53 pm

Sorry to drag up this old topic but I'm seeing the same thing - the camera locking up. A reboot fixes it, but it's not a handy fix and sometimes it takes a while before I notice.

It seems to happen 'sometimes' intermittently, however I can replicate it every single time by using the 'verylong' exposure prefix. Taking a picture with raspistill and verylong, just ends up in it hanging forever, then when I finally kill the process the camera light just stays on forever until I reboot. And the camera doesn't work anymore from that point on (subsequent calls to raspistill end up hanging forever, which ends up in quite a few processes since I have them done periodically). This is something I can check for anyway by using a lock file but it shouldn't hang, really..

It would be great if I could reset this GPIO pin every time before I start taking a picure so I know the camera is in a sane state.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Thu Aug 08, 2013 8:13 pm

GekkePrutser wrote:Sorry to drag up this old topic but I'm seeing the same thing - the camera locking up. A reboot fixes it, but it's not a handy fix and sometimes it takes a while before I notice.

It seems to happen 'sometimes' intermittently, however I can replicate it every single time by using the 'verylong' exposure prefix. Taking a picture with raspistill and verylong, just ends up in it hanging forever, then when I finally kill the process the camera light just stays on forever until I reboot. And the camera doesn't work anymore from that point on (subsequent calls to raspistill end up hanging forever, which ends up in quite a few processes since I have them done periodically). This is something I can check for anyway by using a lock file but it shouldn't hang, really..

It would be great if I could reset this GPIO pin every time before I start taking a picure so I know the camera is in a sane state.
Hmm. Can you try the very latest build of the camera apps? You might need to build yourself - not sure which version is in the update. I tried verylong with that and couldn't get it to go wrong.

The lock is the camera code on the GPU dying in some as yet undetermined way, so nothing to do with Linux. or the camera app.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

maddogdave
Posts: 46
Joined: Sat Dec 17, 2011 6:05 pm
Location: Berkshire England

Re: How to reset the camera?

Thu Aug 08, 2013 9:04 pm

I've tried the 'verylong' parameter and if the light levels were high then I got a normally exposed picture saved after the standard 5 second preview. When I lowered the light level the camera froze on the preview screen and I needed to reboot. Wondering if there is some kind of limit / threshold on either the light level or maximum exposure time that causes a conflict with verylong. Should the exposure time out and save the file after a preset maximum time (say 4 seconds / 30 seconds or so) or is the module waiting and not sensing enough light and therefore not completing the command.
Dave

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Fri Aug 09, 2013 9:00 am

maddogdave wrote:I've tried the 'verylong' parameter and if the light levels were high then I got a normally exposed picture saved after the standard 5 second preview. When I lowered the light level the camera froze on the preview screen and I needed to reboot. Wondering if there is some kind of limit / threshold on either the light level or maximum exposure time that causes a conflict with verylong. Should the exposure time out and save the file after a preset maximum time (say 4 seconds / 30 seconds or so) or is the module waiting and not sensing enough light and therefore not completing the command.
And that is with the latest app? (sudo rpi-update gets it)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

maddogdave
Posts: 46
Joined: Sat Dec 17, 2011 6:05 pm
Location: Berkshire England

Re: How to reset the camera?

Fri Aug 09, 2013 6:02 pm

Thanks James. It's now fixed with running the update. I had previously only run sudo apt-get upgrade and update so a user error on my part as I assumed this was the way to update.
Dave

GekkePrutser
Posts: 36
Joined: Sat Mar 23, 2013 5:09 pm

Re: How to reset the camera?

Fri Aug 09, 2013 7:54 pm

Thanks for the comments, James! And Dave.

I had indeed only tried the 'verylong' exposure mode at night (during the day it didn't make much sense anyway with a fixed aperture). But the random hangs are more of a problem, it happens twice a day or so. I run raspistill every 15 minutes and it hangs once a day on average.

I've run rpi-update now, thanks for that! I hadn't tried that yet. It's stable now with 'verylong', at night! I'll run it for a few days to see if it also fixes the hang with the normal exposure mode.

PS Sorry for not trying this yet, I should have tried updating everything before posting.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24192
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to reset the camera?

Fri Aug 09, 2013 8:36 pm

The interesting thing is that I have NO IDEA why the latest version works and the old one doesn't as I don't remember changing any settings at all that could influence it....

Gotta love computers.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

GekkePrutser
Posts: 36
Joined: Sat Mar 23, 2013 5:09 pm

Re: How to reset the camera?

Tue Aug 13, 2013 4:51 pm

I know what that's like :) Thanks for fixing it in any case! It hasn't hung anymore since the firmware update, just wanted to report this back in case anyone else has the same problem.

I'm also surprised how good the quality is, and how easily it handles 1080p 30fps video. It seems effortless. Before I got the PiCam I used a 60-euro Microsoft Studio 1080p USB webcam which I thought was pretty good. But it turns out the PiCam is way better. Resolution (actual image sharpness, not just the sensor), exposure metering are superior. I didn't expect that from a cam which is much cheaper and has much smaller optics.

The only thing that the Microsoft cam was better at, was low-light performance. But it was hampered by an autofocus that couldn't be turned off so in the dark it tended to focus hunt and ruining its own pictures (or focus on nearby things such as raindrops on the window).

User avatar
heatfanjohn
Posts: 28
Joined: Fri Jun 28, 2013 5:18 pm
Location: Davie, FL

Re: How to reset the camera?

Sun Aug 18, 2013 12:23 am

It would be great if someone would post the code to reset the camera via the GPIO (or post which GPIO controls the camera power).

I just had a problem were the camera got stuck with the red LED on even after I interrupted raspivid.

I had to reboot the Pi to get the LED to go out.

Actually, the Pi never completed the init 6, it hung after syncing disks and saying that it was going to reset.

User avatar
Gert van Loo
Posts: 2486
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: How to reset the camera?

Sun Aug 18, 2013 6:46 pm

....(or post which GPIO controls the camera power).
All you have to do is go to the schematic of the Raspberry-Pi board and that tells you it is GPIO27 or GPIO5.
As GPIO5 has the name "CAM_CLK" my bet is on the GPIO27 pin.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: How to reset the camera?

Sun Aug 18, 2013 9:33 pm

Gert van Loo wrote:
....(or post which GPIO controls the camera power).
All you have to do is go to the schematic of the Raspberry-Pi board and that tells you it is GPIO27 or GPIO5.
As GPIO5 has the name "CAM_CLK" my bet is on the GPIO27 pin.
GPIO5 is the one I use to switch the camera LED on and off. It doesn't switch the camera off, so I'd bet on GPIO27 as well.

Would that be different for Rev 1 and Rev 2 Pis Gert, since 27 is now on the P1 header?
Alex Eames RasPi.TV, RasP.iO

User avatar
Gert van Loo
Posts: 2486
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: How to reset the camera?

Mon Aug 19, 2013 11:52 am

Would that be different for Rev 1 and Rev 2 Pis Gert, since 27 is now on the P1 header?
Could be, I used the rev-1 schematic.
I have not checked rev2.

User avatar
heatfanjohn
Posts: 28
Joined: Fri Jun 28, 2013 5:18 pm
Location: Davie, FL

Re: How to reset the camera?

Tue Aug 20, 2013 5:40 pm

Do you really mean GPIO pin 21 instead of pin 27?

Looking at the Rev. 2 schematic posted at:

http://www.raspberrypi.org/wp-content/u ... .2_027.pdf

I found the breakout for camera header where the camera ribbon cable connects, see below:

Image

This shows, CAM_GPIO and CAM_GPIO_CLK going to pins 11 & 12.

Then this breakout for the BCM2835 GPIO pins shows that GPIO 5 is CAM_CLK and that GPIO 21 is CAM_GPIO.

Image

Therefore are we saying that if I set GPIO 21 low and then high it should reset the camera by temporarily powering it off?

User avatar
Gert van Loo
Posts: 2486
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: How to reset the camera?

Tue Aug 20, 2013 6:41 pm

Gert van Loo wrote:
Would that be different for Rev 1 and Rev 2 Pis Gert, since 27 is now on the P1 header?
Could be, I used the rev-1 schematic.
I have not checked rev2.

User avatar
heatfanjohn
Posts: 28
Joined: Fri Jun 28, 2013 5:18 pm
Location: Davie, FL

Re: How to reset the camera?

Tue Aug 20, 2013 7:14 pm

Gert van Loo wrote:
Gert van Loo wrote:
Would that be different for Rev 1 and Rev 2 Pis Gert, since 27 is now on the P1 header?
Could be, I used the rev-1 schematic.
I have not checked rev2.
I really need to start reading things more carefully!

;-)

Return to “Camera board”