Pi Camera Configuration

Background

The Raspberry Pi CSI Camera port is routed through and processed by the GPU. Since the GPU boots before the CPU, it must be configured properly for the attached camera. Additionally, this configuration cannot be changed without rebooting.

The GPU is not always capable of detecting other cameras automatically. The file /boot/config.txt is parsed by the GPU at boot time to determine what camera, if any, is expected to be attached. This file must be updated for some cameras.

Warning

Incorrect camera configuration will cause the camera to not be detected. It looks exactly the same as if the camera was unplugged.

Updating config.txt

After flashing the pi image onto an SD card, open the boot segment in a file browser.

Note

Windows may report “There is a problem with this drive”. This should be ignored.

Locate config.txt in the folder, and open it with your favorite text editor.

../../_images/bootConfigTxt.png

Within the file, find this block of text:

##############################################################
### PHOTONVISION CAM CONFIG
### Comment/Uncomment to change which camera is supported
### Picam V1, V2 or HQ: uncomment (remove leading # ) from camera_auto_detect=1,
### and comment out all following lines
### IMX290/327/OV9281/Any other cameras that require additional overlays:
### Comment out (add a # ) to camera_auto_detect=1, and uncomment the line for
### the sensor you're trying to user

cameraAutoDetect=1

# dtoverlay=imx290,clock-frequency=74250000
# dtoverlay=imx290,clock-frequency=37125000
# dtoverlay=imx378
# dtoverlay=ov9281

##############################################################

Remove the leading # character to uncomment the line associated with your camera. Add a # in front of other cameras.

Warning

Leave lines outside the PhotonVision Camera Config block untouched. They are necessary for proper raspberry pi functionality.

Save the file, close the editor, and eject the drive. The boot configuration should now be ready for your selected camera.

Additional Information

See the libcamera documentation for more details on configuring cameras.