Difference between revisions of "CS-MIPI-X i2c/zh"

From wiki_veye
Jump to navigation Jump to search
 
(38 intermediate revisions by 3 users not shown)
Line 35: Line 35:
 
./cs_mipi_i2c.sh  
 
./cs_mipi_i2c.sh  
  
this shell scripts should be used for CS-MIPI-IMX307!
+
this shell scripts should be used for CS-MIPI-X!
  
 
Usage:  ./cs_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -p3 param3 -b bus
 
Usage:  ./cs_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -p3 param3 -b bus
Line 56: Line 56:
  
 
    -d [i2c addr]                  i2c addr if not default 0x3b
 
    -d [i2c addr]                  i2c addr if not default 0x3b
 +
===不同板子上的i2c序号 ===
 +
请参考下面的文章,确定你所需要使用的-b参数。
  
support functions: devid,hdver,camcap,firmwarever,productmodel,videofmtcap,videofmt,ispcap,i2caddr,streammode,powerhz,sysreset,paramsave
+
[[I2c bus number and video node|i2c bus number on different boards]]
 
+
===功能列表===
对于树莓派Pi3B / Pi3B+ / 3A / 4B(1G/2G/4G),使用i2c0,  '''对于Compute Module/ CM3,使用i2c1,请添加-b1 选项。'''
 
 
 
====使用详解====
 
 
 
 
=====devid=====
 
=====devid=====
 
<code>./cs_mipi_i2c.sh -r -f devid</code>
 
<code>./cs_mipi_i2c.sh -r -f devid</code>
Line 71: Line 69:
 
|}
 
|}
 
=====hdver=====
 
=====hdver=====
<code>./veye_mipi_i2c.sh -r -f hdver</code>
+
<code>./cs_mipi_i2c.sh -r -f hdver</code>
  
 
获取逻辑固件版本号
 
获取逻辑固件版本号
Line 93: Line 91:
 
<code>./cs_mipi_i2c.sh -r -f productmodel</code>
 
<code>./cs_mipi_i2c.sh -r -f productmodel</code>
  
获取产品型号,如:CS-MIPI-IMX307
+
获取产品型号,如:CS-MIPI-IMX307,CS-MIPI-SC132
  
 
=====camcap=====
 
=====camcap=====
Line 106: Line 104:
 
|0
 
|0
 
|sync stream mode
 
|sync stream mode
 +
|-
 +
|1
 +
|trigger mode
 +
|-
 +
|2
 +
|pick mode
 
|}
 
|}
  
Line 113: Line 117:
 
获取摄像头支持的视频码流格式,如:
 
获取摄像头支持的视频码流格式,如:
  
1920*1080 30fps
+
1920*1080@max 30fps
  
1280*720 60fps
+
1280*720@max60fps
  
 
=====videofmt=====
 
=====videofmt=====
 
<code>./cs_mipi_i2c.sh -r -f videofmt</code>
 
<code>./cs_mipi_i2c.sh -r -f videofmt</code>
  
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p3 30</code>
+
====== 老版本码流格式控制 ======
 +
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p3 10</code>
  
 
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1280 -p2 720 -p3 60</code>
 
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1280 -p2 720 -p3 60</code>
Line 128: Line 133:
 
获取和设置摄像头当前的视频码流格式,如:
 
获取和设置摄像头当前的视频码流格式,如:
  
1920*1080@30fps
+
1920*1080@10fps
  
 
1280*720@60fps
 
1280*720@60fps
  
 
640*480@130fps
 
640*480@130fps
 +
 +
如果摄像机模组支持'''连续帧率可调功能''':
 +
 +
CS-MIPI-IMX307帧率有效范围: [1,maxframerate]
 +
 +
CS-MIPI-SC132帧率有效范围: [2,maxframerate]
 +
 +
注:sync模式不支持连续帧率可调。
 +
 +
====== 新版本码流格式控制 ======
 +
