Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picamera error on Model A #38

Closed
martinohanlon opened this issue Jan 2, 2014 · 6 comments
Closed

picamera error on Model A #38

martinohanlon opened this issue Jan 2, 2014 · 6 comments

Comments

@martinohanlon
Copy link

Hi,

I'm getting an error when I try and execute some picamera code on a Model A. I've developed some software on a model b and it works fine. I have come to run this on a model a and I keep getting the same error when instantiating picamera.Camera().

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Unexpected error -   Camera component couldn't be enabled: Out of resources (other than memory)
Traceback (most recent call last):
  File "/home/pi/dev/pelmetcam/pelmetcam.py", line 230, in 
    with picamera.PiCamera(False) as camera:
  File "/home/pi/dev/picamera/picamera/camera.py", line 239, in __init__
    self._init_camera()
  File "/home/pi/dev/picamera/picamera/camera.py", line 329, in _init_camera
    prefix="Camera component couldn't be enabled")
  File "/home/pi/dev/picamera/picamera/exc.py", line 102, in mmal_check
    }.get(status, "Unknown status error")))
picamera.exc.PiCameraError: Camera component couldn't be enabled: Out of resources (other than memory)

Its exactly the same setup, the same sd card, everything. I've rebuilt the sd card from a new raspbian image, always with the same result, its runs fine on my model b, but I execute it on model a and it fails. I've done an apt-get update, upgrade and rpi-update but with no joy.

The model b is a 256Mb Rev 1, while the model a is a 256Mb Rev 2. Other than the rev difference, they are virtually identical.

Im not entirely convinced this is an error with picamera specifically but the error is being generated from picamera.Camera() so I though I'd see if you had any ideas! I have run a couple of the picamera test programs on the model a and they are fine, but when run within my code it always fails.

Any ideas?

Thanks

Martin

@waveform80
Copy link
Owner

Weird! As it happens I got a Model A (and a Pi Noir) at xmas (up until now I've only been able to test on a Model B, 512Mb Rev 2). I'll try and get it all setup tonight and run the picamera test suite on it to see what happens.

That said, if the picamera test programs are operating successfully, I'd assume there's something your code is doing that's causing it to fail (even though it evidently shouldn't, given it's running successfully on the model B). What does your code do that the picamera test programs don't? I'm wondering whether it repeatedly initializes the camera or anything like that?

@martinohanlon
Copy link
Author

Well two of the test programs ran successfully.

My code spawns a number of threads which monitor a gpio pin for a button input, listens to the uart and reads from a 1 wire sensor. When the main program loop picks up that a button has been pressed it starts the camera using picamera.

The error occurs the first time you call picamera.Camera(), the code seems to wait for a couple of seconds, like its waiting to instantiate something and then returns the error. Im going to stick some debugging code into the program to see if that helps. Im also wondering whether its a revision thing rather than a model thing! I have a model b rev 2, so I'll give it a go on that as well and see if I can reproduce the error

Any thoughts, gratefully received.

@martinohanlon
Copy link
Author

It has nothing to do with picamera, Ill close the issue, very wierd bug between revisions, and the use of modprobe and 1-wire gpio. see here for info - http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=65088&p=478968#p478968

@waveform80
Copy link
Owner

For anyone else running into this issue, it's tracked as raspberrypi/linux#435 - that ticket contains a possible workaround but it doesn't seem to be universally successful...

@apfeiffer1
Copy link

Just in case: I had the same problem and found that my memory split was somehow reset to 128MB - changing that (sudo raspi-config -> Advanced Options -> Memory Split) to use only 16GB for the GPU made the error go away. Now on to using it ... :)

@Manoj-nathwani
Copy link

For anyone who stumbles across this trying to find another solution...

Solution

Only initialize the picamera.PiCamera() object once, then re-use it to take more pictures. So taking it out the while True loop and making it reusable solved the problem in my case 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants