Difference between revisions of "Mv mipi i2c.sh user guide"

From wiki_veye
Jump to navigation Jump to search
 
(33 intermediate revisions by 4 users not shown)
Line 4: Line 4:
 
The mv_mipi_i2c.sh script is a tool set for configuring MV MIPI  series cameras through the I2C.
 
The mv_mipi_i2c.sh script is a tool set for configuring MV MIPI  series cameras through the I2C.
  
This script is essentially an access to registers. For registers, please refer to [[MV Series MIPI Camera Register Map]].
+
This script is essentially an access to registers. For registers, please refer to [[MV Series MIPI Camera Register Map|MV Series and RAW Series MIPI Camera Register Map]].
 +
 
 +
=== Raspberry Pi on Legacy mode Only, Set IO config ===
 +
Note that if you are using v4l2 mode, you do not need to perform this step.
  
=== Raspberry Pi Only, Set IO config ===
 
 
Running
 
Running
  
Line 14: Line 16:
  
 
first,it will config IO pin. Then you can run mv_mipi_i2c.sh.
 
first,it will config IO pin. Then you can run mv_mipi_i2c.sh.
 +
 +
=== Download ===
 +
We provide download links for mv_mipi_i2c.sh for different embedded platforms.
 +
 +
Generally, these links can be found in the respective platform's GitHub repository.
 +
 +
Below is the list:
 +
 +
==== Nvidia Jetson: ====
 +
https://github.com/veyeimaging/nvidia_jetson_veye_bsp/tree/master/mv_tools_jetson/i2c_tools
 +
 +
==== Raspberry Pi: ====
 +
https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/mv_tools_rpi
 +
 +
==== RK35xx: ====
 +
https://github.com/veyeimaging/rk35xx_firefly/tree/main/mv_tools_rockchip/i2c_tools
  
 
=== Prepare ===
 
=== Prepare ===
Line 19: Line 37:
  
 
<code>./make.sh</code>
 
<code>./make.sh</code>
 +
 +
<code>cd ..</code>
 +
 +
<code>chmod +x *</code>
  
 
=== mv_mipi_i2c.sh USAGE ===
 
=== mv_mipi_i2c.sh USAGE ===
./mv_mipi_i2c.sh
+
<code>./mv_mipi_i2c.sh</code>
 +
 
 +
<code>Usage:  ./mv_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -b bus</code>
 +
 
 +
<code>options:</code>
 +
 
 +
<code>    -r                       read</code>
 +
 
 +
<code>    -w                       write</code>
 +
 
 +
<code>    -f [function name]       function name</code>
 +
 
 +
<code>    -p1 [param1]                           param1 of each function</code>
 +
 
 +
<code>    -p2 [param1]                           param2 of each function</code>
 +
 
 +
<code>    -p3 [param3]                           param3 of each function</code>
 +
 
 +
<code>    -p4 [param4]                           param4 of each function</code>
 +
 
 +
<code>    -b [i2c bus num]               i2c bus number</code>
 +
 
 +
<code>    -d [i2c addr]                  i2c addr if not default 0x3b</code>
 +
 
 +
<code>Please open this srcipt and read the COMMENT on top for support functions and samples.</code>
 +
 
 +
=== mv_mipi_i2c_new.sh USAGE ===
 +
This script is a simplified version of mv_mipi_i2c.sh, in which -f -p1 -p2 -p3 -p4 is no longer needed.
 +
 
 +
<code>$ ./mv_mipi_i2c_new.sh</code>
  
Usage:  ./mv_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -b bus
+
<code>Usage:  ./mv_mipi_i2c.sh [-r/w]  [function name] [param1] [param2 ] [param3] [param4] -b bus</code>
  
options:
+
<code>options:</code>
  
    -r                       read  
+
<code>    -r                       read</code>
  
    -w                       write
+
<code>    -w                       write</code>
  
    -f [function name]       function name
+
<code>    [function name]       function name</code>
  
    -p1 [param1]                           param1 of each function
+
<code>    [param1]                        param1 of each function</code>
  
    -p2 [param1]                           param2 of each function
+
<code>    [param1]                        param2 of each function</code>
  
    -p3 [param3]                           param3 of each function
+
<code>    [param3]                        param3 of each function</code>
  
    -p4 [param4]                           param4 of each function
+
<code>    [param4]                        param4 of each function</code>
  
    -b [i2c bus num]               i2c bus number
+
<code>    -b [i2c bus num]               i2c bus number</code>
  
    -d [i2c addr]                  i2c addr if not default 0x3b
+
<code>    -d [i2c addr]                  i2c addr if not default 0x3b</code>
  
Please open this srcipt and read the COMMENT on top for support functions and samples.
+
<code>Please open this srcipt and read the COMMENT on top for support functions and samples</code>
  
 
===i2c bus number on different board===
 
===i2c bus number on different board===
Line 63: Line 114:
  
 
===== manufacturer =====
 
===== manufacturer =====
<code>./mv_mipi_i2c.sh -r -f manufacturer</code>
+
<code>./mv_mipi_i2c.sh -r -f manufacturer -b your_i2c_bus_number</code>
  
 
Get the manufacturer name, which is  '''VEYE'''.
 
Get the manufacturer name, which is  '''VEYE'''.
  
 
===== model =====
 
===== model =====
<code>./mv_mipi_i2c.sh -r -f model</code>
+
<code>./mv_mipi_i2c.sh -r -f model -b your_i2c_bus_number</code>
  
Get the product model, such as MV-MIPI-IMX178M.
+
Get the product model, such as '''MV-MIPI-IMX178M''' /  '''MV-MIPI-SC132M'''.
  
 
===== version =====
 
===== version =====
<code>./mv_mipi_i2c.sh -r -f version</code>
+
<code>./mv_mipi_i2c.sh -r -f version -b your_i2c_bus_number</code>
  
 
Get the Controller version number and Logical version number.  
 
Get the Controller version number and Logical version number.  
Line 80: Line 131:
  
 
===== serialno =====
 
===== serialno =====
<code>./mv_mipi_i2c.sh -r -f serialno</code>
+
<code>./mv_mipi_i2c.sh -r -f serialno -b your_i2c_bus_number</code>
  
 
Get the unique serial number of this module.
 
Get the unique serial number of this module.
  
 
===== timestamp =====
 
===== timestamp =====
<code>./mv_mipi_i2c.sh -r -f timestamp</code>
+
<code>./mv_mipi_i2c.sh -r -f timestamp -b your_i2c_bus_number</code>
  
 
Time after system startup in Milliseconds.  
 
Time after system startup in Milliseconds.  
Line 92: Line 143:
  
 
===== errcode =====
 
===== errcode =====
<code>./mv_mipi_i2c.sh -r -f errcode</code>
+
<code>./mv_mipi_i2c.sh -r -f errcode -b your_i2c_bus_number</code>
  
 
System error code, each bit represents an error type.
 
System error code, each bit represents an error type.
Line 107: Line 158:
  
 
===== fmtcap =====
 
===== fmtcap =====
<code>./mv_mipi_i2c.sh -r -f fmtcap</code>
+
<code>./mv_mipi_i2c.sh -r -f fmtcap -b your_i2c_bus_number</code>
  
 
Capbility of data formats supported by the camera.
 
Capbility of data formats supported by the camera.
Line 120: Line 171:
  
 
bit4: UYVY
 
bit4: UYVY
 +
 +