注:CS-MIPI-IMX307 firmware V2.35版本之后支持。
 +
 +
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p4 0.20</code>
 +
 +
p4参数,支持小数帧率功能,用于支持超过1秒的手动曝光模式。
  
 
=====ispcap=====
 
=====ispcap=====
Line 148: Line 168:
  
 
bit4 : MWB  manual white balance 手动白平衡配置
 
bit4 : MWB  manual white balance 手动白平衡配置
 +
 +
bit5 : DME  direct manual exposure 直接手动曝光配置
  
 
=====powerhz=====
 
=====powerhz=====
Line 197: Line 219:
 
|1
 
|1
 
|sync mode
 
|sync mode
 +
|-
 +
|2
 +
|Hardware Trigger
 +
|-
 +
|3
 +
|Software Trigger
 
|}
 
|}
 +
CS-MIPI-IMX307 support 0,1.
 +
 +
CS-MIPI-SC132 support 0,2,3.
 +
 +
<code>./cs_mipi_i2c.sh -r -f streammode</code>
 +
 +
读取当前的码流模式和主从模式
 +
 +
*freerunning模式
 +
 +
<code>./cs_mipi_i2c.sh -w -f streammode -p1 0</code>
 +
 +
配置摄像头为freerunning模式
 +
 +
*sync模式
 +
 +
slave mode(sync stream mode)
 
{| class="wikitable"
 
{| class="wikitable"
|+slave mode(sync stream mode)
 
 
!value
 
!value
 
!description
 
!description
Line 209: Line 253:
 
|slave
 
|slave
 
|}
 
|}
<code>./cs_mipi_i2c.sh -r -f streammode</code>
+
<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0</code>
 +
 
 +
配置摄像头为sync模式,且为主
 +
 
 +
<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 1</code>
 +
 
 +
配置摄像头为sync模式,且为从
 +
 
 +
sync模式详见:[[Camera module Stream Mode manual/zh|摄像头模组码流模式说明]]
  
读取当前的码流模式和主从模式
+
sync模式下,不支持帧率连续可调:
  
<code>./cs_mipi_i2c.sh -w -f streammode -p1 0</code>
+
如果powerhz为60,则支持1080p@30,720p@60,vga@130。
  
配置摄像头为freerunning模式
+
如果powerhz为50,则支持1080p@25,720p@50,vga@130。
  
<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0</code>
+
Note: only supported on camcap bit 0 is 1. Streammode是基础,修改streammode后需要重新配置曝光等参数。
  
配置设想头为sync模式,且为主
+
*Trigger 模式
  
<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 1</code>
+
<code>./cs_mipi_i2c.sh -w -f streammode -p1 2</code>
  
配置摄像头为sync模式,且为从
+
配置摄像头为硬触发模式
  
sync模式详见:[[Camera module Stream Mode manual/zh|摄像头模组码流模式说明]]
+
<code>./cs_mipi_i2c.sh -w -f streammode -p1 3</code>
  
Note: only supported on camcap bit 0 is 1.
+
配置摄像头为软触发模式
 
=====daynightmode=====
 
=====daynightmode=====
 
<code>./cs_mipi_i2c.sh -r -f daynightmode</code>  
 
<code>./cs_mipi_i2c.sh -r -f daynightmode</code>  
Line 244: Line 296:
 
|0x0
 
|0x0
 
|Trigger Mode
 
|Trigger Mode
 +
|-
 +
|0x3
 +
|IR-CUT day, Image Black&White mode
 +
|-
 +
|0x4
 +
