Changes

Jump to navigation Jump to search
6,364 bytes added ,  14:37, 18 August 2023
Line 22: Line 22:  
<code>./camera_i2c_config</code>
 
<code>./camera_i2c_config</code>
   −
*for RPI Computer Module
+
*for RPI Computer Module 3
    
<code>./camera_i2c_config [cameranum]</code>
 
<code>./camera_i2c_config [cameranum]</code>
Line 38: Line 38:  
./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 59: Line 59:     
    -d [i2c addr]                  i2c addr if not default 0x3b
 
    -d [i2c addr]                  i2c addr if not default 0x3b
 +
=== i2c bus number on different board ===
 +
Please refer to the following article to determine which -b parameter you need to use.
   −
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]]
 
+
===Functions list===
 
  −
Pi3B / Pi3B+ / 3A / 4B(1G/2G/4G),we use i2c0
  −
 
  −
Compute Module/ CM3,we use i2c1,please add '''-b 1''' option.
   
=====devid=====
 
=====devid=====
 
<code>./cs_mipi_i2c.sh -r -f devid</code>
 
<code>./cs_mipi_i2c.sh -r -f devid</code>
Line 74: Line 72:  
|}
 
|}
 
=====hdver=====
 
=====hdver=====
<code>./veye_mipi_i2c.sh -r -f hdver</code>
+
<code>./cs_mipi_i2c.sh -r -f hdver</code>
    
get hardware logic version
 
get hardware logic version
Line 95: Line 93:  
<code>./cs_mipi_i2c.sh -r -f productmodel</code>
 
<code>./cs_mipi_i2c.sh -r -f productmodel</code>
   −
get product model,for example:CS-MIPI-IMX307
+
get product model,for example:CS-MIPI-IMX307,CS-MIPI-SC132
 
  −
<br />
   
=====camcap=====
 
=====camcap=====
 
<code>./cs_mipi_i2c.sh -r -f camcap</code>
 
<code>./cs_mipi_i2c.sh -r -f camcap</code>
Line 109: Line 105:  
|0
 
|0
 
|sync stream mode
 
|sync stream mode
 +
|-
 +
|1
 +
|trigger mode
 +
|-
 +
|2
 +
|pick mode
 
|}
 
|}
 
=====videofmtcap=====
 
=====videofmtcap=====
Line 115: Line 117:  
get camera video format capbility, for example:
 
get camera video format capbility, for example:
   −
1920*1080 30fps
+
1920*1080 @max30fps
   −
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>
+
====== old version videofmt write ======
 +
<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 129: Line 132:  
get and set current video format,for example:
 
get and set current video format,for example:
   −
1920*1080@30fps
+
1920*1080@10fps
    
1280*720@60fps  
 
1280*720@60fps  
    
640*480@130fps  
 
640*480@130fps  
 +
 +
If camera support '''framerate continuously adjustable''':
 +
 +
CS-MIPI-IMX307 framerate range: [1,maxframerate]
 +
 +
CS-MIPI-SC132framerate range: [2,maxframerate]
 +
 +
note:sync mode do not support '''framerate continuously adjustable.'''
 +
 +
====== new version videofmt write ======
 +
Note:  supported on CS-MIPI-IMX307 firmware > V2.35.
 +
 +
<code>./cs_mipi_i2c.sh -w -f videofmt -p1 1920 -p2 1080 -p4 0.20</code>
 +
 +
p4 parameter, which supports the decimal frame rate function and is used to support manual exposure mode for more than 1 second.
 
=====ispcap=====
 
=====ispcap=====
 
<code>./cs_mipi_i2c.sh -r -f ispcap</code>
 
<code>./cs_mipi_i2c.sh -r -f ispcap</code>
   −
get camera isp capbility. Will add details later.
+
get camera isp capbility.
 +
 
 +
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
 
=====powerhz=====
 
=====powerhz=====
 
<code>./cs_mipi_i2c.sh -r -f powerhz</code>
 