===== trgmodecap =====
 +
<code>./mv_mipi_i2c.sh -r -f trgmodecap -b your_i2c_bus_number</code>
 +
 +
Capbility of trigger mode supported by the camera.
 +
 +
bit0:Video streaming mode.
 +
 +
bit1:Normal trigger mode.
 +
 +
bit2:Rolling shutter multi-frame trigger mode.
 +
 +
bit3: Pulse trigger mode.
  
 
===== factoryparam =====
 
===== factoryparam =====
<code>./mv_mipi_i2c.sh -w -f factoryparam</code>
+
<code>./mv_mipi_i2c.sh -w -f factoryparam -b your_i2c_bus_number</code>
  
 
All parameters restored to factory default values.
 
All parameters restored to factory default values.
  
 
===== paramsave =====
 
===== paramsave =====
<code>./mv_mipi_i2c.sh -w -f paramsave</code>
+
<code>./mv_mipi_i2c.sh -w -f paramsave -b your_i2c_bus_number</code>
  
 
Save all parameters to flash, and they will not be lost when power off.
 
Save all parameters to flash, and they will not be lost when power off.
  
 
===== reboot =====
 
===== reboot =====
<code>./mv_mipi_i2c.sh -w -f reboot</code>
+
<code>./mv_mipi_i2c.sh -w -f reboot -b your_i2c_bus_number</code>
  
 
Reboot the camera.
 
Reboot the camera.
  
 
===== i2caddr =====
 
===== i2caddr =====
<code>./mv_mipi_i2c.sh -w -f i2caddr -p1 [new]</code>
+
<code>./mv_mipi_i2c.sh -w -f i2caddr -p1 [new] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f i2caddr</code> <br />This module support i2c address changed by software, i2c address range[0x3,0x77].  
+
<code>./mv_mipi_i2c.sh -r -f i2caddr -b your_i2c_bus_number</code> <br />This module support i2c address changed by software, i2c address range[0x3,0x77].  
  
 
Will really take effect only after paramsave and reboot .
 
Will really take effect only after paramsave and reboot .
 +
 +
===== slavemode =====
 +
<code>./mv_mipi_i2c.sh -w -f slavemode -p1 [0/1] -b your_i2c_bus_number</code>
 +
 +
<code>./mv_mipi_i2c.sh -r -f slavemode -b your_i2c_bus_number</code>
 +
 +
Whether the sensor is operating in slave mode. In slave mode, the camera relies on external signals to provide XVS and XHS. 
 +
 +
Writing this parameter will cause the camera to automatically save the current settings and reboot.
 +
 +
Currently, only RAW-MIPI-IMX462M support this function.
 +
 +
===== mcubypass =====
 +
<code>./mv_mipi_i2c.sh -w -f mcubypass -p1 [0/1] -b your_i2c_bus_number</code>
 +
 +
<code>./mv_mipi_i2c.sh -r -f mcubypass -b your_i2c_bus_number</code>
 +
 +
For Raw series camera,set SDA(Sensor Direct Access) mode.
  
 
==== Image Acquisition ====
 
==== Image Acquisition ====
  
 
===== imgacq =====
 
===== imgacq =====
<code>./mv_mipi_i2c.sh -w -f imgacq -p1 [0/1]</code>
+
<code>./mv_mipi_i2c.sh -w -f imgacq -p1 [0/1] -b your_i2c_bus_number</code>
  
 
Start/Stop acquisition
 
Start/Stop acquisition
Line 157: Line 239:
  
 
===== trgmode* =====
 
===== trgmode* =====
<code>./mv_mipi_i2c.sh -w -f trgmode -p1 [0,2]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgmode -p1 [0,2] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f trgmode</code>
+
<code>./mv_mipi_i2c.sh -r -f trgmode -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 168: Line 250:
 
|-
 
|-
 
|1
 
|1
|Normal trigger mode.
+
|Normal trigger mode
 
|-
 
|-
 
|2
 
|2
|High-speed continuous trigger mode.
+
|Rolling shutter multi-frame trigger mode
 +
|-
 +
|3
 +
|Pulse trigger mode
 
|}
 
|}
 
See product manual for details.
 
See product manual for details.
  
 
===== trgsrc* =====
 
===== trgsrc* =====
<code>./mv_mipi_i2c.sh -w -f trgsrc -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgsrc -p1 [0,1] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f trgsrc</code>
+
<code>./mv_mipi_i2c.sh -r -f trgsrc -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 191: Line 276:
  
 
===== trgnum* =====
 
===== trgnum* =====
<code>./mv_mipi_i2c.sh -w -f trgnum -p1 [1,255]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgnum -p1 [1,255] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f trgnum</code>
+
<code>./mv_mipi_i2c.sh -r -f trgnum -b your_i2c_bus_number</code>
  
 
The number of image frames output by one trigger signal in trigger mode.  
 
The number of image frames output by one trigger signal in trigger mode.  
  
 
===== trginterval* =====
 
===== trginterval* =====
<code>./mv_mipi_i2c.sh -w -f trginterval -p1 [us]</code>
+
<code>./mv_mipi_i2c.sh -w -f trginterval -p1 [us] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f trginterval</code>
+
<code>./mv_mipi_i2c.sh -r -f trginterval -b your_i2c_bus_number</code>
  
 
Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF].
 
Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF].
  
 
===== trgone =====
 
===== trgone =====
<code>./mv_mipi_i2c.sh -w -f trgone</code>
+
<code>./mv_mipi_i2c.sh -w -f trgone -b your_i2c_bus_number</code>
  
 
Software trigger command.One execution will perform a soft trigger.
 
Software trigger command.One execution will perform a soft trigger.
  
 
===== trgcount =====
 
===== trgcount =====
<code>./mv_mipi_i2c.sh -r -f trgcount</code>
+
<code>./mv_mipi_i2c.sh -r -f trgcount -b your_i2c_bus_number</code>
  
 
Trigger count statistics.
 
Trigger count statistics.
Line 216: Line 301:
 
Get the total number of triggers and the number of trigger loss.
 
Get the total number of triggers and the number of trigger loss.
  
<code>./mv_mipi_i2c.sh -w -f trgcountclr</code>
+
<code>./mv_mipi_i2c.sh -w -f trgcountclr -b your_i2c_bus_number</code>
  
 
Clear trigger count.
 
Clear trigger count.
 +
 +
===== framecount =====
 +
<code>./mv_mipi_i2c.sh -r -f framecount -b your_i2c_bus_number</code>
 +
 +
Frame count statistics.
 +
 +
The number of frames output by the sensor and the number of frames output by the camera module. Cyclic counting.
  
 
==== IO Control ====
 
==== IO Control ====
 +
For RAW series cameras, the input IO supports trigger edge and trigger delay, and does not support trigger filtering function. The output IO is the strobe out pin of the sensor that leads directly.
  
 
===== trgdelay* =====
 
===== trgdelay* =====
<code>./mv_mipi_i2c.sh -r -f trgdelay</code>
+
<code>./mv_mipi_i2c.sh -r -f trgdelay -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f trgdelay -p1 [us]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgdelay -p1 [us] -b your_i2c_bus_number</code>
  
 
Trigger delay, effective under both soft trigger and hard trigger mode.
 
Trigger delay, effective under both soft trigger and hard trigger mode.
Line 232: Line 325:
  
 
===== trgedge* =====
 