|IR-CUT night, Image Color 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 (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.
  
Line 250: Line 308:
 
*Color Mode
 
*Color Mode
  
Image is Color Mode and IR_CUT status '''Block''' infrared.
+
Image is '''Color''' Mode and IR_CUT status '''Block''' infrared.
  
 
*Black&White Mode
 
*Black&White Mode
  
Image is Black&White Mode and IR_CUT status '''Deliver''' infrared.
+
Image is '''Black&White''' Mode and IR_CUT status '''Deliver''' infrared.
  
 
*Trigger Mode
 
*Trigger Mode
Line 263: Line 321:
  
 
Trigger pin Low(GND),Image is Color Mode and IR-CUT status '''Bolck''' infrared.
 
Trigger pin Low(GND),Image is Color Mode and IR-CUT status '''Bolck''' infrared.
 +
 +
*IR-CUT day, Image black&white mode
 +
 +
Image is '''Black&White''' Mode and IR_CUT status '''Block''' infrared.
 +
 +
*IR-CUT night, Image color mode
 +
 +
Image is '''Color''' Mode and IR_CUT status '''Deliver''' infrared.
 
=====hue=====
 
=====hue=====
 
<code>./cs_mipi_i2c.sh -r -f hue</code>  
 
<code>./cs_mipi_i2c.sh -r -f hue</code>  
Line 284: Line 350:
 
saturation,range [0,100].
 
saturation,range [0,100].
  
=====aemode=====
+
=====expmode=====
<code>./cs_mipi_i2c.sh -r -f aemode</code>
+
<code>./cs_mipi_i2c.sh -r -f expmode</code>
  
<code>./cs_mipi_i2c.sh -w -f aemode -p1 0</code>
+
<code>./cs_mipi_i2c.sh -w -f expmode -p1 0</code>
  
 
0 : 自动曝光
 
0 : 自动曝光
  
 
1: 手动曝光
 
1: 手动曝光
 +
 +
2: 直接手动曝光,跳过isp环节,直接写sensor寄存器。CS-MIPI-SC132有效。此模式配合触发抓拍功能,配置参数的生效时间更快。
 +
 +
=====aetarget=====
 +
<code>./cs_mipi_i2c.sh -r -f aetarget</code>
 +
 +
<code>./cs_mipi_i2c.sh -w -f aetarget -p1 0x40</code>
 +
 +
自动曝光模式下目标亮度,需'''expmode'''为自动模式下生效。默认值不同型号会略有不同。
 +
 +
range:[0,255]
 +
 +
=====aetime=====
 +
<code>./cs_mipi_i2c.sh -r -f aetime</code>
 +
 +
<code>./cs_mipi_i2c.sh -w -f aetime -p1 400000</code>
 +
 +
AE最长曝光时间,单位us。需'''expmode'''为自动模式下生效。
 +
 +
expfrmmode为固定帧率模式下:range:(100,1/framerate],如帧率为30,则范围是(100,33333].
 +
 +
expfrmmode为慢快门模式下:range:(100,0xFFFFFFFF)
 +
 +
特殊值:0xFFFFFFFF=1/framerate,自动根据camera工作模式调整。
 +
 +
=====aeagc=====
 +
<code>./cs_mipi_i2c.sh -w -f aeagc -p1 X -p2 Y</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f aeagc</code>
 +
 +
自动曝光模式下,最大系统总增益,单位dB,需'''expmode'''为自动模式下生效。
 +
 +
agc组成部分为Again+Dgain+ISPGain。
 +
 +
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,135]dB, step 0.3dB.
  
 
=====metime=====
 
=====metime=====
Line 298: Line 405:
 
<code>./cs_mipi_i2c.sh -w -f metime -p1 10000</code>
 
<code>./cs_mipi_i2c.sh -w -f metime -p1 10000</code>
  
手动曝光时间,需'''aemode'''为手动模式下生效, us.  
+
手动曝光时间,需'''expmode'''为手动模式下生效, us.  
  
 
range:[0-1000000/framerate]
 
range:[0-1000000/framerate]
 +
 +
如需超长曝光,需要调整framerate以配合此参数的生效。
  
 
=====meagain=====
 
=====meagain=====
Line 307: Line 416:
 
<code>./cs_mipi_i2c.sh -r -f meagain</code>
 
<code>./cs_mipi_i2c.sh -r -f meagain</code>
  
