Line 30: |
Line 30: |
| <code>sudo ./install_driver.sh [camera module]</code> | | <code>sudo ./install_driver.sh [camera module]</code> |
| | | |
− | camera module:could be veye327,csimx307,cssc132. | + | camera module:could be veye327,csimx307,cssc132,veyecam2m. |
| + | |
| + | '''Note: veyecam2m is a new version driver that can replace veye327 and supports all modules of the VEYE series with 200W resolution.''' |
| + | |
| + | Note: For VEYE-MIPI-IMX327S or VEYE-MIPI-IMX462, please make sure '''hdver''' must >= 0x5. |
| + | |
| + | http://wiki.veye.cc/index.php/VEYE-MIPI-IMX327S_version_log |
| | | |
| ==== Uninstall the driver ==== | | ==== Uninstall the driver ==== |
Line 76: |
Line 82: |
| === Gstreamer usage Demo === | | === Gstreamer usage Demo === |
| <code>export DISPLAY=:0</code> | | <code>export DISPLAY=:0</code> |
| + | |
| + | * install gstreamer |
| + | |
| + | <code>sudo apt-get install gstreamer1.0-tools</code> |
| | | |
| * Snap a picture (VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) | | * Snap a picture (VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) |
Line 110: |
Line 120: |
| [[CS-MIPI-X for Raspberry Pi#Video Control Toolkits Manual|CS Series Video Control Toolkits Manual]] | | [[CS-MIPI-X for Raspberry Pi#Video Control Toolkits Manual|CS Series Video Control Toolkits Manual]] |
| | | |
| + | === Notes for CM4 === |
| + | Cm4 supports the use of two cameras at the same time. Following above steps will only be able to use CAM1. To use two cameras, follow the following steps: |
| + | |
| + | ==== Upgrade dt-blob.bin ==== |
| + | <code>wget <nowiki>https://www.raspberrypi.org/documentation/hardware/computemodule/dt-blob-dualcam.bin</nowiki></code> |
| + | |
| + | <code>sudo cp dt-blob-dualcam.bin /boot/dt-blob.bin</code> |
| + | |
| + | ==== Upgrade dual camera version dtbo file ==== |
| + | Use csimx307,5.10.17-v7l+ kernel as an example: |
| + | |
| + | <code>sudo cp raspberrypi_v4l2/release/driver_bin/5.10.17-v7l+/csimx307-dual-cm4.dtbo /boot/overlays/csimx307.dtbo</code> |
| + | |
| + | <code>sudo reboot</code> |
| + | |
| + | ==== Device node description ==== |
| + | The CM4 module uses two I2C channels to communicate with the two cameras respectively. |
| + | {| class="wikitable" |
| + | ! description |
| + | !i2c bus num |
| + | !video node |
| + | |- |
| + | |CAM0 |
| + | |0 |
| + | |video0 |
| + | |- |
| + | |CAM1 |
| + | |10 |
| + | |video2 |
| + | |} |
| + | Note: If there is only one camera, video node is always video0. |
| + | |
| + | ==== Gstreamer usage Demo ==== |
| + | <code>export DISPLAY=:0</code> |
| + | |
| + | *CAM0 preview(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) |
| + | |
| + | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink videosink=autovideosink sync=false text-overlay=false -v</code> |
| + | |
| + | *CAM1 preview(VEYE-MIPI-327,CS-MIPI-IMX307 @1080p mode) |
| + | |
| + | <code>gst-launch-1.0 v4l2src device=/dev/video2 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink videosink=autovideosink sync=false text-overlay=false -v</code> |
| === Source code cross compilation === | | === Source code cross compilation === |
| The main resources in this section are the [https://www.raspberrypi.org/documentation/linux/kernel/building.md official piOS building method]. We use the method of cross-compilation, and the 5.4.72 version of 32bitOS is taken as an example. | | The main resources in this section are the [https://www.raspberrypi.org/documentation/linux/kernel/building.md official piOS building method]. We use the method of cross-compilation, and the 5.4.72 version of 32bitOS is taken as an example. |
| | | |
| The following operations are done on ubuntu PC. | | The following operations are done on ubuntu PC. |
| + | |
| + | ==== Build cross-compilation environment on Ubuntu 64-bitoperating system) ==== |
| + | <code>sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev</code> |
| + | |
| + | <code>sudo apt install crossbuild-essential-armhf</code> |
| + | |
| + | ==== Download the standard version of the piOS source code ==== |
| + | |
| + | ===== Confirm the piOS version of your raspberry Pi ===== |
| + | |
| + | * <code>Release version</code> |
| + | |
| + | <code>$ uname -a</code> |
| + | |
| + | <code>Linux raspberrypi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux</code> |
| + | |
| + | * <code>Code tag</code> |
| + | |
| + | <code>$ cp /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz ./</code> |
| + | |
| + | <code>gunzip changelog.Debian.gz</code> |
| + | |
| + | Check the top lines and you will know the tag. |
| + | ===== There are two ways to get the source code of the version you want: ===== |
| + | |
| + | # using git to clone the corresponding branch and checkout the corresponding tag. |
| + | |
| + | <code>git clone --branch rpi-5.4.y <nowiki>https://github.com/raspberrypi/linux</nowiki></code> |
| + | |
| + | <code>git checkout raspberrypi-kernel_1.20201022-1</code> |
| + | |
| + | ''PS: Please replace the above two commands with your own corresponding versions.'' |
| + | |
| + | 2. Manually download the version code of the corresponding tag directly from the link below. |
| + | |
| + | https://github.com/raspberrypi/linux/tags |
| + | |
| + | ==== Patch our code to kernel ==== |
| + | |
| + | *Driver source code |
| + | |
| + | camera driver path is : linux/drivers/media/i2c,copy our camera module drivers to this path. |
| + | |
| + | *Modify the the Makefile and Kconfig files |
| + | |
| + | Modify the Config and Makefile in the same path,add the corresponding camera driver. |
| + | |
| + | *dts file |
| + | |
| + | dts file path is :linux/arch/arm/boot/dts/overlays,copy our [camera]-overlay.dts files to this path. |
| + | |
| + | *Modify dts Makefile |
| + | |
| + | Modify the Makefile in the same path,add the corresponding dts compilation option. |
| + | |
| + | ==== Building ==== |
| + | |
| + | ==== Preparing ==== |
| + | <code>export ARCH=arm</code> |
| + | |
| + | <code>export CROSS_COMPILE=arm-linux-gnueabihf-</code> |
| + | |
| + | * Raspberry Pi 1, Pi Zero, Pi Zero W, and Compute Module default build configuration |
| + | |
| + | <code>KERNEL=kernel</code> |
| + | |
| + | <code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig</code> |
| + | |
| + | * Raspberry Pi 2, Pi 3, Pi 3+, and Compute Module 3 default build configuration |
| + | |
| + | <code>KERNEL=kernel7</code> |
| + | |
| + | <code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig</code> |
| + | |
| + | * Raspberry Pi 4 default build configuration |
| + | |
| + | <code>KERNEL=kernel7l</code> |
| + | |
| + | <code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig</code> |
| + | |
| + | ==== Add compilation options ==== |
| + | <code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig</code> |
| + | |
| + | Add the compilation options by the corresponding camera module, for 5.4 version kernel the path is driver-- > multimedia-- > i2C. |
| + | |
| + | For 5.10 version kernel,the path is Device Drivers --> Multimedia Support --> Media ancillary drivers --> Camera sensor devices. |
| + | |
| + | ===== Build ===== |
| + | <code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4</code> |
| + | |
| + | === References === |
| + | <nowiki>https://www.raspberrypi.org/documentation/linux/kernel/building.md</nowiki> |