Changes

Jump to navigation Jump to search
7,500 bytes added ,  14:17, 7 September 2023
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>./veye_mipi_i2c.sh -r -f daynightmode</code>  
+
<code>./cs_mipi_i2c.sh -r -f daynightmode</code>  
   −
<code>./veye_mipi_i2c.sh -w -f daynightmode -p1 [value]</code>
+
<code>./cs_mipi_i2c.sh -w -f daynightmode -p1 [value]</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
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 expmode -p1 0</code>
 +
 
 +
0 : 自动曝光
 +
 
 +
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.
   −
<code>./cs_mipi_i2c.sh -w -f aemode -p1 0</code>
+
X range: depending on sensor.
   −
0 : auto exposure
+
Y range: [0-9].
   −
1: manual exposure
+
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 357: Line 505:  
<code>./cs_mipi_i2c.sh -r -f mwbcolortemp</code>  
 
<code>./cs_mipi_i2c.sh -r -f mwbcolortemp</code>  
   −
manual  white balance, color temperature mode, color tempture,range [1500,15000]
+
手动白平衡,色温模式。 color tempture,range [1500,15000]
    
=====expostate=====
 
=====expostate=====
 
<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.

Navigation menu