手动模拟增益,单位dB,需'''aemode'''为手动模式下生效。  
+
手动模拟增益,单位dB,需'''expmode'''为手动模式下生效。  
  
 
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
 
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
Line 315: Line 424:
 
Y range: [0-9].
 
Y range: [0-9].
  
IMX307,again range is[0,27]dB, step 0.3dB.
+
IMX307,agc range is[0,27]dB, step 0.3dB.
  
 
=====medgain=====
 
=====medgain=====
Line 322: Line 431:
 
<code>./cs_mipi_i2c.sh -r -f medgain</code>  
 
<code>./cs_mipi_i2c.sh -r -f medgain</code>  
  
手动数字增益,单位dB,需'''aemode'''为手动模式下生效。  
+
手动数字增益,单位dB,需'''expmode'''为手动模式下生效。  
 +
 
 +
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.
 +
 
 +
=====dmetime=====
 +
<code>./cs_mipi_i2c.sh -r -f dmetime</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -w -f dmetime -p1 10000</code>
 +
 
 +
手动曝光时间,需'''expmode'''为直接手动模式下生效, us.
 +
 
 +
range:[0-1000000/framerate]
 +
 
 +
=====dmeagain=====
 +
<code>./cs_mipi_i2c.sh -w -f dmeagain -p1 X -p2 Y</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f dmeagain</code>
 +
 
 +
手动模拟增益,单位dB,需'''expmode'''为直接手动模式下生效。
 +
 
 +
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,agc range is[0,27]dB, step 0.3dB.
 +
 
 +
=====dmedgain=====
 +
<code>./cs_mipi_i2c.sh -w -f dmedgain -p1 X -p2 Y</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f dmedgain</code>
 +
 
 +
手动数字增益,单位dB,需'''expmode'''为直接手动模式下生效。
  
 
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
 
X is the integer part and Y is the decimal part, for example X is 2 and Y is 3 means 2.3dB.
Line 348: Line 496:
 
<code>./cs_mipi_i2c.sh -r -f mwbgain</code>
 
<code>./cs_mipi_i2c.sh -r -f mwbgain</code>
  
manual  white balance mode, set rgain and dgain manually, ggain is always 1.
+
manual  white balance mode, set rgain and bgain manually, ggain is always 1.
  
 
GAIN is 4-bit decimal precision, for example: 0x23 means 2+3/16=2.19.
 
GAIN is 4-bit decimal precision, for example: 0x23 means 2+3/16=2.19.
Line 362: Line 510:
 
<code>./cs_mipi_i2c.sh -r -f expostate</code>  
 
<code>./cs_mipi_i2c.sh -r -f expostate</code>  
  
readonly, get the current exposure state.  exposure time, again and dgain.
+
readonly, get the current exposure state.  exposure time, again and dgain. 直接曝光模式下无效。
  
 
=====wbstate=====
 
=====wbstate=====
Line 368: Line 516:
  
 
readonly, get the current white balance state.  rgain, bgain and color tempture.
 
readonly, get the current white balance state.  rgain, bgain and color tempture.
 +
 +
=====imagedir=====
 +
<code>./cs_mipi_i2c.sh -w -f imagedir -p1 0</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f imagedir</code>
 +
 +
设置图像的方向
 +
{| class="wikitable"
 +
|+imagedir
 +
!value
 +
!description
 +
|-
 +
|0
 +
|normal
 +
|-
 +
|1
 +
|左右翻转
 +
|-
 +
|2
 +
|上下翻转
 +
|-
 +
|3
 +
|上下+左右翻转
 +
|}
 +
 +
=====sreg=====
 +
<code>./cs_mipi_i2c.sh -r -f sreg -p1 SensorAddr</code>
 +
 +
对sensor寄存器的间接访问。
 +
 +
例如,对于CS-MIPI-IMX307
 +
 +
./cs_mipi_i2c.sh -r -f sreg -p1 0x300A
 +
 +
