Skip to main content
By the end of this section, you will have gained experience in the following areas:
  • How to connect a CSI camera to the Gemstone O1 development board.
  • Adding overlays.

What is CSI?

CSI (Camera Serial Interface) is a serial bus designed for high-resolution cameras in mobile devices and embedded systems. This interface was developed by the MIPI (Mobile Industry Processor Interface) Alliance and enables high-speed, reliable transfer of image and video data between the processor and the camera sensor. It is commonly preferred in cameras used in smartphones, drones, and mini handheld computers.

Steps

1

Making the Cable Connection

The cable between the camera and the Gemstone O1 development board must be connected correctly.
2

Adding an Overlay

The relevant overlay must be added to the uEnv.txt file located in the boot partition for the CSI camera to work.
3

Board Reboot

After completing all these steps, simply reboot the development board.

1. Making the Cable Connection

To properly connect the cable between the camera and the Gemstone O1 development board, you must make a connection as shown in the photo below. You can connect the CSI cable to either socket; the important thing here is that you must add the overlay that activates the CSI of the socket you plugged into.
The part of the cable containing the copper wires should face the white part of the socket.
The connector farther from the Ethernet socket is CSI0, while the connector closer to it is CSI1.

2. Adding an Overlay

You can view the overlays of supported cameras using the following command.
Open the uEnv.txt file located in the boot directory using the nano text editor from the terminal interface.
Since we are using the command with sudo, it will ask for a password. If you haven’t changed it, you should use the password you set when writing the image with Gem-Imager.
The uEnv.txt file will contain definitions like these.
Add the file name you obtained with the previous command to the end of the overlays= leaving a space. For example, when you connect the IMX219 camera to the CSI0 connector (the connector that is far from the Ethernet port).
You should use the file name. The final version of the uEnv.txt file will look like this. You must place the appropriate file name in the <file-name> section.

3. Rebooting the Board

The development board should be restarted using the reboot command.

4. Running the gem-camera-setup Script

The camera connected to the board should be initialized via the following command.
If you get an output similar to the one above, you have successfully connected the camera to the board.

5. Camera Settings

Initially, the following command is used to establish proper communication between the kernel driver of a camera sensor and user space applications. When the command is executed, the video output of the IMX219 camera sensor is set to a resolution of 640x480 and the SRGGB8 format. This setting ensures that applications that will use this data stream in the next step (e.g., a camera application or gstreamer) receive the correct data.
You can access the formats supported by the camera using the following command.
You should enter the device specified in the output of the gem-camera-setup script in the /dev/video-imx219-cam0 section.
The settings below set the camera’s gain and exposure values to reasonable default values. If you notice that your image is washed out, too dark, or even blank, you may need to adjust these parameters according to your lighting environment. If you are not viewing the image properly, it may be a sign that these settings are incorrect.
Indoor Lighting
Natural Light

6. Taking Photos

You can capture an image in .jpg format by running the following command.

7. Video Recording

You can capture a video recording (100 frames) in .mp4 format by running the following command.