BPI-F4:How to use video camera OV5647 to capture image then to open image

  1. Use v4l2-ctl --list-formats-ext --device /dev/video42 querying device video format. 64c2d9f5fa6c4c99ab089951205c85a1

  2. Use v4l2-ctl --streamcapture image.

v4l2-ctl -d /dev/video42 --set-fmt-video=width=1920,height=1080,pixelformat=pGAA --stream-mmap=3 --stream-to=/home/sunplus/Videos/ov5647.raw --stream-skip=9 --stream-count=1

  1. Insert the USB flash drive and mount it, then copy the generated OV5647.RAW file to the USB flash drive. 2af62a38130a3823feed559e8daa05d2

  1. Download raw image viewer from PixelViewer | Carina Studio

BPI-F4:How to create an image that can use OV5647

1.Install dependency packages and tools

sudo apt-get install pv openssl libssl-dev bison flex git make u-boot-tools libmpc-dev libgmp-dev python3-pip mtd-utils libncurses5 libncurses-dev mtools -y
sudo pip install pycryptodomex pyelftools Crypto
sudo ln -s /usr/bin/python3 /usr/bin/python

2.Code download Gitee:

git clone https://gitee.com/sunplus-plus1/q654.git

or Github:

git clone https://github.com/sunplus-plus1/Q654.git

3.After the download is complete, a directory named q654 will be generated, as shown below:

Execute the following command in this directory to grab the subdirectory code:

git submodule update --init --recursive

Execute the following command to switch to the master branch:

git submodule foreach git checkout master

After the download is complete, execute the following command to view the directory file size:

du -hd 1

The directory file size should be: 68bd478861797e593fd6e5f01e286e9

4.Execute make config in the root directory of the code. The first time you run it, it will automatically download all the necessary toolchains from the Internet.

After the download is complete, the hardware platform options will be displayed, including different customer platforms and development board abbreviations.

Select as follows:

25e4a2847adf3f95e05c8719e881bd1

5.Enter the kernel configuration by running the following command in the top directory of project 9f772d7c2c6a328450451c53a154fceb

6.Selects sub-menus: Device Drivers>Multimedia support>Media ancillary drivers>Camera sensor devices

749fb172b37e7f7a27c5d9c3feb5dede

33e12110b690f50a8f67b351f90d28e6

a4ece54b7ca95967b3105950a86a4975

8029b056b9ddd43e6612c155273a9488

7.Select “OmniVision OV5647 sensor support” and press “Y”. Then save and exit.

8.Device-tree source files of SP7350 are located in linux/kernel/arch/arm64/boot/dts/sunplus/ . Modify device tree source file to define OV5647 source for driver

9.After completing all configurations, you are ready to initiate the code build. Execute the following command to commence the build process:

a8299b5b790609e55fb825b04dfa4590

After make command completes, it will display information similar to the following screenshot:

10.Upon completion of the build process, the resulting image files are stored in the directory. Refer to the list below:out/boot2linux_SDcard/

  • ISPBOOOT.BIN:** Binary file storing X-Boot, the first-stage boot-loader responsible for DDR SDRAM initialization and training, loading images of TF-A, OP-TEE, U-Boot, and initiating the execution of TF-A.
  • fip.img:** Image file comprising images of Trusted Firmware-A (TF-A) and Open Portable Trusted Execution Environment (OP-TEE).
  • u-boot.img:** Image file of the U-Boot boot-loader, the second-stage boot-loader responsible for loading and running the Linux kernel image.
  • uEnv.txt:** Environment file for U-Boot. U-Boot imports environment variables from this file after initialization. If the uenvcmd command is defined in uEnv.txt, U-Boot executes the specified command after importing uEnv.txt.
  • uImage:** Image file of the compressed Linux kernel with the U-Boot header.
  • ISP_SD_BOOOT.img:** Image file for burning an SD card, containing all files in both partitions.

BPI-F4:How to use video camera ov5647

After connecting and powering on the camera module, Use v4l2-ctl --all --device /dev/video0 command getting device all information

Use v4l2-ctl -d /dev/video42 --set-ctrl params=value setting device controls.

  • Enable auto_exposure:
v4l2-ctl -d /dev/video42 --set-ctrl auto_exposure=1
  • Enable gain_automatic
v4l2-ctl -d /dev/video42 --set-ctrl gain_automatic=1
  • Enable white_balance_automatic
v4l2-ctl -d /dev/video42 --set-ctrl white_balance_automatic=1

Use querying device video format

Use v4l2-ctl for image capture:

v4l2-ctl -d /dev/video42 --set-fmt-video=width=1920,height=1080,pixelformat=pGAA --stream-mmap=3 --stream-to=/home/sunplus/Videos/ov5647.raw --stream-skip=9 --stream-count=1```
1 Like

1.First, connect the OV5647 camera to the F4 board (Note: Ensure it is not connected backwards; the gold fingers must face the jumper cap).

2.Then power up and start the system. If this is your first time using the OV5647 camera, execute the following command; otherwise, you may skip this step.

sudo apt update
sudo apt install v4l-utils

3.Connect via HDMI, launch the terminal in Ubuntu desktop mode, and enter the following command to activate the OV5647 camera

ffplay -f v4l2 -i /dev/video42

The image I am using is as follows 20250730-BPI-F4-Ubuntu24.04-xfce-desktop-SD.img

my boot log is as follows BPI-F4_log ofbooting_SD.txt (60.6 KB)