r sensor addr 0x300a value 0x3c
 +
 +
=====striggerone=====
 +
<code>./cs_mipi_i2c.sh -w -f striggerone</code>
 +
 +
Software Trigger模式下,通过写寄存器,触发一次曝光和图像。
 +
 +
note: 仅CS-MIPI-SC132支持。
 +
 +
=====triggeredge=====
 +
<code>./cs_mipi_i2c.sh -w -f triggeredge -p1 [value]</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f triggeredge</code>
 +
 +
Hardware Trigger模式下,触发信号沿属性。
 +
{| class="wikitable"
 +
|+TrigEdge
 +
!value
 +
!description
 +
|-
 +
|0
 +
|上升沿触发
 +
|-
 +
|1
 +
|下降沿触发
 +
|}
 +
note: 仅CS-MIPI-SC132支持。
 +
 +
=====tgdebncr=====
 +
<code>./cs_mipi_i2c.sh -w -f tgdebncr -p1 enable -p2 [value]</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f tgdebncr</code>
 +
 +
Hardware Trigger模式下,触发信号的去毛刺属性。凡小于value(us)的触发信号将被忽略。
 +
 +
note: 仅CS-MIPI-SC132支持。
 +
=====tgdly=====
 +
<code>./cs_mipi_i2c.sh -w -f tgdly -p1 [value]</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f tgdly</code>
 +
 +
Hardware Trigger模式下,触发延迟,单位为us.
 +
 +
note: 仅CS-MIPI-SC132支持。
 +
=====pickmode=====
 +
<code>./cs_mipi_i2c.sh -w -f pickmode -p1 [0/1]</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f pickmode</code>
 +
 +
pickmode是一个特殊的功能,一旦开启,sensor正常工作,但是模组将不输出图像,只有收到pickone指令,输出一张。
 +
=====pickone=====
 +
<code>./cs_mipi_i2c.sh -w -f pickone</code>
 +
 +
在使能pickmode情况下,输出一张图像。
 +
 +
=====sysreboot=====
 +
<code>./cs_mipi_i2c.sh -w -f sysreboot -p1 [value]</code>
 +
 +
摄像机模组重启
 +
{| class="wikitable"
 +
|+reboot_type
 +
!value
 +
!description
 +
|-
 +
|1
 +
|重启程序
 +
|-
 +
|2
 +
|完全重启(6-8秒)
 +
|}
 +
 +
=====ledstrobe=====
 +
<code>./cs_mipi_i2c.sh -w -f ledstrobe -p1 enable</code>
 +
 +
是否使能灯光同步信号。
 +
 +
如果使能,则在Strobe IO引脚在传感器曝光时输出高电平。
 +
[[File:Trigger and Led-strobe.png|alt=Trigger and Led-strobe|none|thumb|Trigger and Led-strobe]]
 +
 +
note: 仅CS-MIPI-SC132支持。
 +
 +
=====expfrmmode=====
 +
<code>./cs_mipi_i2c.sh -w -f expfrmmode -p1 [value]</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f expfrmmode</code>
 +
{| class="wikitable"
 +
|+expfrmmode
 +
!value
 +
!description
 +
|-
 +
|0
 +
|慢快门模式
 +
|-
 +
|1
 +
|固定帧率模式(默认)
 +
|}
 +
自动曝光模式有效,慢快门模式通常用于低照度场景下进行自动降帧,以减少画面噪声。需要配合'''aetime,slowshuttergain'''参数使用。
 +
 +
===== slowshuttergain =====
 +
<code>./cs_mipi_i2c.sh -w -f slowshuttergain -p1 X -p2 Y</code>
 +
 +
<code>./cs_mipi_i2c.sh -r -f slowshuttergain</code>
 +
 +
慢快门模式下,开始降低帧率的增益阈值,单位dB,需'''expfrmmode'''为慢快门模式下生效。
 +
 +
