CS-MIPI-X i2c

From wiki_veye
Jump to navigation Jump to search

查看中文

cs_mipi_i2c.sh Shell scripts usage

Introduction

The cs_mipi_i2c.sh script is a toolset for configuring CS-MIPI-X series cameras through the I2C.

RaspberryPi Only, Set IO config

Include the following files,camera_i2c_config、i2c_read、i2c_write、cs_mipi_i2c.sh.

Running

./enable_i2c_vc.sh

./camera_i2c_config

first,it will config IO pin. Then you can run cs_mipi_i2c.sh.

camera_i2c_config USAGE

  • for standard RPI, just run

./camera_i2c_config

  • for RPI Computer Module

./camera_i2c_config [cameranum]

cameranum description
0 CAM0
1 CAM1

cs_mipi_i2c.sh USAGE

./cs_mipi_i2c.sh

this shell scripts should be used for CS-MIPI-IMX307!

Usage:  ./cs_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -p3 param3 -b bus

options:

    -r                       read

    -w                       write

    -f [function name]       function name

    -p1 [param1]                           param1 of each function

    -p2 [param1]                           param2 of each function

    -p3 [param1]                           param3 of each function

    -b [i2c bus num]               i2c bus number

    -d [i2c addr]                  i2c addr if not default 0x3b

support functions: devid,hdver,camcap,firmwarever,productmodel,videofmtcap,videofmt,ispcap,i2caddr,streammode,powerhz,sysreset,paramsave


Pi3B / Pi3B+ / 3A / 4B(1G/2G/4G),we use i2c0

Compute Module/ CM3,we use i2c1,please add -b 1 option.

devid

./cs_mipi_i2c.sh -r -f devid

0x02 2 lan mipi
hdver

./veye_mipi_i2c.sh -r -f hdver

get hardware logic version

value description
0xXY Version X.Y

for example:

0x22 means V2.2

firmwarever

./cs_mipi_i2c.sh -r -f firmwarever

get firmware version, X.Y, 1.0 for example.

productmodel

./cs_mipi_i2c.sh -r -f productmodel

get product model,for example:CS-MIPI-IMX307


camcap

./cs_mipi_i2c.sh -r -f camcap

get camera module capbility, each bit represents a function.

camcap
bit description
0 sync stream mode
videofmtcap

./cs_mipi_i2c.sh -r -f videofmtcap

get camera video format capbility, for example:

1920*1080 30fps

1280*720 60fps

videofmt

./cs_mipi_i2c.sh -r -f videofmt

./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p3 30

./cs_mipi_i2c.sh -w -f videofmt -p1 1280 -p2 720 -p3 60

./cs_mipi_i2c.sh -w -f videofmt -p1 640 -p2 480 -p3 130

get and set current video format,for example:

1920*1080@30fps

1280*720@60fps

640*480@130fps

ispcap

./cs_mipi_i2c.sh -r -f ispcap

get camera isp capbility. Will add details later.

powerhz

./cs_mipi_i2c.sh -r -f powerhz

./cs_mipi_i2c.sh -w -f powerhz -p1 50

./cs_mipi_i2c.sh -w -f powerhz -p1 60

value description
50 Power frequency is 50Hz
60 Power frequency is 60Hz

Configure the power frequency of the environment in which the camera is used.

  • 50Hz framerate is 25、50、100;60Hz framerate is 30、60、120.
  • camera support antiflicker, accroding to powerhz setting here.
i2caddr

./cs_mipi_i2c.sh -r -f i2caddr -d i2caddrnow

./cs_mipi_i2c.sh -w -f i2caddr -p1 newi2caddr -d oldi2caddr

This module support i2c addr change by software, i2c addr range[0x3,0x77].

Note: only supported on firmware version >= 1.05

paramsave

./cs_mipi_i2c.sh -w -f paramsave

Write the configured parameters to flash. So parameters will not be lost when poweroff.

sysreset

./cs_mipi_i2c.sh -w -f sysreset

The camera reset to the factory default parameters.

streammode
stream mode
value description
0 free running
1 sync mode
slave mode(sync stream mode)
value description
0 master
1 slave

./cs_mipi_i2c.sh -r -f streammode

Read the current stream mode and master-slave mode

./cs_mipi_i2c.sh -w -f streammode -p1 0

Set the current camera to free running mode

./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0

Set the current camera to sync mode, and set to master

./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 1

Set the current camera to sync mode, and set to slave

sync mode :Camera module Stream Mode manual

Note: only supported on camcap bit 0 is 1.