Adding OV7251 sensor driver to k230_linux_sdk questions

Viewed 39

Hello, I have a CanMV-K230-V1.1 board and I am currently using the k230_linux_sdk image on it. My goal is to adapt the OV7251 sensor, and eventually connect at least 2 of these sensors at the same time. I have started researching how to do this, but there are a lot of questions:

  1. I have followed the instructions for building the linux sdk image from source, and it works with no changes. Now looking at k230-canmv.dts (in the https://github.com/ruyisdk/linux-xuantie-kernel), I see that I2C0 and I2C1 are disabled, as well as mipi1 and mipi2. What is the best way to enable these? Should I make a new DTS file and add it to BR2_LINUX_KERNEL_CUSTOM_DTS_PATH?
  2. I started writing the OV7251 vvcam driver (based on the OV5647 driver, using these instructions), but I see that the open_i2c() function has /dev/i2c-0 hard-coded. How should the driver be written if it is expected to use more than one camera, with different I2C port on each one?
  3. I see that there is an "ISP tuning" process needed to generate 3 config files for vvcam. Reading your guide, it is asking to acquire a raw image for the calibration. What is the process for capturing a raw image from the camera sensor? Is it possible to use vvcam without the configuration files first to get raw images, and then generate the tuning after?
  4. What is the best SDK for performance of running an AI model on multiple camera streams? Would the k230_sdk (rt-smart on big, linux on little core) have better performance for running AI on the big core with no extra linux overhead? It also looks like maybe the sensor driver for rt-smart would be easier to implement.
2 Answers

Looking through the vvcam source while trying to debug the OV7251 driver development, I found that more than one active MIPI CSI port is not allowed because they are hardcoded to all have the name "vvcam-mipi.0" which causes all subsequent CSI ports after the first one to fail enumeration. See here.

It looks like the k230_sdk is much more mature, so in the meantime I wrote an OV7251 driver following the tutorial (using SC035HGS ISP tuning works well for now). Would recommend this path for anyone looking to add a new sensor right now.

For this project, it would probably be better to use k230_linux_sdk though, so I am still interested in trying to add support for the camera sensor there too. After studying the vvcam system, and comparing it to the working VICAP driver implementation, many things are much clearer now, but there are still some doubts:

  1. How do I tell vvcam which sensor uses which MIPI port? There is a "VVCAM_MIPI_SET_DEV_ATTR" ioctl function, but nothing calls this function in the source code.
  2. It looks like this configuration might be happening inside the compiled binary "isp_media_server", and it seems that it only supports configuring one camera. Is there a way to use more than one camera?