在慢快门模式下,场景逐渐变暗,AE算法会首先提高曝光时间,达到'''aetime'''上限后,再提高增益,达到'''slowshuttergain'''值后,开始继续提高曝光时间,此时帧率会降低。
 +
 +
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].
 +
 +
===== yuvseq =====
 +
<code>./veye_mipi_i2c.sh -w -f yuvseq -p1 YUYV</code>
 +
 +
<code>./veye_mipi_i2c.sh -w -f yuvseq -p1 UYVY</code>
 +
 +
<code>./veye_mipi_i2c.sh -r -f yuvseq</code>
 +
 +
配置摄像头的yuv顺序。<br />Note: only supported on firmware version >= 2.38.

Latest revision as of 14:17, 7 September 2023

English

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-X!

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

4 不同板子上的i2c序号

请参考下面的文章,确定你所需要使用的-b参数。

i2c bus number on different boards

5 功能列表

5.1 devid

./cs_mipi_i2c.sh -r -f devid

0x02 2 lan mipi
5.2 hdver

./cs_mipi_i2c.sh -r -f hdver

获取逻辑固件版本号

value description
0xXY Version X.Y

for example:

0x22 means V2.2

5.3 firmwarever

./cs_mipi_i2c.sh -r -f firmwarever

获取固件版本号,一般为X.Y格式,如1.0

5.4 productmodel

./cs_mipi_i2c.sh -r -f productmodel

获取产品型号,如:CS-MIPI-IMX307,CS-MIPI-SC132

5.5 camcap

./cs_mipi_i2c.sh -r -f camcap

获取摄像头额外能力集,每一个bit代表一个能力,1有效。

camcap
bit description
0 sync stream mode
1 trigger mode
2 pick mode
5.6 videofmtcap

./cs_mipi_i2c.sh -r -f videofmtcap

获取摄像头支持的视频码流格式,如:

1920*1080@max 30fps

1280*720@max60fps

5.7 videofmt

./cs_mipi_i2c.sh -r -f videofmt

5.7.1 老版本码流格式控制

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

./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@10fps

1280*720@60fps

640*480@130fps

如果摄像机模组支持连续帧率可调功能:

CS-MIPI-IMX307帧率有效范围: [1,maxframerate]

CS-MIPI-SC132帧率有效范围: [2,maxframerate]

注:sync模式不支持连续帧率可调。

5.7.2 新版本码流格式控制

注:CS-MIPI-IMX307 firmware V2.35版本之后支持。

./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p4 0.20

p4参数,支持小数帧率功能,用于支持超过1秒的手动曝光模式。

5.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 手动白平衡配置

bit5 : DME direct manual exposure 直接手动曝光配置

5.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。

5.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

5.11 paramsave

./cs_mipi_i2c.sh -w -f paramsave

将已经配置的参数写入到flash。断电保存。

5.12 sysreset

./cs_mipi_i2c.sh -w -f sysreset

摄像头恢复出厂默认参数。

5.13 streammode
stream mode
value description
0 free running
1 sync mode
2 Hardware Trigger
3 Software Trigger

CS-MIPI-IMX307 support 0,1.

CS-MIPI-SC132 support 0,2,3.

./cs_mipi_i2c.sh -r -f streammode

读取当前的码流模式和主从模式

  • freerunning模式

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

配置摄像头为freerunning模式

  • sync模式

slave mode(sync stream mode)

value description
0 master
1 slave

./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模式详见:摄像头模组码流模式说明

sync模式下,不支持帧率连续可调:

如果powerhz为60,则支持1080p@30,720p@60,vga@130。

如果powerhz为50,则支持1080p@25,720p@50,vga@130。

Note: only supported on camcap bit 0 is 1. Streammode是基础,修改streammode后需要重新配置曝光等参数。

  • Trigger 模式

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

配置摄像头为硬触发模式

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

配置摄像头为软触发模式

5.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
0x3 IR-CUT day, Image Black&White mode
0x4 IR-CUT night, Image Color 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.

  • IR-CUT day, Image black&white mode