===== trgedge* =====
<code>./mv_mipi_i2c.sh -r -f trgedge</code>
+
<code>./mv_mipi_i2c.sh -r -f trgedge -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f trgedge -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgedge -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Effective trigger edge in hard trigger mode.
 
Effective trigger edge in hard trigger mode.
Line 249: Line 342:
  
 
===== trgfilter_enable* =====
 
===== trgfilter_enable* =====
<code>./mv_mipi_i2c.sh -r -f trgfilter_enable</code>
+
<code>./mv_mipi_i2c.sh -r -f trgfilter_enable -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f trgfilter_enable -p1 [0,2]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgfilter_enable -p1 [0,2] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 270: Line 363:
  
 
===== trgfilter_time* =====
 
===== trgfilter_time* =====
<code>./mv_mipi_i2c.sh -r -f trgfilter_time</code>
+
<code>./mv_mipi_i2c.sh -r -f trgfilter_time -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f trgfilter_time -p1 [us]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgfilter_time -p1 [us] -b your_i2c_bus_number</code>
  
 
Trigger signal filtering window width.
 
Trigger signal filtering window width.
Line 279: Line 372:
  
 
===== trgexp_delay* =====
 
===== trgexp_delay* =====
<code>./mv_mipi_i2c.sh -r -f trgexp_delay</code>
+
<code>./mv_mipi_i2c.sh -r -f trgexp_delay -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f trgexp_delay -p1 [us]</code>
+
<code>./mv_mipi_i2c.sh -w -f trgexp_delay -p1 [us] -b your_i2c_bus_number</code>
  
 
Exposure delay, i.e. the time to turn on the Strobe signal in advance.
 
Exposure delay, i.e. the time to turn on the Strobe signal in advance.
Line 290: Line 383:
  
 
===== gpios_status =====
 
===== gpios_status =====
<code>./mv_mipi_i2c.sh -r -f gpios_status</code>
+
<code>./mv_mipi_i2c.sh -r -f gpios_status -b your_i2c_bus_number</code>
  
 
Get TriggerIN_IO, OUT_IO1 and OUT_IO2 status.
 
Get TriggerIN_IO, OUT_IO1 and OUT_IO2 status.
  
 
===== outio1_mode =====
 
===== outio1_mode =====
<code>./mv_mipi_i2c.sh -r -f outio1_mode</code>
+
<code>./mv_mipi_i2c.sh -r -f outio1_mode -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio1_mode -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio1_mode -p1 [0,1] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 313: Line 406:
  
 
===== outio1_usr =====
 
===== outio1_usr =====
<code>./mv_mipi_i2c.sh -r -f outio1_usr</code>
+
<code>./mv_mipi_i2c.sh -r -f outio1_usr -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio1_usr -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio1_usr -p1 [0,1] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 328: Line 421:
  
 
===== outio1_rvs =====
 
===== outio1_rvs =====
<code>./mv_mipi_i2c.sh -r -f outio1_rvs</code>
+
<code>./mv_mipi_i2c.sh -r -f outio1_rvs -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio1_rvs -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio1_rvs -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Reverse OUT_IO1 high and low levels if set to 1.
 
Reverse OUT_IO1 high and low levels if set to 1.
  
 
===== outio2_mode =====
 
===== outio2_mode =====
<code>./mv_mipi_i2c.sh -r -f outio2_mode</code>
+
<code>./mv_mipi_i2c.sh -r -f outio2_mode -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio2_mode -p1 [0,4]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio2_mode -p1 [0,5] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 356: Line 449:
 
|4
 
|4
 
|XHS
 
|XHS
 +
|-
 +
|5
 +
|Effective trigger signal (Sony's global shutter sensor only)
 
|}
 
|}
 
strobe: High level active.
 
strobe: High level active.
Line 366: Line 462:
  
 
===== outio2_usr =====
 
===== outio2_usr =====
<code>./mv_mipi_i2c.sh -r -f outio2_usr</code>
+
<code>./mv_mipi_i2c.sh -r -f outio2_usr -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio2_usr -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio2_usr -p1 [0,1] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 381: Line 477:
  
 
===== outio2_rvs =====
 
===== outio2_rvs =====
<code>./mv_mipi_i2c.sh -r -f outio2_rvs</code>
+
<code>./mv_mipi_i2c.sh -r -f outio2_rvs -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f outio2_rvs -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f outio2_rvs -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Reverse OUT_IO1 high and low levels if set to 1.
 
Reverse OUT_IO1 high and low levels if set to 1.
Line 390: Line 486:
  
 
===== maxwh =====
 
===== maxwh =====
<code>./mv_mipi_i2c.sh -r -f maxwh</code>
+
<code>./mv_mipi_i2c.sh -r -f maxwh -b your_i2c_bus_number</code>
  
 
Get the maximum supported resolution of the sensor.
 
Get the maximum supported resolution of the sensor.
  
 
===== maxfps =====
 
===== maxfps =====
<code>./mv_mipi_i2c.sh -r -f maxfps</code>
+
<code>./mv_mipi_i2c.sh -r -f maxfps -b your_i2c_bus_number</code>
  
 
The maximum frame rate supported in the current mode.
 
The maximum frame rate supported in the current mode.
Line 402: Line 498:
  
 
===== fps* =====
 
===== fps* =====
<code>./mv_mipi_i2c.sh -w -f fps -p1 [framerate]</code>
+
<code>./mv_mipi_i2c.sh -w -f fps -p1 [framerate] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f fps</code>
+
<code>./mv_mipi_i2c.sh -r -f fps -b your_i2c_bus_number</code>
  
 
Configure the actual frame rate of the camera in the current mode.   
 
Configure the actual frame rate of the camera in the current mode.   
Line 411: Line 507:
  
 
In video streaming mode, this parameter determines the actual frame rate.
 
In video streaming mode, this parameter determines the actual frame rate.
 +
 +
In normal trigger mode, it is recommended to set the '''fps''' to the '''maxfps''' value to ensure the highest trigger signal responsiveness.
  
 
===== roi* =====
 
===== roi* =====
<code>./mv_mipi_i2c.sh -w -f roi -p1 [x] -p2 [y] -p3 [width] -p4 [height]</code>
+
<code>./mv_mipi_i2c.sh -w -f roi -p1 [x] -p2 [y] -p3 [width] -p4 [height] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f roi</code>
+
<code>./mv_mipi_i2c.sh -r -f roi -b your_i2c_bus_number</code>
  
 
ROI(region of interest) is the sensor output area, and the default is full screen output.  
 
ROI(region of interest) is the sensor output area, and the default is full screen output.  
Line 434: Line 532:
  
 
===== imgdir =====
 
===== imgdir =====
<code>./mv_mipi_i2c.sh -w -f imgdir -p1 [0,3]</code>
+
<code>./mv_mipi_i2c.sh -w -f imgdir -p1 [0,3] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f imgdir</code>
+
<code>./mv_mipi_i2c.sh -r -f imgdir -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 456: Line 554:
  
 
===== pixelformat =====
 
===== pixelformat =====
<code>./mv_mipi_i2c.sh -w -f pixelformat -p1 [0,2]</code>
+
<code>./mv_mipi_i2c.sh -w -f pixelformat -p1 [0,2] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f pixelformat</code>
+
<code>./mv_mipi_i2c.sh -r -f pixelformat -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 478: Line 576:
  
 
===== blacklevel =====
 
