Difference between revisions of "Gx series camera appnotes 4 rpi"
| Line 17: | Line 17: | ||
|} | |} | ||
| − | + | ===Hardware Preparation and Installation=== | |
The GX-series cameras utilize a Raspberry Pi-compatible 22-pin interface but require an independent 5 V DC power supply. | The GX-series cameras utilize a Raspberry Pi-compatible 22-pin interface but require an independent 5 V DC power supply. | ||
| Line 87: | Line 87: | ||
You can verify the output result of the environment variable by using the command <code>echo $CAMERAMODEL</code>. Note that this environment variable is only valid for the current session. | You can verify the output result of the environment variable by using the command <code>echo $CAMERAMODEL</code>. Note that this environment variable is only valid for the current session. | ||
| − | === Configuration of Raspberry Pi 5 === | + | ===Configuration of Raspberry Pi 5=== |
| + | On the Raspberry Pi 5, the camera driver now operates via the Media Controller API, necessitating proper configuration of the media graph beforehand. This involves correctly setting the formats of the media pads and establishing appropriate pad links. | ||
| + | |||
| + | A set of scripts implementing this functionality is provided and stored in the <code>rpi5_scripts</code> directory. | ||
| + | |||
| + | * ./find_entity.sh | ||
| + | |||
| + | <code>$ ./find_entity.sh</code> | ||
| + | |||
| + | <code>This is a Raspberry Pi 5.</code> | ||
| + | |||
| + | <code>Kernel version is 6.12.47, use i2c-10 for CAM0 and i2c-11 for CAM1.</code> | ||
| + | |||
| + | <code>Found gxcam @ i2c-10 entity on /dev/media3</code> | ||
| + | |||
| + | <code>Plese get frame from /dev/video0 and use /dev/v4l-subdev2 for camera setting.</code> | ||
| + | |||
| + | After a reboot of the Raspberry Pi 5, the media node and video node assignments for the cameras may change. Therefore, it is recommended to run <code>./find_entity.sh</code> prior to performing subsequent operations to explicitly identify the device nodes. | ||
| + | |||
| + | As shown in the above diagnostic output, the system has detected two connected cameras, along with their corresponding device nodes. | ||
| + | |||
| + | The CAM0 port on the board corresponds to <code>i2c-10</code>, and the CAM1 port on the board corresponds to <code>i2c-11</code>. | ||
| + | |||
| + | * media_setting_rpi5.sh | ||
| + | |||
| + | <code>$ ./media_setting_rpi5.sh</code> | ||
| + | |||
| + | <code>This is a Raspberry Pi 5.</code> | ||
| + | |||
| + | <code>Kernel version is 6.12.47, do not support unpacked format.</code> | ||
| + | |||
| + | <code>Kernel version is 6.12.47, use i2c-10 for CAM0 and i2c-11 for CAM1.</code> | ||
| + | |||
| + | <code>Usage: ./media_setting_rpi5.sh veyecam2m/csimx307/cssc132/mvcam/gxcam -fmt [UYVY/RAW8/RAW10/RAW12] -x [roi_x] -y [roi_y] -w [width] -h [height] -c [cam 0|1]</code> | ||
| + | |||
| + | <code>This shell script is designed to detect the connection of a camera on Raspberry Pi 5.</code> | ||
| + | |||
| + | <code> It utilizes media-ctl and v4l2-ctl commands to configure the linking relationships and data formats of the media pad.</code> | ||
| + | |||
| + | <code> Once completed, you can directly use /dev/video0 or /dev/video8 to obtain image data.</code> | ||
| + | <br /> | ||
Revision as of 11:11, 22 December 2025
How to use the GX series cameras on the Raspberry board
1 overview
The GX series cameras are designed for embedded AI applications. They offer high-performance ISP capabilities, support multiple operating modes, provide a wide range of configurable features, and are built with a robust and reliable design. The cameras use the MIPI CSI-2 interface and are well suited for embedded computing platforms.
1.1 Supported modules
| series | model | state |
|---|---|---|
| GX系列 | GX-MIPI-IMX662 | complete |
2 Hardware Preparation and Installation
The GX-series cameras utilize a Raspberry Pi-compatible 22-pin interface but require an independent 5 V DC power supply.
2.1 The connection method of GX series cameras with 22-pin interface Raspberry Pi
2.2 The connection method between the GX series cameras and the 15-pin interface Raspberry Pi
3 Drive Installation and Verification
3.1 Download the driver package
wget https://github.com/veyeimaging/raspberrypi_v4l2/releases/latest/download/raspberrypi_v4l2.tgz
Domestic users can download it from Gitee:
https://gitee.com/veyeimaging/raspberrypi_v4l2/releases/
3.2 install the driver
tar -xzvf raspberrypi_v4l2.tgz
cd raspberrypi_v4l2/release/
chmod +x *
- For Raspberry Pi 5
sudo ./install_driver.sh veye_gxcam
Then restart the Raspberry Pi.
Note: If it is indicated that the corresponding version of the driver cannot be found, it means that we do not provide the compiled driver program corresponding to your PiOS version. Please try to compile from the source code.
3.3 Uninstall the driver
If you want to switch to a different model of the camera module driver, you must first uninstall the current driver.sudo ./uninstall_driver.sh veye_gxcam
3.4 System status verification
Take GX-MIPI-IMX662 as an example:dmesg | grep gxcam
It can be seen that the camera model probed during the Linux startup stage is:
camera is: GX-MIPI-IMX662
And the /dev/video0 node exists, which proves that the camera is functioning properly.
Note: Trigger script link.
4 Detect the status and configure the environment variables
Here, we provide a script named gx_probe.sh, which is used to automatically detect the recognized camera and configure the default model, width, height, frame rate and other information of the camera into the environment variables.
The usage method is:$ source ./gx_probe.sh i2c_bus
A typical output is as follows:
$ source ./gx_probe.sh 10
The gxcam driver is loaded on i2c-10, but the camera is not detected!
Found veye_gxcam camera on i2c-10.
Setenv CAMERAMODEL = GX-MIPI-IMX662
Setenv FPS = 60
Setenv WIDTH = 1920
Setenv HEIGHT = 1080
You can verify the output result of the environment variable by using the command echo $CAMERAMODEL. Note that this environment variable is only valid for the current session.
5 Configuration of Raspberry Pi 5
On the Raspberry Pi 5, the camera driver now operates via the Media Controller API, necessitating proper configuration of the media graph beforehand. This involves correctly setting the formats of the media pads and establishing appropriate pad links.
A set of scripts implementing this functionality is provided and stored in the rpi5_scripts directory.
- ./find_entity.sh
$ ./find_entity.sh
This is a Raspberry Pi 5.
Kernel version is 6.12.47, use i2c-10 for CAM0 and i2c-11 for CAM1.
Found gxcam @ i2c-10 entity on /dev/media3
Plese get frame from /dev/video0 and use /dev/v4l-subdev2 for camera setting.
After a reboot of the Raspberry Pi 5, the media node and video node assignments for the cameras may change. Therefore, it is recommended to run ./find_entity.sh prior to performing subsequent operations to explicitly identify the device nodes.
As shown in the above diagnostic output, the system has detected two connected cameras, along with their corresponding device nodes.
The CAM0 port on the board corresponds to i2c-10, and the CAM1 port on the board corresponds to i2c-11.
- media_setting_rpi5.sh
$ ./media_setting_rpi5.sh
This is a Raspberry Pi 5.
Kernel version is 6.12.47, do not support unpacked format.
Kernel version is 6.12.47, use i2c-10 for CAM0 and i2c-11 for CAM1.
Usage: ./media_setting_rpi5.sh veyecam2m/csimx307/cssc132/mvcam/gxcam -fmt [UYVY/RAW8/RAW10/RAW12] -x [roi_x] -y [roi_y] -w [width] -h [height] -c [cam 0|1]
This shell script is designed to detect the connection of a camera on Raspberry Pi 5.
It utilizes media-ctl and v4l2-ctl commands to configure the linking relationships and data formats of the media pad.
Once completed, you can directly use /dev/video0 or /dev/video8 to obtain image data.