Image is Black&White Mode and IR_CUT status Block infrared.

  • IR-CUT night, Image color mode

Image is Color Mode and IR_CUT status Deliver infrared.

5.15 hue

./cs_mipi_i2c.sh -r -f hue

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

hue,range [0,100].

5.16 contrast

./cs_mipi_i2c.sh -r -f contrast

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

contrast,range [0,100].

5.17 satu

./cs_mipi_i2c.sh -r -f satu

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

saturation,range [0,100].

5.18 expmode

./cs_mipi_i2c.sh -r -f expmode

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

0 : 自动曝光

1: 手动曝光

2: 直接手动曝光,跳过isp环节,直接写sensor寄存器。CS-MIPI-SC132有效。此模式配合触发抓拍功能,配置参数的生效时间更快。

5.19 aetarget

./cs_mipi_i2c.sh -r -f aetarget

./cs_mipi_i2c.sh -w -f aetarget -p1 0x40

自动曝光模式下目标亮度,需expmode为自动模式下生效。默认值不同型号会略有不同。

range:[0,255]

5.20 aetime

./cs_mipi_i2c.sh -r -f aetime

./cs_mipi_i2c.sh -w -f aetime -p1 400000

AE最长曝光时间,单位us。需expmode为自动模式下生效。

expfrmmode为固定帧率模式下:range:(100,1/framerate],如帧率为30,则范围是(100,33333].

expfrmmode为慢快门模式下:range:(100,0xFFFFFFFF)

特殊值:0xFFFFFFFF=1/framerate,自动根据camera工作模式调整。

5.21 aeagc

./cs_mipi_i2c.sh -w -f aeagc -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f aeagc

自动曝光模式下,最大系统总增益,单位dB,需expmode为自动模式下生效。

agc组成部分为Again+Dgain+ISPGain。

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,135]dB, step 0.3dB.

5.22 metime

./cs_mipi_i2c.sh -r -f metime

./cs_mipi_i2c.sh -w -f metime -p1 10000

手动曝光时间,需expmode为手动模式下生效, us.

range:[0-1000000/framerate]

如需超长曝光,需要调整framerate以配合此参数的生效。

5.23 meagain

./cs_mipi_i2c.sh -w -f meagain -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f meagain

手动模拟增益,单位dB,需expmode为手动模式下生效。

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,agc range is[0,27]dB, step 0.3dB.

5.24 medgain

./cs_mipi_i2c.sh -w -f medgain -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f medgain

手动数字增益,单位dB,需expmode为手动模式下生效。

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.

5.25 dmetime

./cs_mipi_i2c.sh -r -f dmetime

./cs_mipi_i2c.sh -w -f dmetime -p1 10000

手动曝光时间,需expmode为直接手动模式下生效, us.

range:[0-1000000/framerate]

5.26 dmeagain

./cs_mipi_i2c.sh -w -f dmeagain -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f dmeagain

手动模拟增益,单位dB,需expmode为直接手动模式下生效。

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,agc range is[0,27]dB, step 0.3dB.

5.27 dmedgain

./cs_mipi_i2c.sh -w -f dmedgain -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f dmedgain

手动数字增益,单位dB,需expmode为直接手动模式下生效。

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.

5.28 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

5.29 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 bgain manually, ggain is always 1.

GAIN is 4-bit decimal precision, for example: 0x23 means 2+3/16=2.19.

5.30 mwbcolortemp

./cs_mipi_i2c.sh -w -f mwbcolortemp -p1 3200

./cs_mipi_i2c.sh -r -f mwbcolortemp

手动白平衡,色温模式。 color tempture,range [1500,15000]

5.31 expostate

./cs_mipi_i2c.sh -r -f expostate

readonly, get the current exposure state. exposure time, again and dgain. 直接曝光模式下无效。

5.32 wbstate

./cs_mipi_i2c.sh -r -f wbstate