===== blacklevel =====
<code>./mv_mipi_i2c.sh -w -f blacklevel -p1 [blacklevel]</code>
+
<code>./mv_mipi_i2c.sh -w -f blacklevel -p1 [blacklevel] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f blacklevel</code>
+
<code>./mv_mipi_i2c.sh -r -f blacklevel -b your_i2c_bus_number</code>
  
 
This black level value will be set directly to the sensor.
 
This black level value will be set directly to the sensor.
 +
 +
===== blcmode =====
 +
<code>./mv_mipi_i2c.sh -w -f blcmode -p1 [0/1] -b your_i2c_bus_number</code>
 +
 +
<code>./mv_mipi_i2c.sh -r -f blcmode -b your_i2c_bus_number</code>
 +
 +
Black level calibration modes:
 +
 +
0: Sensor automatic calibration or use default black level.
 +
 +
1: Manually specify black level.
  
 
===== testimg =====
 
===== testimg =====
<code>./mv_mipi_i2c.sh -w -f testimg -p1 [0,2]</code>
+
<code>./mv_mipi_i2c.sh -w -f testimg -p1 [0,2] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f testimg</code>
+
<code>./mv_mipi_i2c.sh -r -f testimg -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 501: Line 610:
 
|Test image 2
 
|Test image 2
 
|}
 
|}
 +
 +
===== lanenum* =====
 +
<code>./mv_mipi_i2c.sh -w -f lanenum -p1 [2/4] -b your_i2c_bus_number</code>
 +
 +
<code>./mv_mipi_i2c.sh -r -f lanenum -b your_i2c_bus_number</code><br />For modules that support lane number configuration, use this register to modify the lane number.
 +
 +
===== mipidatarate =====
 +
<code>./mv_mipi_i2c.sh -r -f mipidatarate -b your_i2c_bus_number</code>
 +
 +
he MIPI datarate for each lane, measured in Kbps.
  
 
==== ISP ====
 
==== ISP ====
 +
 +
===== Special Note =====
 +
Generally, only manual exposure and manual gain are supported by RAW series cameras in this section. However, RAW-MIPI-AR0234M does support AEC control.
 +
 +
Commands supported by RAW-MIPI-AR0234M include:
 +
 +
expmode,metime,gainmode,mgain,aatarget,aemaxtime,exptime,curgain,aaroi,aaroienable.
  
 
===== gamma =====
 
===== gamma =====
<code>./mv_mipi_i2c.sh -r -f gamma</code>
+
<code>./mv_mipi_i2c.sh -r -f gamma -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f gamma -p1 [gamma]</code>
+
<code>./mv_mipi_i2c.sh -w -f gamma -p1 [gamma] -b your_i2c_bus_number</code>
  
 
Range (0,4.0],accurate is 0.01.
 
Range (0,4.0],accurate is 0.01.
Line 514: Line 640:
  
 
===== gammaenable =====
 
===== gammaenable =====
<code>./mv_mipi_i2c.sh -r -f gammaenable</code>
+
<code>./mv_mipi_i2c.sh -r -f gammaenable -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f gammaenable -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f gammaenable -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Enable/Disable gamma function.
 
Enable/Disable gamma function.
  
 
===== dpcenable =====
 
===== dpcenable =====
<code>./mv_mipi_i2c.sh -r -f dpcenable</code>
+
<code>./mv_mipi_i2c.sh -r -f dpcenable -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f dpcenable -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f dpcenable -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Enable/Disable DPC(Defect Point Correction) function.
 
Enable/Disable DPC(Defect Point Correction) function.
  
 
===== lutenable =====
 
===== lutenable =====
<code>./mv_mipi_i2c.sh -r -f lutenable</code>
+
<code>./mv_mipi_i2c.sh -r -f lutenable -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f lutenable -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f lutenable -p1 [0,1] -b your_i2c_bus_number</code>
  
 
Enable/Disable LUT(Look-Up-Table) function.
 
Enable/Disable LUT(Look-Up-Table) function.
  
 
===== lut =====
 
===== lut =====
<code>./mv_mipi_i2c.sh -r -f lut -p1 [lutfilename]</code>
+
<code>./mv_mipi_i2c.sh -r -f lut -p1 [lutfilename] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f lut -p1 [lutfilename]</code>
+
<code>./mv_mipi_i2c.sh -w -f lut -p1 [lutfilename] -b your_i2c_bus_number</code>
  
 
Import or export a lut curve to a file, refer to the provided lut_linear.txt for the file format.
 
Import or export a lut curve to a file, refer to the provided lut_linear.txt for the file format.
  
 
===== expmode =====
 
===== expmode =====
<code>./mv_mipi_i2c.sh -r -f expmode</code>
+
<code>./mv_mipi_i2c.sh -r -f expmode -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f expmode -p1 [0,2]</code>
+
<code>./mv_mipi_i2c.sh -w -f expmode -p1 [0,2] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 561: Line 687:
  
 
AE once: Execute automatic exposure in the set range once, then stop the adjustment.
 
AE once: Execute automatic exposure in the set range once, then stop the adjustment.
 +
 +
RAW-MIPI-AR0234M do not support AE once mode.
  
 
===== metime =====
 
===== metime =====
<code>./mv_mipi_i2c.sh -w -f metime -p1 [us]</code>
+
<code>./mv_mipi_i2c.sh -w -f metime -p1 [us] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f metime</code>
+
<code>./mv_mipi_i2c.sh -r -f metime -b your_i2c_bus_number</code>
  
 
Range (0,1000000/fps].Because of <u>Note1</u> and range limitation, please read back to confirm the real metime take effect.
 
Range (0,1000000/fps].Because of <u>Note1</u> and range limitation, please read back to confirm the real metime take effect.
  
 
===== gainmode =====
 
===== gainmode =====
<code>./mv_mipi_i2c.sh -r -f gainmode</code>
+
<code>./mv_mipi_i2c.sh -r -f gainmode -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f gainmode -p1 [0,3]</code>
+
<code>./mv_mipi_i2c.sh -w -f gainmode -p1 [0,3] -b your_i2c_bus_number</code>
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 589: Line 717:
  
 
AG once: Execute automatic gain in the set range once, then stop the adjustment.
 
AG once: Execute automatic gain in the set range once, then stop the adjustment.
 +
 +
RAW-MIPI-AR0234M do not support AG once mode.
 +
 +
RAW-MIPI-AR0234M can not enable AG in ME mode.
  
 
===== mgain =====
 
===== mgain =====
<code>./mv_mipi_i2c.sh -w -f mgain -p1 [gain]</code>
+
<code>./mv_mipi_i2c.sh -w -f mgain -p1 [gain] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f mgain</code>
+
<code>./mv_mipi_i2c.sh -r -f mgain -b your_i2c_bus_number</code>
  
 
Range [0,MAX_Gain],MAX_Gain varies from sensor to sensor, for example, IMX178 is 48dB.
 
Range [0,MAX_Gain],MAX_Gain varies from sensor to sensor, for example, IMX178 is 48dB.
Line 600: Line 732:
  
 
===== aatarget =====
 
===== aatarget =====
<code>./mv_mipi_i2c.sh -r -f aatarget</code>
+
<code>./mv_mipi_i2c.sh -r -f aatarget -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f aatarget -p1 [1,255]</code>
+
<code>./mv_mipi_i2c.sh -w -f aatarget -p1 [1,255] -b your_i2c_bus_number</code>
  
 
The target brightness of AE and AG algorithm.
 
