Sorry for the long-winded post. I understand this issue has been posted throughout various forums (including here), but even after following all of the advice I have seen, I am unable to get the Pi Camera (v2.1) to take any images or display video using Raspistill, the Python sample programs directly from raspberrypi.org, or programs that I have written on my Raspberry Pi v3 Model B+.
Before using trying the camera out, I made sure I was completely up to date via the following commands, and that the camera interface was enabled in RPi Configuration:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo rpi-update sudo rpi-config sudo reboot
If I try to use Raspistill, I get the following output:
sudo raspistill -v -o image.jpg raspistill Camera App v1.3.11 Width 3280, Height 2464, quality 85, filename image.jpg Time delay 5000, Raw no Thumbnail enabled Yes, width 64, height 48, quality 35 Link to latest frame enabled no Full resolution preview No Capture method : Single capture Preview Yes, Full screen Yes Preview window 0,0,1024,768 Opacity 255 Sharpness 0, Contrast 0, Brightness 50 Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0 Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none' Flicker Avoid Mode 'off' Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128 Rotation 0, hflip No, vflip No ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000 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
If I try to run the following Python program:
from picamera import PiCamera from time import sleep camera = PiCamera() camera.start_preview() sleep(10) camera.stop_preview()
I get the following output:
Traceback (most recent call last): File "/home/pi/Desktop/camera.py", line 4, in <module> camera = PiCamera() File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__ self._init_preview() File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview self, self._camera.outputs[self.CAMERA_PREVIEW_PORT]) File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__ self.renderer.inputs.connect(source).enable() File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable prefix="Failed to enable connection") File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources
However, it seems that the Raspberry Pi does detect the camera:
vcgencmd get_camera supported=1 detected=1
Here are the things I've tried to fix this:
- I've set the GPU memory allocation to 256 MB (overkill probably, I know)
- Rebooted multiple times
- I'm aware that the SPI, I2C, and 1Wire interfaces can cause issues with the camera, so I've blacklisted the modules and changed the /etc/modules file (shown below)
File - /etc/modprobe.d/raspi-blacklist.conf:
blacklist spi-bcm2708 blacklist i2c-bcm2708
File - /etc/modules:
#w1-gpio pullup=1 #w1-therm #i2c-bcm2708 #i2c-dev #spi-bcm2708 snd-bcm2835 lirc_dev lirc_rpi gpio_out_pin=7
I'm not sure what to do from here. I have 20 GB free on my SD card, so I have enough available space.
Edit July 1, 2018:
Output of free -l:
total used free shared buff/cache available Mem: 766752 247836 275564 15596 243352 453304 Low: 766752 491188 275564 High: 0 0 0 Swap: 102396 0 102396
Output of df:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 30568540 8307800 20955356 29% / devtmpfs 378768 0 378768 0% /dev tmpfs 383376 0 383376 0% /dev/shm tmpfs 383376 10048 373328 3% /run tmpfs 5120 4 5116 1% /run/lock tmpfs 383376 0 383376 0% /sys/fs/cgroup /dev/mmcblk0p1 43539 22419 21121 52% /boot tmpfs 76672 0 76672 0% /run/user/1000
Edit July 6, 2018:
I tried with a fresh version of Raspbian and didn't use
rpi-update when configuring, but nothing has changed. However, I did notice something interesting when looking at the GPU log:
Partial Output of sudo vcdbg log msg:
111335.842: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 134, power enable gpio = 133 111636.620: camsubs: Camera not found 111636.701: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 134, power enable gpio = 133 111937.465: camsubs: Camera not found 111937.542: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 134, power enable gpio = 133 111939.220: camsubs: Camera found OK 111941.741: gpioman: gpioman_get_pin_num: pin CAMERA_LED not defined
Okay, that sheds some light on the problem. It seems to be getting caught up looking for a GPIO pin that isn't defined correctly. I don't know what documentation I could look at to find out more about this.
pinout only shows the J8 header specification.
I've checked the SUNNY connector, that's seated properly. Could this be a firmware issue? I'm hoping it is not a hardware issue, neither of the components nor the ribbon cable seem to have any obvious damage.
I'm changing the title of the post to be more specific and in hopes that this will get more attention.