<code>./cs_mipi_i2c.sh -r -f powerhz</code>
Line 185: Line 215:  
|1
 
|1
 
|sync mode
 
|sync mode
|}
  −
{| class="wikitable"
  −
|+slave mode(sync stream mode)
  −
!value
  −
!description
   
|-
 
|-
|0
+
|2
|master
+
|Hardware Trigger
 
|-
 
|-
|1
+
|3
|slave
+
|Software Trigger
 
|}<code>./cs_mipi_i2c.sh -r -f streammode</code>
 
|}<code>./cs_mipi_i2c.sh -r -f streammode</code>
    
Read the current stream mode and master-slave mode
 
Read the current stream mode and master-slave mode
 +
 +
*free running mode
    
<code>./cs_mipi_i2c.sh -w -f streammode -p1 0</code>
 
<code>./cs_mipi_i2c.sh -w -f streammode -p1 0</code>
Line 204: Line 231:  
Set the current camera to free running mode
 
Set the current camera to free running mode
   −
<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0</code>
+
slave mode(sync stream mode)
 +
{| class="wikitable"
 +
!value
 +
!description
 +
|-
 +
|0
 +
|master
 +
|-
 +
|1
 +
|slave
 +
|}<code>./cs_mipi_i2c.sh -w -f streammode -p1 1 -p2 0</code>
    
Set the current camera to sync mode, and set to master
 
Set the current camera to sync mode, and set to master
Line 214: Line 251:  
sync mode :[[Camera module Stream Mode manual/zh|Camera module Stream Mode manual]]
 
sync mode :[[Camera module Stream Mode manual/zh|Camera module Stream Mode manual]]
   −
Note: only supported on camcap bit 0 is 1.
+
In sync mode,do not support '''framerate continuously adjustable.'''
 +
 
 +
If powerhz is 60,support 1080p@30,720p@60,vga@130.
 +
 
 +
If powerhz is 50,support 1080p@25,720p@50,vga@130.
 +
 
 +
Note: only supported on camcap bit 0 is 1. Streammode is the base, and parameters such as exposure need to be reconfigured after modifying streammode.
 +
 
 +
*Trigger mode
 +
 
 +
<code>./cs_mipi_i2c.sh -w -f streammode -p1 2</code>
 +
 
 +
Set the current camera to hardware trigger mode
 +
 
 +
<code>./cs_mipi_i2c.sh -w -f streammode -p1 3</code>
 +
 
 +
Set the current camera to software trigger mode
 
=====daynightmode=====
 
=====daynightmode=====
 
<code>./cs_mipi_i2c.sh -r -f daynightmode</code>
 
<code>./cs_mipi_i2c.sh -r -f daynightmode</code>
Line 231: Line 284:  
|0x0
 
|0x0
 
|Trigger Mode
 
|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.
+
|-
 +
|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.
 
IR-CUT has two status: '''Block''' or '''Deliver''' the infrared.
Line 237: Line 297:  
*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 250: Line 310:     
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 268: Line 337:     
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 : auto exposure
 
0 : auto exposure
    
1: manual exposure
 
1: manual exposure
 +
 +
2: direct manual exposure,skip isp,write to sensor registers. CS-MIPI-SC132 only.
 
=====aetarget=====
 
=====aetarget=====
 
<code>./cs_mipi_i2c.sh -r -f aetarget</code>
 
<code>./cs_mipi_i2c.sh -r -f aetarget</code>
Line 281: Line 352:  
<code>./cs_mipi_i2c.sh -w -f aetarget -p1 0x40</code>
 
<code>./cs_mipi_i2c.sh -w -f aetarget -p1 0x40</code>
   −
The target brightness in automatic exposure mode. Effective when '''aemode''' is auto.
+
The target brightness in automatic exposure mode. Effective when '''expmode''' is auto.
    
range:[0,255]
 
range:[0,255]
Line 287: Line 358:  
<code>./cs_mipi_i2c.sh -r -f aetime</code>
 