The target brightness of AE and AG algorithm.
Line 611: Line 743:
  
 
===== aemaxtime =====
 
===== aemaxtime =====
<code>./mv_mipi_i2c.sh -r -f aemaxtime</code>
+
<code>./mv_mipi_i2c.sh -r -f aemaxtime -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f aemaxtime -p1 [16,1000000/fps]</code>
+
<code>./mv_mipi_i2c.sh -w -f aemaxtime -p1 [16,1000000/fps] -b your_i2c_bus_number</code>
  
 
Maximum exposure time in AE mode.Range[16,1000000]. <u>Note1.</u>
 
Maximum exposure time in AE mode.Range[16,1000000]. <u>Note1.</u>
  
Please read back to confirm the real metime take effect.
+
Please read back to confirm the real aemaxtime take effect.
  
 
===== agmaxgain =====
 
===== agmaxgain =====
<code>./mv_mipi_i2c.sh -r -f agmaxgain</code>
+
<code>./mv_mipi_i2c.sh -r -f agmaxgain -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -w -f agmaxgain -p1 [0,maxgain]</code>
+
<code>./mv_mipi_i2c.sh -w -f agmaxgain -p1 [0,maxgain] -b your_i2c_bus_number</code>
  
 
Maximum value of auto gain. The range and step vary according to the model.
 
Maximum value of auto gain. The range and step vary according to the model.
  
 
Most sensors have a gain step of 0.1dB, some are 0.3dB.
 
Most sensors have a gain step of 0.1dB, some are 0.3dB.
 +
 +
Note:For RAW-MIPI-AR0234M, agmaxgain cannot be configured and remains fixed at 24dB.
  
 
===== exptime =====
 
===== exptime =====
<code>./mv_mipi_i2c.sh -r -f exptime</code>
+
<code>./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number</code>
  
 
Get the current exposure time. This command is valid in any exposure mode.
 
Get the current exposure time. This command is valid in any exposure mode.
  
 
===== curgain =====
 
===== curgain =====
<code>./mv_mipi_i2c.sh -r -f curgain</code>
+
<code>./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number</code>
  
 
Gets the current gain. This command is valid in any exposure mode.
 
Gets the current gain. This command is valid in any exposure mode.
  
 
===== aaroienable =====
 
===== aaroienable =====
<code>./mv_mipi_i2c.sh -w -f aaroienable -p1 [0,1]</code>
+
<code>./mv_mipi_i2c.sh -w -f aaroienable -p1 [0,1] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f aaroienable</code>
+
<code>./mv_mipi_i2c.sh -r -f aaroienable -b your_i2c_bus_number</code>
  
 
Whether to enable AAROI statistics function, not enable means full ROI statistics.
 
Whether to enable AAROI statistics function, not enable means full ROI statistics.
  
 
===== aaroi =====
 
===== aaroi =====
<code>./mv_mipi_i2c.sh -w -f aaroi -p1 [x] -p2 [y] -p3 [width] -p4 [height]</code>
+
<code>./mv_mipi_i2c.sh -w -f aaroi -p1 [x] -p2 [y] -p3 [width] -p4 [height] -b your_i2c_bus_number</code>
  
<code>./mv_mipi_i2c.sh -r -f aaroi</code>
+
<code>./mv_mipi_i2c.sh -r -f aaroi -b your_i2c_bus_number</code>
  
 
The AAROI coordinates are relative coordinates within the ROI area. So the area must be smaller than the image ROI.
 
The AAROI coordinates are relative coordinates within the ROI area. So the area must be smaller than the image ROI.
  
 
===== aeag_run_once_save =====
 
===== aeag_run_once_save =====
<code>./mv_mipi_i2c.sh -w -f aeag_run_once_save</code>
+
<code>./mv_mipi_i2c.sh -w -f aeag_run_once_save -b your_i2c_bus_number</code>
  
 
Execute AE&AG once operation and save the results to the camera as manual values!<br />This is a function that is useful when the camera is installed.
 
Execute AE&AG once operation and save the results to the camera as manual values!<br />This is a function that is useful when the camera is installed.
 +
 +
Please make sure that the image preview has already been started before executing this command.
  
 
It performs the following operations:
 
It performs the following operations:
Line 667: Line 803:
  
 
===== snsreg =====
 
===== snsreg =====
<code>./mv_mipi_i2c.sh -r -f snsreg -p1 [sensor reg addr]</code>
+
<code>./mv_mipi_i2c.sh -r -f snsreg -p1 [sensor reg addr] -b your_i2c_bus_number</code>
  
 
Read the sensor's register indirectly via the camera controller unit.
 
Read the sensor's register indirectly via the camera controller unit.
Line 676: Line 812:
 
Note2: AE: Auto exposure; AG: Auto Gain; AA: AE and AG.
 
Note2: AE: Auto exposure; AG: Auto Gain; AA: AE and AG.
  
Note3: The AAROI coordinates are relative coordinates within the ROI area.<br />
+
Note3: The AAROI coordinates are relative coordinates within the ROI area.
 +
 
 +
Note4: For RAW Series, there are some functions that are not supported, please refer to the register list for details.
 +
 
 +
<br />
 +
 
 +
=== Configuration Method for Typical Application Scenarios: ===
 +
 
 +
==== Manual Exposure Mode: ====
 +
 <code>./mv_mipi_i2c.sh -w -f expmode -p1 0 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f gainmode -p1 0 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f metime -p1 exptime_you_want_to_set_us -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f mgain -p1 gain_you_want_to_set_dB -b your_i2c_bus_number</code>
 +
 
 +
 After configuration, read the parameters with the following commands to confirm they have taken effect:
 +
 
 +
 <code>./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number</code>
 +
 
 +
  '''Note:''' The maximum exposure time must be strictly less than the reciprocal of the '''fps'''.
 +
 
 +
==== Continuous Auto Exposure Mode: ====
 +
<code>./mv_mipi_i2c.sh -w -f expmode -p1 2 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f gainmode -p1 2 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f aatarget -p1 brightness_target -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f aemaxtime -p1 [16,1000000/fps] -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f agmaxgain -p1 [0,maxgain] -b your_i2c_bus_number</code>
 +
 
 +
  After continuous imaging for a while, you can read the current actual exposure time and gain using the following commands:
 +
 
 +
<code>./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number</code>
 +
 
 +
==== Normal Trigger Mode: ====
 +
   First, stop the image acquisition to enter a state where the trigger mode can be modified:
 +
 
 +
   <code>./mv_mipi_i2c.sh -w -f imgacq -p1 0 -b your_i2c_bus_number</code>
 +
 
 +
   In the following example, configure the camera for normal hardware trigger mode, where each trigger signal captures 1 image:
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgmode -p1 1 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgsrc -p1 1 -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgnum -p1 1 -b your_i2c_bus_number</code>
 +
 
 +
   You may optionally execute the following two commands to set the trigger edge and delay:
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgedge -p1 [0,1] -b your_i2c_bus_number</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgdelay -p1 [us] -b your_i2c_bus_number</code>
 +
 
 +
   After configuration, you can start the image acquisition to accept trigger signals:
 +
 
 +
 <code>./mv_mipi_i2c.sh -w -f imgacq -p1 1 -b your_i2c_bus_number</code><br />

Latest revision as of 15:56, 17 November 2024

mv_mipi_i2c.sh Shell scripts usage

1 Overview

The mv_mipi_i2c.sh script is a tool set for configuring MV MIPI series cameras through the I2C.

