I would double check that the camera is correctly connected at both ends and not loose, and that it is enabled via the RPI config menu. The RPi+ camera draws about 260 mA more current than the board so you need a large enough power supply to support the added load.
After the camera is enabled, you also need a reboot. Check that /boot/config.txt
contains the lines:
start_x=1
gpu_mem=128
This will confirm if the camera is properly enabled. If the GPU memory is too small the camera will not work. Also try running a sudo rpi-update
.
There are two ways of accessing the camera: Through the Broadcom specific MMAL library, which is used by raspistill
and raspivid
, or via Video4Linux2, which is a cross platform standard. If you have V4L2 installed then you can try to access the camera through that driver to see what happens. V4L2 should come pre-installed on the latest Raspberian OS. You can check by typing which v4l2-ctl
. Normally it is /usr/bin/v4l2-ctl
, otherwise try a sudo apt-get install v4l-utils
.
To enable it to access the camera, you should first load the driver module by typing
sudo modprobe bcm2835-v4l2
.
This should create a camera device at /dev/video0
.
You can then get information by typing
v4l2-ctl --all
.
This will list a huge amount of information about any cameras in the system and their settings and drivers. And by typing
v4l2-ctl --device=/dev/video0 --list-formats-ex
you can determine the list of frame sizes and frame rates supported.
There's also the possibility that you have a faulty camera board.
sudo apt-get update && sudo apt-get upgrade
to make sure you are running with the latest software.