<code>./cs_mipi_i2c.sh -r -f aetime</code>
   −
<code>./cs_mipi_i2c.sh -w -f aetime -p1 0x400000</code>
+
<code>./cs_mipi_i2c.sh -w -f aetime -p1 400000</code>
   −
the max exposure time in  automatic exposure mode,unit: us。Effective when '''aemode''' is auto.
+
the max exposure time in  automatic exposure mode,unit: us。Effective when '''expmode''' is auto.
    
range:(100,1/framerate],if framerate is 30,then the range is (100,33333].
 
range:(100,1/framerate],if framerate is 30,then the range is (100,33333].
Line 299: Line 370:  
<code>./cs_mipi_i2c.sh -r -f aeagc</code>
 
<code>./cs_mipi_i2c.sh -r -f aeagc</code>
   −
Maximum total system gain in automatic exposure mode,unit: dB. Effective when '''aemode''' is auto.
+
Maximum total system gain in automatic exposure mode,unit: dB. Effective when '''expmode''' is auto.
    
agc includes Again+Dgain+ISPGain.
 
agc includes Again+Dgain+ISPGain.
Line 318: Line 389:     
range:[0-1000000/framerate]
 
range:[0-1000000/framerate]
 +
 +
If you need ultra-long exposure, you need to adjust the framerate to match this parameter.
 
=====meagain=====
 
=====meagain=====
 
<code>./cs_mipi_i2c.sh -w -f meagain -p1 X -p2 Y</code>
 
<code>./cs_mipi_i2c.sh -w -f meagain -p1 X -p2 Y</code>
Line 323: Line 396:  
<code>./cs_mipi_i2c.sh -r -f meagain</code>
 
<code>./cs_mipi_i2c.sh -r -f meagain</code>
   −
manual again,dB. Effective when '''aemode''' is manual.
+
manual again,dB. Effective when '''expmode''' is manual.
    
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 337: Line 410:  
<code>./cs_mipi_i2c.sh -r -f medgain</code>
 
<code>./cs_mipi_i2c.sh -r -f medgain</code>
   −
manual dgain,dB. Effective when '''aemode''' is manual.
+
manual dgain,dB. Effective when '''expmode''' is manual.
 +
 
 +
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>
 +
 
 +
direct manual exposure time, us.  Effective when '''expmode''' is direct manual.
 +
 
 +
range:[0-1000000/framerate]
 +
 
 +
If you need ultra-long exposure, you need to adjust the framerate to match this parameter.
 +
=====dmeagain=====
 +
<code>./cs_mipi_i2c.sh -w -f dmeagain -p1 X -p2 Y</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f dmeagain</code>
 +
 
 +
direct manual again,dB. Effective when '''expmode''' is direct manual.
 +
 
 +
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.
 +
=====dmedgain=====
 +
<code>./cs_mipi_i2c.sh -w -f dmedgain -p1 X -p2 Y</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f dmedgain</code>
 +
 
 +
direct manual dgain,dB. Effective when '''expmode''' is direct manual.
    
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 361: Line 472:  
<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 373: Line 484:  
<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. direct manual exposure mode invalid.
 
=====wbstate=====
 
=====wbstate=====
 
<code>./cs_mipi_i2c.sh -r -f wbstate</code>
 