This script is essentially an access to registers. For registers, please refer to MV Series and RAW Series MIPI Camera Register Map.

2 Raspberry Pi on Legacy mode Only, Set IO config

Note that if you are using v4l2 mode, you do not need to perform this step.

Running

./enable_i2c_vc.sh

./camera_i2c_config

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

3 Download

We provide download links for mv_mipi_i2c.sh for different embedded platforms.

Generally, these links can be found in the respective platform's GitHub repository.

Below is the list:

3.1 Nvidia Jetson:

https://github.com/veyeimaging/nvidia_jetson_veye_bsp/tree/master/mv_tools_jetson/i2c_tools

3.2 Raspberry Pi:

https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/mv_tools_rpi

3.3 RK35xx:

https://github.com/veyeimaging/rk35xx_firefly/tree/main/mv_tools_rockchip/i2c_tools

4 Prepare

cd mv_tools_rpi/sources/

./make.sh

cd ..

chmod +x *

5 mv_mipi_i2c.sh USAGE

./mv_mipi_i2c.sh

Usage:  ./mv_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -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 [param3]                           param3 of each function

    -p4 [param4]                           param4 of each function

    -b [i2c bus num]               i2c bus number

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

Please open this srcipt and read the COMMENT on top for support functions and samples.

6 mv_mipi_i2c_new.sh USAGE

This script is a simplified version of mv_mipi_i2c.sh, in which -f -p1 -p2 -p3 -p4 is no longer needed.

$ ./mv_mipi_i2c_new.sh

Usage:  ./mv_mipi_i2c.sh [-r/w]  [function name] [param1] [param2 ] [param3] [param4] -b bus

options:

    -r                       read

    -w                       write

    [function name]       function name

    [param1]                        param1 of each function

    [param1]                        param2 of each function

    [param3]                        param3 of each function

    [param4]                        param4 of each function

    -b [i2c bus num]               i2c bus number

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

Please open this srcipt and read the COMMENT on top for support functions and samples

7 i2c bus number on different board

Please refer to the following article to determine which -b parameter you need to use.

i2c bus number on different boards

8 Functions list

8.1 Note

The camera has two states, standby and running, after the start of image acquisition into the running state.

There are some registers that are write-protected in the running state, which will be marked with an asterisk. For example: trgsrc* .

There are some parameters that have strict range restrictions, and it's a good idea to try reading them when you're in doubt.

8.2 Basic Parameters

8.2.1 manufacturer

./mv_mipi_i2c.sh -r -f manufacturer -b your_i2c_bus_number

Get the manufacturer name, which is VEYE.

8.2.2 model

./mv_mipi_i2c.sh -r -f model -b your_i2c_bus_number

Get the product model, such as MV-MIPI-IMX178M / MV-MIPI-SC132M.

8.2.3 version

./mv_mipi_i2c.sh -r -f version -b your_i2c_bus_number

Get the Controller version number and Logical version number.

The system has two main control chips that serve the control and logic functions respectively.

8.2.4 serialno

./mv_mipi_i2c.sh -r -f serialno -b your_i2c_bus_number

Get the unique serial number of this module.

8.2.5 timestamp

./mv_mipi_i2c.sh -r -f timestamp -b your_i2c_bus_number

Time after system startup in Milliseconds.

This value starts counting again if you call the reboot command, or if the camera reboots unexpectedly.

8.2.6 errcode

./mv_mipi_i2c.sh -r -f errcode -b your_i2c_bus_number

System error code, each bit represents an error type.

bit0: sensor error.

bit1: Logic module startup error.

bit2: Logic module communication error.

bit5: AA(AE&AG) regulation cannot reach the target brightness.

bit6: Authorization failure.

8.2.7 fmtcap

./mv_mipi_i2c.sh -r -f fmtcap -b your_i2c_bus_number

Capbility of data formats supported by the camera.

bit0: Mono8

bit1: Mono10

bit2: Mono12

bit3: Mono14

bit4: UYVY

8.2.8 trgmodecap

./mv_mipi_i2c.sh -r -f trgmodecap -b your_i2c_bus_number

Capbility of trigger mode supported by the camera.

bit0:Video streaming mode.

bit1:Normal trigger mode.

bit2:Rolling shutter multi-frame trigger mode.

bit3: Pulse trigger mode.

8.2.9 factoryparam

./mv_mipi_i2c.sh -w -f factoryparam -b your_i2c_bus_number

All parameters restored to factory default values.

8.2.10 paramsave

./mv_mipi_i2c.sh -w -f paramsave -b your_i2c_bus_number

Save all parameters to flash, and they will not be lost when power off.

8.2.11 reboot

./mv_mipi_i2c.sh -w -f reboot -b your_i2c_bus_number

Reboot the camera.

8.2.12 i2caddr

./mv_mipi_i2c.sh -w -f i2caddr -p1 [new] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f i2caddr -b your_i2c_bus_number
This module support i2c address changed by software, i2c address range[0x3,0x77].

Will really take effect only after paramsave and reboot .

8.2.13 slavemode

