Raspberry Pi Camera Setup
The MyPi board has been designed to allow the usage of both HD cameras at the same time, the default image comes pre-configured for 2 camera usage.
Configuration for camera usage needs to be done in two config files:
1. The Device Tree File
The device tree file details which GPIO pins and I2C lines the camera(s) will use as well as configuring the internal camera interface.
The device tree source has been structured in 2 clear sections to make this easier to manage and with minimal edits. The default setup configures 2 cameras using GPIO5&21 and GPIO4&22 respectively.
To change this configuration alter the 2 sections marked out in the source file and recompile as shown in the header at the top of the file.
A copy of the source file is stored in /root/device-tree
The compiled device tree bin file (dt-blob.bin) lives in /boot/dt-blob.bin
2. The config.txt file
The config.txt file is analogous to the way a BIOS in a PC works in so far as it configures basic board functions and additional functionality overlays, which in turn allow changes to the system configuration without needing to recompile the device tree blob.
The section needed to enable the camera(s) is shown below :
Note : If you comment out these lines in config.txt both cameras will be disabled, regardless of settings within the device tree file.
The GPU and CPU share memory, enabling the camera requires a minimum of 128MB of RAM, if you enable the GPU (by enabling camera support) then the GPU will reserve the specified amount, as a result the total memory available for the OS will be reduced by the amount given over to the GPU.
The command below shows the current camera configuration :
a helper script (camerastat) has been created in /usr/local/bin to report the current camera config status
Note : If 2 cameras are configured (as per default image) but only 1 camera is connected it will always be detected as camera 0 regardless of which physical port the camera is plugged into.
For more information on how to use the camera system see below link