<code>./cs_mipi_i2c.sh -r -f wbstate</code>
Line 379: Line 490:  
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'''=====
+
=====imagedir=====
 
<code>./cs_mipi_i2c.sh -w -f imagedir -p1 0</code>
 
<code>./cs_mipi_i2c.sh -w -f imagedir -p1 0</code>
   Line 402: Line 513:  
|flip+mirror
 
|flip+mirror
 
|}
 
|}
<br />
+
=====sreg=====
 +
<code>./cs_mipi_i2c.sh -r -f sreg -p1 SensorAddr</code>
 +
 
 +
read the sensor register, indirect access.
 +
 
 +
for example: 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>
 +
 
 +
In Software Trigger Mode,Trigger an exposure and image output by writing a register.
 +
 
 +
note: Only CS-MIPI-SC132 support.
 +
 
 +
=====triggeredge=====
 +
<code>./cs_mipi_i2c.sh -w -f triggeredge -p1 [value]</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f triggeredge</code>
 +
 
 +
Edge attribute of trigger signal in Hardware Trigger mode.
 +
{| class="wikitable"
 +
!value
 +
!description
 +
|-
 +
|0
 +
|RisingEdge
 +
|-
 +
|1
 +
|FallingEdge
 +
|}
 +
note: Only CS-MIPI-SC132 Support.
 +
 
 +
=====tgdebncr=====
 +
<code>./cs_mipi_i2c.sh -w -f tgdebncr -p1 enable -p2 [value]</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f tgdebncr</code><br />In Hardware Trigger mode,the debouncer attribute of the trigger signal.
 +
 
 +
Any trigger signal that is less than value (us) will be ignored.
 +
 
 +
note: Only CS-MIPI-SC132 Support.
 +
=====tgdly=====
 +
<code>./cs_mipi_i2c.sh -w -f tgdly -p1 [value]</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f tgdly</code>
 +
 
 +
Trigger delay in Hardware Trigger mode (us).<br />note: Only CS-MIPI-SC132 Support.
 +
=====pickmode=====
 +
<code>./cs_mipi_i2c.sh -w -f pickmode -p1 [0/1]</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f pickmode</code>
 +
 
 +
Pickmode is a special function, once turned on, sensor works normally, but the module will not output images, only receive '''pickone''' instructions, output one.
 +
 
 +
=====pickone=====
 +
<code>./cs_mipi_i2c.sh -w -f pickone</code>
 +
 
 +
When pickmode is enable, output one image.
 +
 
 +
=====sysreboot=====
 +
<code>./cs_mipi_i2c.sh -w -f sysreboot -p1 [value]</code>
 +
 
 +
reboot the camera module
 +
{| class="wikitable"
 +
|+reboot_type
 +
!value
 +
!description
 +
|-
 +
|1
 +
|Restart the main program
 +
|-
 +
|2
 +
|Fully reboot (6-8s)
 +
|}
 +
 
 +
=====ledstrobe=====
 +
<code>./cs_mipi_i2c.sh -w -f ledstrobe -p1 enable</code>
 +
 
 +
Whether the LED synchronization signal is enabled.
 +
 
 +
If enabled, the Strobe IO pin outputs a high level when the sensor is exposed.
 +
[[File:Trigger and Led-strobe.png|alt=Trigger and Led-strobe|none|thumb|Trigger and Led-strobe]]
 +
 
 +
note: Only CS-MIPI-SC132 Support.
 +
 
 +
===== 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
 +
|slow shutter mode
 +
|-
 +
|1
 +
|fix framerate mode(default)
 +
|}
 +
Effective in auto exposure mode.
 +
 
 +
The slow shutter mode is usually used  to reduce picture noise  in low-illumination scenes by automatic frame reduction.
 +
 
 +
It needs to be used with the '''aetime,slowshuttergain''' parameter.
 +
 
 +
Note: only supported on firmware version >= 2.32
 +
=====slowshuttergain=====
 +
<code>./cs_mipi_i2c.sh -w -f slowshuttergain -p1 X -p2 Y</code>
 +
 
 +
<code>./cs_mipi_i2c.sh -r -f slowshuttergain</code>
 +
 
 +
In slow shutter mode,the threshold of Gain be begin to drop frame, dB. Effective when '''expfrmmode''' is slow shutter mode.
 +
 
 +
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].
 +
 
 +
Note: only supported on firmware version >= 2.32
 +
 
 +
===== 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>
 +
 
 +
Set yuv seq of camera.
 +
 
 +
Note: only supported on firmware version >= 2.38<br />

Navigation menu