./mv_mipi_i2c.sh -w -f slavemode -p1 [0/1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f slavemode -b your_i2c_bus_number

Whether the sensor is operating in slave mode. In slave mode, the camera relies on external signals to provide XVS and XHS.

Writing this parameter will cause the camera to automatically save the current settings and reboot.

Currently, only RAW-MIPI-IMX462M support this function.

8.2.14 mcubypass

./mv_mipi_i2c.sh -w -f mcubypass -p1 [0/1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f mcubypass -b your_i2c_bus_number

For Raw series camera,set SDA(Sensor Direct Access) mode.

8.3 Image Acquisition

8.3.1 imgacq

./mv_mipi_i2c.sh -w -f imgacq -p1 [0/1] -b your_i2c_bus_number

Start/Stop acquisition

There is no image output after the camera is powered on, which means it is in the standby state.

After writing 1 to this register, it enters the running state and starts outputting images or waiting for the trigger signal.

Writing 0 will stop the output image and enter the standby state.

8.3.2 trgmode*

./mv_mipi_i2c.sh -w -f trgmode -p1 [0,2] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f trgmode -b your_i2c_bus_number

value description
0 Video streaming mode
1 Normal trigger mode
2 Rolling shutter multi-frame trigger mode
3 Pulse trigger mode

See product manual for details.

8.3.3 trgsrc*

./mv_mipi_i2c.sh -w -f trgsrc -p1 [0,1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f trgsrc -b your_i2c_bus_number

value description
0 Software trigger
1 Hardware trigger
8.3.4 trgnum*

./mv_mipi_i2c.sh -w -f trgnum -p1 [1,255] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f trgnum -b your_i2c_bus_number

The number of image frames output by one trigger signal in trigger mode.

8.3.5 trginterval*

./mv_mipi_i2c.sh -w -f trginterval -p1 [us] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f trginterval -b your_i2c_bus_number

Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF].

8.3.6 trgone

./mv_mipi_i2c.sh -w -f trgone -b your_i2c_bus_number

Software trigger command.One execution will perform a soft trigger.

8.3.7 trgcount

./mv_mipi_i2c.sh -r -f trgcount -b your_i2c_bus_number

Trigger count statistics.

Get the total number of triggers and the number of trigger loss.

./mv_mipi_i2c.sh -w -f trgcountclr -b your_i2c_bus_number

Clear trigger count.

8.3.8 framecount

./mv_mipi_i2c.sh -r -f framecount -b your_i2c_bus_number

Frame count statistics.

The number of frames output by the sensor and the number of frames output by the camera module. Cyclic counting.

8.4 IO Control

For RAW series cameras, the input IO supports trigger edge and trigger delay, and does not support trigger filtering function. The output IO is the strobe out pin of the sensor that leads directly.

8.4.1 trgdelay*

./mv_mipi_i2c.sh -r -f trgdelay -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgdelay -p1 [us] -b your_i2c_bus_number

Trigger delay, effective under both soft trigger and hard trigger mode.

range: 0 to 1000000 (unit: microsecond)

8.4.2 trgedge*

./mv_mipi_i2c.sh -r -f trgedge -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgedge -p1 [0,1] -b your_i2c_bus_number

Effective trigger edge in hard trigger mode.

value description
0 Rising edge
1 Falling edge
8.4.3 trgfilter_enable*

./mv_mipi_i2c.sh -r -f trgfilter_enable -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgfilter_enable -p1 [0,2] -b your_i2c_bus_number

value description
0 No filtering
1 Rising edge filtering (filtering out low-level interference signals)
2 Falling edge filtering (filtering out high level interference signals)
3 Both rising edge and falling edge filtering
8.4.4 trgfilter_time*

./mv_mipi_i2c.sh -r -f trgfilter_time -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgfilter_time -p1 [us] -b your_i2c_bus_number

Trigger signal filtering window width.

range: 1 to 1000000 (unit: microsecond)

8.4.5 trgexp_delay*

./mv_mipi_i2c.sh -r -f trgexp_delay -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgexp_delay -p1 [us] -b your_i2c_bus_number

Exposure delay, i.e. the time to turn on the Strobe signal in advance.

range: 1 to 1000000 (unit: microsecond)

The difference between trgexp_delay and trgdelay, see manual for details.

8.4.6 gpios_status

./mv_mipi_i2c.sh -r -f gpios_status -b your_i2c_bus_number

Get TriggerIN_IO, OUT_IO1 and OUT_IO2 status.

8.4.7 outio1_mode

./mv_mipi_i2c.sh -r -f outio1_mode -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio1_mode -p1 [0,1] -b your_i2c_bus_number

value description
0 strobe
1 user out

strobe: High level active.

user out: defined by outio1_usr.

8.4.8 outio1_usr

./mv_mipi_i2c.sh -r -f outio1_usr -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio1_usr -p1 [0,1] -b your_i2c_bus_number

value description
0 low
1 high
8.4.9 outio1_rvs

./mv_mipi_i2c.sh -r -f outio1_rvs -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio1_rvs -p1 [0,1] -b your_i2c_bus_number

Reverse OUT_IO1 high and low levels if set to 1.

8.4.10 outio2_mode

./mv_mipi_i2c.sh -r -f outio2_mode -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio2_mode -p1 [0,5] -b your_i2c_bus_number

value description
0 strobe
1 user out
2 trigger wait
3 XVS
4 XHS
5 Effective trigger signal (Sony's global shutter sensor only)

strobe: High level active.

user out: defined by outio2_usr.

trigger wait: High level active. Indicate that the camera is not busy now, able to respond to the trigger signal.

XHS, XVS: The signal from the corresponding pin of the sensor. (For rolling shutter only).

8.4.11 outio2_usr

./mv_mipi_i2c.sh -r -f outio2_usr -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio2_usr -p1 [0,1] -b your_i2c_bus_number

value description
0 low
1 high
8.4.12 outio2_rvs

./mv_mipi_i2c.sh -r -f outio2_rvs -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f outio2_rvs -p1 [0,1] -b your_i2c_bus_number

Reverse OUT_IO1 high and low levels if set to 1.

8.5 Image Features

8.5.1 maxwh

./mv_mipi_i2c.sh -r -f maxwh -b your_i2c_bus_number

Get the maximum supported resolution of the sensor.

8.5.2 maxfps

./mv_mipi_i2c.sh -r -f maxfps -b your_i2c_bus_number

The maximum frame rate supported in the current mode.

Depending on the configured ROI, the maximum frame rate will be different. This parameter supports decimals.

8.5.3 fps*

./mv_mipi_i2c.sh -w -f fps -p1 [framerate] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f fps -b your_i2c_bus_number

Configure the actual frame rate of the camera in the current mode.

Range:(0,maxfps].

In video streaming mode, this parameter determines the actual frame rate.

In normal trigger mode, it is recommended to set the fps to the maxfps value to ensure the highest trigger signal responsiveness.

8.5.4 roi*

./mv_mipi_i2c.sh -w -f roi -p1 [x] -p2 [y] -p3 [width] -p4 [height] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f roi -b your_i2c_bus_number

ROI(region of interest) is the sensor output area, and the default is full screen output.

Parameter requirements:

[x] [y] [height] must be 4-aligned;

[width] must be 8-aligned;

The minimum ROI resolution will be different for different sensors.

For example, MV-MIPI-IMX178M minimum resolution is: 376*320;MV-MIPI-SC130M minimum resolution is 64*64.

The camera will make necessary adjustments to the user parameters to meet the parameter requirements.

So it is highly recommended that you read out the actual ROI parameters after writing them.

8.5.5 imgdir

./mv_mipi_i2c.sh -w -f imgdir -p1 [0,3] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f imgdir -b your_i2c_bus_number

value description
0 normal
1 mirror
2 flip
3 flip&mirror

The image is first flipped/mirrored and then ROI cropped. For details, please refer to the manual.

8.5.6 pixelformat

./mv_mipi_i2c.sh -w -f pixelformat -p1 [0,2] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f pixelformat -b your_i2c_bus_number

value description
0 Mono8
1 Mono10
2 Mono12
4 UYVY

Note that for the MV-MIPI-IMX178M, the AD bits of the sensor is always 12 bits, and the logic unit performs data rounding to achieve a different pixel format.

8.5.7 blacklevel

./mv_mipi_i2c.sh -w -f blacklevel -p1 [blacklevel] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f blacklevel -b your_i2c_bus_number

This black level value will be set directly to the sensor.

8.5.8 blcmode

./mv_mipi_i2c.sh -w -f blcmode -p1 [0/1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f blcmode -b your_i2c_bus_number

Black level calibration modes:

0: Sensor automatic calibration or use default black level.

1: Manually specify black level.

8.5.9 testimg

./mv_mipi_i2c.sh -w -f testimg -p1 [0,2] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f testimg -b your_i2c_bus_number

value description
0 Normal image
1 Test image 1
2 Test image 2
8.5.10 lanenum*

./mv_mipi_i2c.sh -w -f lanenum -p1 [2/4] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f lanenum -b your_i2c_bus_number
For modules that support lane number configuration, use this register to modify the lane number.

8.5.11 mipidatarate

./mv_mipi_i2c.sh -r -f mipidatarate -b your_i2c_bus_number

he MIPI datarate for each lane, measured in Kbps.

8.6 ISP

8.6.1 Special Note

Generally, only manual exposure and manual gain are supported by RAW series cameras in this section. However, RAW-MIPI-AR0234M does support AEC control.

Commands supported by RAW-MIPI-AR0234M include:

expmode,metime,gainmode,mgain,aatarget,aemaxtime,exptime,curgain,aaroi,aaroienable.

8.6.2 gamma

./mv_mipi_i2c.sh -r -f gamma -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f gamma -p1 [gamma] -b your_i2c_bus_number

Range (0,4.0],accurate is 0.01.

For now, gamma only works on 8bit depth image.

8.6.3 gammaenable

./mv_mipi_i2c.sh -r -f gammaenable -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f gammaenable -p1 [0,1] -b your_i2c_bus_number

Enable/Disable gamma function.

8.6.4 dpcenable

./mv_mipi_i2c.sh -r -f dpcenable -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f dpcenable -p1 [0,1] -b your_i2c_bus_number

Enable/Disable DPC(Defect Point Correction) function.

8.6.5 lutenable

./mv_mipi_i2c.sh -r -f lutenable -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f lutenable -p1 [0,1] -b your_i2c_bus_number

Enable/Disable LUT(Look-Up-Table) function.

8.6.6 lut

./mv_mipi_i2c.sh -r -f lut -p1 [lutfilename] -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f lut -p1 [lutfilename] -b your_i2c_bus_number

Import or export a lut curve to a file, refer to the provided lut_linear.txt for the file format.

8.6.7 expmode

./mv_mipi_i2c.sh -r -f expmode -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f expmode -p1 [0,2] -b your_i2c_bus_number

value description
0 ME: manual exposure
1 AE once: auto exposure once
2 AE: auto exposure continuous

Both ME and AE are easy to understand.

AE once: Execute automatic exposure in the set range once, then stop the adjustment.

RAW-MIPI-AR0234M do not support AE once mode.

8.6.8 metime

./mv_mipi_i2c.sh -w -f metime -p1 [us] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f metime -b your_i2c_bus_number

Range (0,1000000/fps].Because of Note1 and range limitation, please read back to confirm the real metime take effect.

8.6.9 gainmode

./mv_mipi_i2c.sh -r -f gainmode -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f gainmode -p1 [0,3] -b your_i2c_bus_number

value description
0 MG: manual gain
1 AG once: auto gain once
2 AG: auto gain continuous

Both MG and AG are easy to understand.

AG once: Execute automatic gain in the set range once, then stop the adjustment.

RAW-MIPI-AR0234M do not support AG once mode.

RAW-MIPI-AR0234M can not enable AG in ME mode.

8.6.10 mgain

./mv_mipi_i2c.sh -w -f mgain -p1 [gain] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f mgain -b your_i2c_bus_number

Range [0,MAX_Gain],MAX_Gain varies from sensor to sensor, for example, IMX178 is 48dB.

Read back to confirm the real mgain take effect.

8.6.11 aatarget

./mv_mipi_i2c.sh -r -f aatarget -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f aatarget -p1 [1,255] -b your_i2c_bus_number

The target brightness of AE and AG algorithm.

Within the set range, the algorithm will prioritize the increase in exposure time,

and increase the gain if the exposure time reaches the maximum and still cannot reach the set target brightness value.

8.6.12 aemaxtime

./mv_mipi_i2c.sh -r -f aemaxtime -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f aemaxtime -p1 [16,1000000/fps] -b your_i2c_bus_number

Maximum exposure time in AE mode.Range[16,1000000]. Note1.

Please read back to confirm the real aemaxtime take effect.

8.6.13 agmaxgain

./mv_mipi_i2c.sh -r -f agmaxgain -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f agmaxgain -p1 [0,maxgain] -b your_i2c_bus_number

Maximum value of auto gain. The range and step vary according to the model.

Most sensors have a gain step of 0.1dB, some are 0.3dB.

Note:For RAW-MIPI-AR0234M, agmaxgain cannot be configured and remains fixed at 24dB.

8.6.14 exptime

./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number

Get the current exposure time. This command is valid in any exposure mode.

8.6.15 curgain

./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number

Gets the current gain. This command is valid in any exposure mode.

8.6.16 aaroienable

./mv_mipi_i2c.sh -w -f aaroienable -p1 [0,1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f aaroienable -b your_i2c_bus_number

Whether to enable AAROI statistics function, not enable means full ROI statistics.

8.6.17 aaroi

./mv_mipi_i2c.sh -w -f aaroi -p1 [x] -p2 [y] -p3 [width] -p4 [height] -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f aaroi -b your_i2c_bus_number

The AAROI coordinates are relative coordinates within the ROI area. So the area must be smaller than the image ROI.

8.6.18 aeag_run_once_save

./mv_mipi_i2c.sh -w -f aeag_run_once_save -b your_i2c_bus_number

Execute AE&AG once operation and save the results to the camera as manual values!
This is a function that is useful when the camera is installed.

Please make sure that the image preview has already been started before executing this command.

It performs the following operations:

  1. Set AE and AG range to MAX.
  2. Run AE once and AG once.
  3. Wait 5 seconds.
  4. Check AE once and AG once result.
  5. Save the previous result to manual mode.
  6. Run paramsave,save to flash.
8.6.19 snsreg

./mv_mipi_i2c.sh -r -f snsreg -p1 [sensor reg addr] -b your_i2c_bus_number

Read the sensor's register indirectly via the camera controller unit.

8.7 Notes

Note1: All parameters of exposure time are in microseconds. However, due to the properties of the sensor, the actual exposure time unit of the sensor is 1 line, can not be accurate to 1us.

Note2: AE: Auto exposure; AG: Auto Gain; AA: AE and AG.

Note3: The AAROI coordinates are relative coordinates within the ROI area.

Note4: For RAW Series, there are some functions that are not supported, please refer to the register list for details.


9 Configuration Method for Typical Application Scenarios:

9.1 Manual Exposure Mode:

 ./mv_mipi_i2c.sh -w -f expmode -p1 0 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f gainmode -p1 0 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f metime -p1 exptime_you_want_to_set_us -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f mgain -p1 gain_you_want_to_set_dB -b your_i2c_bus_number

 After configuration, read the parameters with the following commands to confirm they have taken effect:

 ./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number

  Note: The maximum exposure time must be strictly less than the reciprocal of the fps.

9.2 Continuous Auto Exposure Mode:

./mv_mipi_i2c.sh -w -f expmode -p1 2 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f gainmode -p1 2 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f aatarget -p1 brightness_target -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f aemaxtime -p1 [16,1000000/fps] -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f agmaxgain -p1 [0,maxgain] -b your_i2c_bus_number

  After continuous imaging for a while, you can read the current actual exposure time and gain using the following commands:

./mv_mipi_i2c.sh -r -f exptime -b your_i2c_bus_number

./mv_mipi_i2c.sh -r -f curgain -b your_i2c_bus_number

9.3 Normal Trigger Mode:

   First, stop the image acquisition to enter a state where the trigger mode can be modified:

   ./mv_mipi_i2c.sh -w -f imgacq -p1 0 -b your_i2c_bus_number

   In the following example, configure the camera for normal hardware trigger mode, where each trigger signal captures 1 image:

./mv_mipi_i2c.sh -w -f trgmode -p1 1 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgsrc -p1 1 -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgnum -p1 1 -b your_i2c_bus_number

   You may optionally execute the following two commands to set the trigger edge and delay:

./mv_mipi_i2c.sh -w -f trgedge -p1 [0,1] -b your_i2c_bus_number

./mv_mipi_i2c.sh -w -f trgdelay -p1 [us] -b your_i2c_bus_number

   After configuration, you can start the image acquisition to accept trigger signals:

 ./mv_mipi_i2c.sh -w -f imgacq -p1 1 -b your_i2c_bus_number