readonly, get the current white balance state. rgain, bgain and color tempture.

5.33 imagedir

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

./cs_mipi_i2c.sh -r -f imagedir

设置图像的方向

imagedir
value description
0 normal
1 左右翻转
2 上下翻转
3 上下+左右翻转
5.34 sreg

./cs_mipi_i2c.sh -r -f sreg -p1 SensorAddr

对sensor寄存器的间接访问。

例如,对于CS-MIPI-IMX307

./cs_mipi_i2c.sh -r -f sreg -p1 0x300A

r sensor addr 0x300a value 0x3c

5.35 striggerone

./cs_mipi_i2c.sh -w -f striggerone

Software Trigger模式下,通过写寄存器,触发一次曝光和图像。

note: 仅CS-MIPI-SC132支持。

5.36 triggeredge

./cs_mipi_i2c.sh -w -f triggeredge -p1 [value]

./cs_mipi_i2c.sh -r -f triggeredge

Hardware Trigger模式下,触发信号沿属性。

TrigEdge
value description
0 上升沿触发
1 下降沿触发

note: 仅CS-MIPI-SC132支持。

5.37 tgdebncr

./cs_mipi_i2c.sh -w -f tgdebncr -p1 enable -p2 [value]

./cs_mipi_i2c.sh -r -f tgdebncr

Hardware Trigger模式下,触发信号的去毛刺属性。凡小于value(us)的触发信号将被忽略。

note: 仅CS-MIPI-SC132支持。

5.38 tgdly

./cs_mipi_i2c.sh -w -f tgdly -p1 [value]

./cs_mipi_i2c.sh -r -f tgdly

Hardware Trigger模式下,触发延迟,单位为us.

note: 仅CS-MIPI-SC132支持。

5.39 pickmode

./cs_mipi_i2c.sh -w -f pickmode -p1 [0/1]

./cs_mipi_i2c.sh -r -f pickmode

pickmode是一个特殊的功能,一旦开启,sensor正常工作,但是模组将不输出图像,只有收到pickone指令,输出一张。

5.40 pickone

./cs_mipi_i2c.sh -w -f pickone

在使能pickmode情况下,输出一张图像。

5.41 sysreboot

./cs_mipi_i2c.sh -w -f sysreboot -p1 [value]

摄像机模组重启

reboot_type
value description
1 重启程序
2 完全重启(6-8秒)
5.42 ledstrobe

./cs_mipi_i2c.sh -w -f ledstrobe -p1 enable

是否使能灯光同步信号。

如果使能,则在Strobe IO引脚在传感器曝光时输出高电平。

Trigger and Led-strobe
Trigger and Led-strobe

note: 仅CS-MIPI-SC132支持。

5.43 expfrmmode

./cs_mipi_i2c.sh -w -f expfrmmode -p1 [value]

./cs_mipi_i2c.sh -r -f expfrmmode

expfrmmode
value description
0 慢快门模式
1 固定帧率模式(默认)

自动曝光模式有效,慢快门模式通常用于低照度场景下进行自动降帧,以减少画面噪声。需要配合aetime,slowshuttergain参数使用。

5.44 slowshuttergain

./cs_mipi_i2c.sh -w -f slowshuttergain -p1 X -p2 Y

./cs_mipi_i2c.sh -r -f slowshuttergain

慢快门模式下,开始降低帧率的增益阈值,单位dB,需expfrmmode为慢快门模式下生效。

在慢快门模式下,场景逐渐变暗,AE算法会首先提高曝光时间,达到aetime上限后,再提高增益,达到slowshuttergain值后,开始继续提高曝光时间,此时帧率会降低。

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].

5.45 yuvseq

./veye_mipi_i2c.sh -w -f yuvseq -p1 YUYV

./veye_mipi_i2c.sh -w -f yuvseq -p1 UYVY

./veye_mipi_i2c.sh -r -f yuvseq

配置摄像头的yuv顺序。
Note: only supported on firmware version >= 2.38.