Difference between revisions of "CS-MIPI-X i2c/zh"
(→aemode) |
|||
Line 229: | Line 229: | ||
Note: only supported on camcap bit 0 is 1. | Note: only supported on camcap bit 0 is 1. | ||
=====daynightmode===== | =====daynightmode===== | ||
− | <code>./ | + | <code>./cs_mipi_i2c.sh -r -f daynightmode</code> |
− | <code>./ | + | <code>./cs_mipi_i2c.sh -w -f daynightmode -p1 [value]</code> |
{| class="wikitable" | {| class="wikitable" | ||
!value | !value |
Revision as of 14:04, 21 April 2020
cs_mipi_i2c.sh 参数配置脚本使用说明
1 介绍
cs_mipi_i2c.sh 脚本为通过I2C协议对CS-MIPI-X系列的摄像头进行配置的工具集。
目录下总共4个文件,camera_i2c_config、i2c_read、i2c_write、cs_mipi_i2c.sh。
2 树莓派配置管脚,非树莓派忽略此步
你需要先运行
./enable_i2c_vc.sh
./camera_i2c_config
配置管脚,然后执行cs_mipi_i2c.sh
2.1 camera_i2c_config 使用说明
连接树莓派Computer Module情况下,运行
./camera_i2c_config [cameranum]
cameranum | description |
---|---|
0 | CAM0 |
1 | CAM1 |
连接树莓派经典版型情况下,直接运行
./camera_i2c_config
3 cs_mipi_i2c.sh 使用说明
./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),使用i2c0, 对于Compute Module/ CM3,使用i2c1,请添加-b1 选项。
3.1 使用详解
3.1.1 devid
./cs_mipi_i2c.sh -r -f devid
0x02 | 2 lan mipi |
3.1.2 hdver
./veye_mipi_i2c.sh -r -f hdver
获取逻辑固件版本号
value | description |
---|---|
0xXY | Version X.Y |
for example:
0x22 means V2.2
3.1.3 firmwarever
./cs_mipi_i2c.sh -r -f firmwarever
获取固件版本号,一般为X.Y格式,如1.0
3.1.4 productmodel
./cs_mipi_i2c.sh -r -f productmodel
获取产品型号,如:CS-MIPI-IMX307
3.1.5 camcap
./cs_mipi_i2c.sh -r -f camcap
获取摄像头额外能力集,每一个bit代表一个能力,1有效。
bit | description |
---|---|
0 | sync stream mode |
3.1.6 videofmtcap
./cs_mipi_i2c.sh -r -f videofmtcap
获取摄像头支持的视频码流格式,如:
1920*1080 30fps
1280*720 60fps
3.1.7 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
获取和设置摄像头当前的视频码流格式,如:
1920*1080@30fps
1280*720@60fps
640*480@130fps
3.1.8 ispcap
./cs_mipi_i2c.sh -r -f ispcap
获取当前模组支持的isp配置能力集。
bit0 : CSC hue,contrast,saturation
bit1 : AE auto exposure 自动曝光配置
bit2 : ME manual exposure 手动曝光配置
bit3 : AWB auto white balance 自动白平衡配置
bit4 : MWB manual white balance 手动白平衡配置
3.1.9 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 | 工频为50Hz |
60 | 工频为60Hz |
配置当前模组使用环境的工频频率。50Hz环境对应帧率为25、50、100,60Hz环境对应帧率为30、60、120。
3.1.10 i2caddr
./cs_mipi_i2c.sh -r -f i2caddr -d i2caddrnow
./cs_mipi_i2c.sh -w -f i2caddr -p1 newi2caddr -d oldi2caddr
本模组支持修改i2c地址,范围[0x3,0x77]。
Note: only supported on firmware version >= 1.05
3.1.11 paramsave
./cs_mipi_i2c.sh -w -f paramsave
将已经配置的参数写入到flash。断电保存。
3.1.12 sysreset
./cs_mipi_i2c.sh -w -f sysreset
摄像头恢复出厂默认参数。
3.1.13 streammode
value | description |
---|---|
0 | free running |
1 | sync mode |
value | description |
---|---|
0 | master |
1 | slave |
./cs_mipi_i2c.sh -r -f streammode
读取当前的码流模式和主从模式
./cs_mipi_i2c.sh -w -f streammode -p1 0
配置摄像头为freerunning模式
./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0
配置设想头为sync模式,且为主
./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 1
配置摄像头为sync模式,且为从
sync模式详见:摄像头模组码流模式说明
Note: only supported on camcap bit 0 is 1.
3.1.14 daynightmode
./cs_mipi_i2c.sh -r -f daynightmode
./cs_mipi_i2c.sh -w -f daynightmode -p1 [value]
value | description |
---|---|
0x1 | Color Mode |
0x2 | Black&White Mode |
0x0 | Trigger Mode |
IR-CUT (Infrared cut-off filter) is a mechanical shutter design. It is placed between the lens and the image sensor, and is controlled by a motor or an electromagnet.
IR-CUT has two status: Block or Deliver the infrared.
- Color Mode
Image is Color Mode and IR_CUT status Block infrared.
- Black&White Mode
Image is Black&White Mode and IR_CUT status Deliver infrared.
- Trigger Mode
Trigger pin : J4 pin1.
Trigger pin High(3.3~12V),Image is Black&White Mode and IR-CUT status Deliver infrared.
Trigger pin Low(GND),Image is Color Mode and IR-CUT status Bolck infrared.
3.1.15 hue
./cs_mipi_i2c.sh -r -f hue
./cs_mipi_i2c.sh -w -f hue -p1 50
hue,range [0,100].
3.1.16 contrast
./cs_mipi_i2c.sh -r -f contrast
./cs_mipi_i2c.sh -w -f contrast-p1 50
contrast,range [0,100].
3.1.17 satu
./cs_mipi_i2c.sh -r -f satu
./cs_mipi_i2c.sh -w -f satu-p1 50
saturation,range [0,100].
3.1.18 aemode
./cs_mipi_i2c.sh -r -f aemode
./cs_mipi_i2c.sh -w -f aemode -p1 0
0 : 自动曝光
1: 手动曝光
3.1.19 metime
./cs_mipi_i2c.sh -r -f metime
./cs_mipi_i2c.sh -w -f metime -p1 10000
手动曝光时间,需aemode为手动模式下生效, us.
range:[0-1000000/framerate]
3.1.20 meagain
./cs_mipi_i2c.sh -w -f meagain -p1 X -p2 Y
./cs_mipi_i2c.sh -r -f meagain
手动模拟增益,单位dB,需aemode为手动模式下生效。
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
X range: depending on sensor.
Y range: [0-9].
IMX307,again range is[0,27]dB, step 0.3dB.
3.1.21 medgain
./cs_mipi_i2c.sh -w -f medgain -p1 X -p2 Y
./cs_mipi_i2c.sh -r -f medgain
手动数字增益,单位dB,需aemode为手动模式下生效。
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
X range: depending on sensor.
Y range: [0-9].
IMX307,dgain range is[0,42]dB, step 0.3dB.
3.1.22 awbmode
./cs_mipi_i2c.sh -r -f awbmode
./cs_mipi_i2c.sh -w -f awbmode -p1 0
0 : auto white balance
1: manual white balance, gain mode
2: manual white balance, color temperature mode
3.1.23 mwbgain
./cs_mipi_i2c.sh -w -f mwbgain -p1 RGAIN -p2 BGAIN
./cs_mipi_i2c.sh -r -f mwbgain
manual white balance mode, set rgain and dgain manually, ggain is always 1.
GAIN is 4-bit decimal precision, for example: 0x23 means 2+3/16=2.19.
3.1.24 mwbcolortemp
./cs_mipi_i2c.sh -w -f mwbcolortemp -p1 3200
./cs_mipi_i2c.sh -r -f mwbcolortemp
手动白平衡,色温模式。 color tempture,range [1500,15000]
3.1.25 expostate
./cs_mipi_i2c.sh -r -f expostate
readonly, get the current exposure state. exposure time, again and dgain.
3.1.26 wbstate
./cs_mipi_i2c.sh -r -f wbstate
readonly, get the current white balance state. rgain, bgain and color tempture.