Placeholder image

How to use SSP library

<Fundamental setup needed for Raspberry Pi 1, 2 and 3>

(Step 1) Download the latest Rasbian OS from this link.

(Step 2) Write the OS image to an SD card using a writing tool such as Win32DiskImager.

(Step 3) Configure your Raspberry Pi by connecting a keyboard and a mouse. After booting the X window, open a terminal window and then, install the following software packages and setup the environment.

(Step 4) The initial configuration of the partition of the Rasbian, please expand the partition for user area using the raspi-config command.

$ sudo raspi-config

The image below shows the GUI of the raspi-config. Select the Expand Filesystem and then expand the partition.

(Step 5) Update the latest version of the package repository using the following commands:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo rpi-update
$ sudo reboot

(Step 6) Enable I2C using the raspi-config.
From the "Interface options", select I2C and then select "Enable".

(Step 7) Enable camera using raspi-config.
Enable the camera function in Raspberry Pi by selecting "Camera" from "Interface Options". In the last of the configuration, you need to reboot your Raspberry Pi.

<Individual configuration on Raspberry Pi 1 and 2>

The following explanation is appllied to only for Raspberry Pi 2 users. If you use the other device, skip this section.

(Step 1) Enable I2C of the VideoCore. The CSI-2 interface on Raspberry Pi 2 is connected to a GPU called "VideoCore". The CCI is also connected to the LSI and the SSP library use it for accesing an image sensor device. Enabling the I2C in the explanation above just activate the I2C interface in the ARM LSI side in the Raspberry Pi. Therefore, we need to add configurations in the device tree informarion.
Using the command below, please open the file /boot/config.txt.

$ sudo nano /boot/config.txt

Add a line below at the last of the file;


After adding the configuration, reboot the system using the folowing command;

$ sudo reboot

For Raspberry Pi 2, all configuration has been completed by the steps until here.

<Individual configuration for Raspberry Pi 3>

The individual configuration described below is dedicated to Raspberry Pi 3 environment. Do not perform the individual configuration for other Raspberry Pi.
In the case of Raspberry Pi 3, add the following single line in the last of the file /boot/config.txt.


Note) If the configuration "dtparam=i2c_vc=on" is included in the file /boot/config.txt, comment out by inserting "#" in the beginning of the line. (Even if it is included, the SSPlibrary would work. But it is better to remove it for just in case.) In addition, after you setup an SD card with the configuration below on Raspberry Pi 3, and then if you use it on Raspberry Pi 2, the USB devices connected to the Raspberry Pi 2 become unstable. If you want to use SSP library on Raspberry Pi 2, apply only the individual configuration for Raspberry Pi 2.

Using the following command, add the configuration above;

$ sudo nano /boot/config.txt

<Individual configuration on Rasberry Pi Compute Module>

The latest version of SSP library supports 2 lanes and 4 lanes configuration of CSI-2 connection from CAM1 port.

(Step 1) Refer the document FLASHING THE COMPUTE MODULE EMMC from the Raspberry Pi Foundation, and write the Rasbian OS image to the flash memory on the compute module.

(Step 2) Make junpar connections for CAM0 and CAM1 configuration.
Confirm the following connections are correctly made:
CD1_SDA ===> GPIO0
CD1_SCL ===> GPIO1
CAM1_IO1 ===> GPIO2
CAM1_IO0 ===> GPIO3
The folliwng photo can be a hint for the guide;

(Step 3) Power on after connecting an image sensor module by a 22 pin flat cable.

(Step 4) Write the pin configuration file for Compute Module to the /boot directory.

$ sudo wget -O /boot/dt-blob.bin

For the subsequent configurations, follow the steps described in <Raspberry Pi 1 and 2\gt above.

<Common configurations for all Raspberry Pis>

The latest SSP library needs HexaVision Mono Contril library called "HexaVsionControl" library.

Since the SSP library 1.10, HexaVision is supported. Because the SSP library links to the library, we need to setup the library before the SSP.

(Step 1) From the download page, the latest HexaVisionControl library and extract using the folowing comandline;

$ tar zxvf HexaVisionControl-0.92.tar.gz

(Step 2) Create libhexavision_ctl.conf using the following commnad;

$ sudo nano /etc/

Add the library path for HexaVisionControl. For example, when the library is extracted into "/home/user_name/HexaVision", add the following line to the file;

/home/user_name HexaVision/HexaVisionControl/version/lib

Decompress the latest SSP library package after the configurations above.

(Step 1) Download the latest SSP library from the download page, and then decompress the package using the tar command below;

$ tar zxvf libssp-0.98.tar.gz

(Step 2) Add a library search path to the SSP library into the system library search path. The SSP library is provided by a dynamic link library. Therefore, it needs to register the search path to the system using ldconfig command.
First,create a file "libssp.conf".

$ sudo nano /etc/

Add the path to the SSP library into the file. For example, if you decompress the SSP library version 0.98 into /home/user_name/, add the following line in the "libssp.conf";


(Step 3) After saving the conf file, execute the folloiwng command to validate the configuration;

$ sudo ldconfig

<Trying the sample programs>

Let us run the sample programs in the sample directory in the SSP library package.
First, download the image sensor profile XML file from the "download" link in this web site.

(1) Still test : stiilsample
This sample captures a RAW image from the commandline. This does not need to prepare any dispay devices such as HDMI display.
From the commandline, execute;

$ stillsample image_sensor_profile_XML output_RAW_filename

The saved image is 10bit RAW image. It is convinient to view the RAW image file, use the RAWViewer software. It is downloadable from the "download" link in this web site.
You can capture the images such as the following example. This example is captured by the profile of IMX219 (1280x720 60Hz).

(2) Realtime Viewer sample: viewersampleGain
This sample works on the X Window system. This sample processes the frame images from the SSP library using OpenCV framework. To run the sample, install the OpenCV package. Please install it by the following command;

$ sudo apt-get install libopencv-dev

By connecting the HDMI cable to a display, execute the following comand in a terminal window.

$ viewersampleGain image_sensor_profile_XML sensor_model

The supported sensor models are currently IMX219, IMX408 and IU233. You can change the configuration of the gain and the shutter speed registers in the image sensor. In the viewer window, type "g" key to chage the mode to the gain modification mode. Type "s" key to change it to the shutter speed modification mode. In each mode, you can increase the value by type the "+" key and decrease it by the "-" key. To enable/disable the gamma correction mode, type "0" key. The default configuration does not activate the gamma correction.