Difference between revisions of "Mv mipi i2c.sh user guide"
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<big>'''mv_mipi_i2c.sh Shell scripts usage'''</big> | <big>'''mv_mipi_i2c.sh Shell scripts usage'''</big> | ||
| − | === Overview === | + | ===Overview=== |
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|MV Series and RAW 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 === | + | ===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. | Note that if you are using v4l2 mode, you do not need to perform this step. | ||
| Line 17: | Line 17: | ||
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 === | + | ===Download=== |
We provide download links for mv_mipi_i2c.sh for different embedded platforms. | We provide download links for mv_mipi_i2c.sh for different embedded platforms. | ||
| Line 24: | Line 24: | ||
Below is the list: | Below is the list: | ||
| − | ==== Nvidia Jetson: ==== | + | ====Nvidia Jetson:==== |
https://github.com/veyeimaging/nvidia_jetson_veye_bsp/tree/master/mv_tools_jetson/i2c_tools | https://github.com/veyeimaging/nvidia_jetson_veye_bsp/tree/master/mv_tools_jetson/i2c_tools | ||
| − | ==== Raspberry Pi: ==== | + | ====Raspberry Pi:==== |
https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/mv_tools_rpi | https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/mv_tools_rpi | ||
| − | ==== RK35xx: ==== | + | ====RK35xx:==== |
https://github.com/veyeimaging/rk35xx_veye_bsp/tree/main/mv_tools_rockchip/i2c_tools | https://github.com/veyeimaging/rk35xx_veye_bsp/tree/main/mv_tools_rockchip/i2c_tools | ||
| − | === Prepare === | + | ===Prepare=== |
<code>cd mv_tools_rpi/sources/</code> | <code>cd mv_tools_rpi/sources/</code> | ||
| Line 42: | Line 42: | ||
<code>chmod +x *</code> | <code>chmod +x *</code> | ||
| − | === mv_mipi_i2c_new.sh USAGE === | + | === Runtime Environment Verification === |
| + | Before executing the main logic, retrieve the camera version information and verify that a reasonable value is returned. | ||
| + | |||
| + | A valid response indicates that the camera is accessible and the script runtime environment is properly set up. | ||
| + | |||
| + | <code>./mv_mipi_i2c_new.sh -r version -b your_i2c_bus_number</code> | ||
| + | |||
| + | ===mv_mipi_i2c_new.sh USAGE=== | ||
This script is a simplified version of mv_mipi_i2c.sh, in which -f is no longer needed. | This script is a simplified version of mv_mipi_i2c.sh, in which -f is no longer needed. | ||
| Line 71: | Line 78: | ||
<code>Please open this srcipt and read the COMMENT on top for support functions and samples</code> | <code>Please open this srcipt and read the COMMENT on top for support functions and samples</code> | ||
| − | === mv_mipi_i2c.sh USAGE(Legacy) === | + | ===mv_mipi_i2c.sh USAGE(Legacy)=== |
<code>./mv_mipi_i2c.sh</code> | <code>./mv_mipi_i2c.sh</code> | ||
| Line 104: | Line 111: | ||
===Functions list=== | ===Functions list=== | ||
| − | ==== Note ==== | + | ====Note==== |
The camera has two states, '''standby''' and '''running''', after the start of image acquisition into the '''running''' state. | The camera has two states, '''standby''' and '''running''', after the start of image acquisition into the '''running''' state. | ||
| Line 111: | Line 118: | ||
There are some parameters that have strict range restrictions, and it's a good idea to try reading them when you're in doubt. | There are some parameters that have strict range restrictions, and it's a good idea to try reading them when you're in doubt. | ||
| − | ==== Basic Parameters ==== | + | ====Basic Parameters==== |
| − | ===== manufacturer ===== | + | =====manufacturer===== |
<code>./mv_mipi_i2c_new.sh -r manufacturer -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r 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_new.sh -r model -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r model -b your_i2c_bus_number</code> | ||
Get the product model, such as '''MV-MIPI-IMX178M''' / '''MV-MIPI-SC132M'''. | Get the product model, such as '''MV-MIPI-IMX178M''' / '''MV-MIPI-SC132M'''. | ||
| − | ===== version ===== | + | =====version===== |
<code>./mv_mipi_i2c_new.sh -r version -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r version -b your_i2c_bus_number</code> | ||
| Line 130: | Line 137: | ||
The system has two main control chips that serve the control and logic functions respectively. | The system has two main control chips that serve the control and logic functions respectively. | ||
| − | ===== serialno ===== | + | =====serialno===== |
<code>./mv_mipi_i2c_new.sh -r serialno -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r 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_new.sh -r timestamp -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r timestamp -b your_i2c_bus_number</code> | ||
| Line 142: | Line 149: | ||
This value starts counting again if you call the reboot command, or if the camera reboots unexpectedly. | This value starts counting again if you call the reboot command, or if the camera reboots unexpectedly. | ||
| − | ===== errcode ===== | + | =====errcode===== |
<code>./mv_mipi_i2c_new.sh -r errcode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r errcode -b your_i2c_bus_number</code> | ||
| Line 157: | Line 164: | ||
bit6: Authorization failure. | bit6: Authorization failure. | ||
| − | ===== fmtcap ===== | + | =====fmtcap===== |
<code>./mv_mipi_i2c_new.sh -r fmtcap -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r fmtcap -b your_i2c_bus_number</code> | ||
| Line 172: | Line 179: | ||
bit4: UYVY | bit4: UYVY | ||
| − | ===== readmodecap ===== | + | =====readmodecap===== |
<code>./mv_mipi_i2c_new.sh -r readmodecap -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r readmodecap -b your_i2c_bus_number</code> | ||
| Line 183: | Line 190: | ||
bit2: Subsampling | bit2: Subsampling | ||
| − | ===== trgmodecap ===== | + | =====trgmodecap===== |
<code>./mv_mipi_i2c_new.sh -r trgmodecap -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgmodecap -b your_i2c_bus_number</code> | ||
| Line 196: | Line 203: | ||
bit3: Pulse trigger mode. | bit3: Pulse trigger mode. | ||
| − | ===== factoryparam ===== | + | =====factoryparam===== |
<code>./mv_mipi_i2c_new.sh -w factoryparam -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w factoryparam -b your_i2c_bus_number</code> | ||
All parameters restored to factory default values. | All parameters restored to factory default values. | ||
| − | ===== paramsave ===== | + | This operation will erase the system flash and rewrite it. Please ensure that the power is not interrupted during the operation. |
| + | |||
| + | Additionally, it is recommended not to perform frequent factoryparam operations. | ||
| + | =====paramsave===== | ||
<code>./mv_mipi_i2c_new.sh -w paramsave -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w paramsave -b your_i2c_bus_number</code> | ||
| Line 210: | Line 220: | ||
Additionally, it is recommended not to perform frequent paramsave operations. | Additionally, it is recommended not to perform frequent paramsave operations. | ||
| − | ===== reboot ===== | + | =====reboot===== |
<code>./mv_mipi_i2c_new.sh -w reboot -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w reboot -b your_i2c_bus_number</code> | ||
Reboot the camera. | Reboot the camera. | ||
| − | ===== i2caddr ===== | + | =====i2caddr===== |
<code>./mv_mipi_i2c_new.sh -w i2caddr [new] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w i2caddr [new] -b your_i2c_bus_number</code> | ||
| Line 222: | Line 232: | ||
Will really take effect only after paramsave and reboot . | Will really take effect only after paramsave and reboot . | ||
| − | ===== slavemode ===== | + | =====slavemode===== |
<code>./mv_mipi_i2c_new.sh -w slavemode [0/1] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w slavemode [0/1] -b your_i2c_bus_number</code> | ||
| Line 233: | Line 243: | ||
Currently, only RAW-MIPI-IMX462M support this function. | Currently, only RAW-MIPI-IMX462M support this function. | ||
| − | ===== minwh ===== | + | =====minwh===== |
<code>./mv_mipi_i2c_new.sh -r minwh -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r minwh -b your_i2c_bus_number</code> | ||
Get the minimum width and height supported by the camera. | Get the minimum width and height supported by the camera. | ||
| − | ===== temp ===== | + | =====temp===== |
<code>./mv_mipi_i2c_new.sh -r temp -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r temp -b your_i2c_bus_number</code> | ||
For cameras that support temperature sensors, obtain the temperature inside the camera chip. | For cameras that support temperature sensors, obtain the temperature inside the camera chip. | ||
| − | ===== minfps ===== | + | =====minfps===== |
<code>./mv_mipi_i2c_new.sh -r minfps -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r minfps -b your_i2c_bus_number</code> | ||
Read the minimum frame rate supported by the current module. | Read the minimum frame rate supported by the current module. | ||
| − | ==== Image Acquisition ==== | + | ====Image Acquisition==== |
| − | ===== imgacq ===== | + | =====imgacq===== |
<code>./mv_mipi_i2c_new.sh -w imgacq [0/1] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w imgacq [0/1] -b your_i2c_bus_number</code> | ||
| Line 261: | Line 271: | ||
Writing 0 will stop the output image and enter the standby state. | Writing 0 will stop the output image and enter the standby state. | ||
| − | ===== trgmode* ===== | + | =====trgmode*===== |
<code>./mv_mipi_i2c_new.sh -w trgmode [0,2] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w trgmode [0,2] -b your_i2c_bus_number</code> | ||
| Line 283: | Line 293: | ||
See product manual for details. | See product manual for details. | ||
| − | ===== trgsrc* ===== | + | =====trgsrc*===== |
<code>./mv_mipi_i2c_new.sh -w trgsrc [0,1] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w trgsrc [0,1] -b your_i2c_bus_number</code> | ||
| Line 298: | Line 308: | ||
|} | |} | ||
| − | ===== trgnum* ===== | + | =====trgnum*===== |
<code>./mv_mipi_i2c_new.sh -w trgnum [1,255] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w trgnum [1,255] -b your_i2c_bus_number</code> | ||
| Line 305: | Line 315: | ||
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_new.sh -w trginterval [us] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w trginterval [us] -b your_i2c_bus_number</code> | ||
| Line 312: | Line 322: | ||
Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF]. | Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF]. | ||
| − | ===== trgcycle ===== | + | =====trgcycle===== |
<code>./mv_mipi_i2c_new.sh -r trgcycle -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgcycle -b your_i2c_bus_number</code> | ||
Reads the lowest trigger cycle in the current trigger mode. | Reads the lowest trigger cycle in the current trigger mode. | ||
| − | ===== trgone ===== | + | =====trgone===== |
<code>./mv_mipi_i2c_new.sh -w trgone -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w 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_new.sh -r trgcount -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgcount -b your_i2c_bus_number</code> | ||
| Line 333: | Line 343: | ||
Clear trigger count. | Clear trigger count. | ||
| − | ===== framecount ===== | + | =====framecount===== |
<code>./mv_mipi_i2c_new.sh -r framecount -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r framecount -b your_i2c_bus_number</code> | ||
| Line 340: | Line 350: | ||
The number of frames output by the sensor and the number of frames output by the camera module. Cyclic counting. | 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. | 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_new.sh -r trgdelay -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgdelay -b your_i2c_bus_number</code> | ||
| Line 352: | Line 362: | ||
range: 0 to 1000000 (unit: microsecond) | range: 0 to 1000000 (unit: microsecond) | ||
| − | ===== trgedge* ===== | + | =====trgedge*===== |
<code>./mv_mipi_i2c_new.sh -r trgedge -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgedge -b your_i2c_bus_number</code> | ||
| Line 369: | Line 379: | ||
|} | |} | ||
| − | ===== trgfilter_enable* ===== | + | =====trgfilter_enable*===== |
<code>./mv_mipi_i2c_new.sh -r trgfilter_enable -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgfilter_enable -b your_i2c_bus_number</code> | ||
| Line 390: | Line 400: | ||
|} | |} | ||
| − | ===== trgfilter_time* ===== | + | =====trgfilter_time*===== |
<code>./mv_mipi_i2c_new.sh -r trgfilter_time -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgfilter_time -b your_i2c_bus_number</code> | ||
| Line 399: | Line 409: | ||
range: 1 to 1000000 (unit: microsecond) | range: 1 to 1000000 (unit: microsecond) | ||
| − | ===== trgexp_delay* ===== | + | =====trgexp_delay*===== |
<code>./mv_mipi_i2c_new.sh -r trgexp_delay -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r trgexp_delay -b your_i2c_bus_number</code> | ||
| Line 406: | Line 416: | ||
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. | ||
| − | range: | + | range: 0 to 1000000 (unit: microsecond) |
The difference between trgexp_delay and trgdelay, see manual for details. | The difference between trgexp_delay and trgdelay, see manual for details. | ||
| − | ===== gpios_status ===== | + | =====gpios_status===== |
<code>./mv_mipi_i2c_new.sh -r gpios_status -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r 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_new.sh -r outio1_mode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio1_mode -b your_i2c_bus_number</code> | ||
| Line 424: | Line 434: | ||
|- | |- | ||
|0 | |0 | ||
| − | |strobe | + | |strobe |
|- | |- | ||
|1 | |1 | ||
| Line 433: | Line 443: | ||
user out: defined by '''outio1_usr.''' | user out: defined by '''outio1_usr.''' | ||
| − | ===== outio1_usr ===== | + | =====outio1_usr===== |
<code>./mv_mipi_i2c_new.sh -r outio1_usr -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio1_usr -b your_i2c_bus_number</code> | ||
| Line 448: | Line 458: | ||
|} | |} | ||
| − | ===== outio1_rvs ===== | + | =====outio1_rvs===== |
<code>./mv_mipi_i2c_new.sh -r outio1_rvs -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio1_rvs -b your_i2c_bus_number</code> | ||
| Line 455: | Line 465: | ||
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_new.sh -r outio2_mode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio2_mode -b your_i2c_bus_number</code> | ||
| Line 464: | Line 474: | ||
|- | |- | ||
|0 | |0 | ||
| − | |strobe | + | |strobe |
|- | |- | ||
|1 | |1 | ||
| Line 489: | Line 499: | ||
XHS, XVS: The signal from the corresponding pin of the sensor. (For rolling shutter only). | XHS, XVS: The signal from the corresponding pin of the sensor. (For rolling shutter only). | ||
| − | ===== outio2_usr ===== | + | =====outio2_usr===== |
<code>./mv_mipi_i2c_new.sh -r outio2_usr -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio2_usr -b your_i2c_bus_number</code> | ||
| Line 504: | Line 514: | ||
|} | |} | ||
| − | ===== outio2_rvs ===== | + | =====outio2_rvs===== |
<code>./mv_mipi_i2c_new.sh -r outio2_rvs -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r outio2_rvs -b your_i2c_bus_number</code> | ||
| Line 511: | Line 521: | ||
Reverse OUT_IO1 high and low levels if set to 1. | Reverse OUT_IO1 high and low levels if set to 1. | ||
| − | ==== Image Features ==== | + | ====Image Features==== |
| − | ===== maxwh ===== | + | =====maxwh===== |
<code>./mv_mipi_i2c_new.sh -r maxwh -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r 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_new.sh -r maxfps -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r maxfps -b your_i2c_bus_number</code> | ||
| Line 525: | Line 535: | ||
Depending on the configured ROI, the maximum frame rate will be different. This parameter supports decimals. | Depending on the configured ROI, the maximum frame rate will be different. This parameter supports decimals. | ||
| − | ===== fps* ===== | + | =====fps*===== |
<code>./mv_mipi_i2c_new.sh -w fps [framerate] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w fps [framerate] -b your_i2c_bus_number</code> | ||
| Line 538: | Line 548: | ||
In normal trigger mode, it is recommended to set the '''fps''' to the '''maxfps''' value to ensure the highest trigger signal responsiveness. | In normal trigger mode, it is recommended to set the '''fps''' to the '''maxfps''' value to ensure the highest trigger signal responsiveness. | ||
| − | ===== fps_ex* ===== | + | =====fps_ex*===== |
<code>./mv_mipi_i2c_new.sh -w fps_ex [framerate] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w fps_ex [framerate] -b your_i2c_bus_number</code> | ||
| Line 545: | Line 555: | ||
Extended functionality of fps: '''fps_ex''' supports a precision of up to 1/10,000, primarily for more accurate exposure time control in long exposure mode. | Extended functionality of fps: '''fps_ex''' supports a precision of up to 1/10,000, primarily for more accurate exposure time control in long exposure mode. | ||
| − | ===== roi* ===== | + | =====roi*===== |
<code>./mv_mipi_i2c_new.sh -w roi [x] [y] [width] [height] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w roi [x] [y] [width] [height] -b your_i2c_bus_number</code> | ||
| Line 566: | Line 576: | ||
So it is highly recommended that you read out the actual ROI parameters after writing them. | So it is highly recommended that you read out the actual ROI parameters after writing them. | ||
| − | ===== imgdir ===== | + | =====imgdir===== |
<code>./mv_mipi_i2c_new.sh -w imgdir [0,3] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w imgdir [0,3] -b your_i2c_bus_number</code> | ||
| Line 588: | Line 598: | ||
The image is first flipped/mirrored and then ROI cropped. For details, please refer to the manual. | The image is first flipped/mirrored and then ROI cropped. For details, please refer to the manual. | ||
| − | ===== pixelformat ===== | + | =====pixelformat===== |
<code>./mv_mipi_i2c_new.sh -w pixelformat [0,2] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w pixelformat [0,2] -b your_i2c_bus_number</code> | ||
| Line 610: | Line 620: | ||
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. | 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. | ||
| − | ===== blacklevel ===== | + | =====blacklevel===== |
<code>./mv_mipi_i2c_new.sh -w blacklevel [blacklevel] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w blacklevel [blacklevel] -b your_i2c_bus_number</code> | ||
| Line 617: | Line 627: | ||
This black level value will be set directly to the sensor. | This black level value will be set directly to the sensor. | ||
| − | ===== blcmode ===== | + | =====blcmode===== |
<code>./mv_mipi_i2c_new.sh -w blcmode [0/1] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w blcmode [0/1] -b your_i2c_bus_number</code> | ||
| Line 628: | Line 638: | ||
1: Manually specify black level. | 1: Manually specify black level. | ||
| − | ===== testimg ===== | + | =====testimg===== |
<code>./mv_mipi_i2c_new.sh -w testimg [0,2] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w testimg [0,2] -b your_i2c_bus_number</code> | ||
| Line 646: | Line 656: | ||
|} | |} | ||
| − | ===== readmode* ===== | + | =====readmode*===== |
<code>./mv_mipi_i2c_new.sh -w readmode [0/1/2] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w readmode [0/1/2] -b your_i2c_bus_number</code> | ||
| Line 659: | Line 669: | ||
2: Subsampling | 2: Subsampling | ||
| − | ===== lanenum* ===== | + | =====lanenum*===== |
<code>./mv_mipi_i2c_new.sh -w lanenum [2/4] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w lanenum [2/4] -b your_i2c_bus_number</code> | ||
<code>./mv_mipi_i2c_new.sh -r lanenum -b your_i2c_bus_number</code><br />For modules that support lane number configuration, use this register to modify the lane number. | <code>./mv_mipi_i2c_new.sh -r lanenum -b your_i2c_bus_number</code><br />For modules that support lane number configuration, use this register to modify the lane number. | ||
| − | ===== mipidatarate ===== | + | =====mipidatarate===== |
<code>./mv_mipi_i2c_new.sh -r mipidatarate -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r mipidatarate -b your_i2c_bus_number</code> | ||
The MIPI datarate for each lane, measured in Kbps. | The MIPI datarate for each lane, measured in Kbps. | ||
| − | ===== osdmode ===== | + | =====osdmode===== |
<code>./mv_mipi_i2c_new.sh -r osdmode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r osdmode -b your_i2c_bus_number</code> | ||
| Line 678: | Line 688: | ||
1: Crosshair enabled, overlays a crosshair at the center of the image for assisting with coordinate calibration. | 1: Crosshair enabled, overlays a crosshair at the center of the image for assisting with coordinate calibration. | ||
| − | ==== ISP ==== | + | ====ISP==== |
| − | ===== Special Note ===== | + | =====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. | Generally, only manual exposure and manual gain are supported by RAW series cameras in this section. However, RAW-MIPI-AR0234M does support AEC control. | ||
| Line 687: | Line 697: | ||
expmode,metime,gainmode,mgain,aatarget,aemaxtime,exptime,curgain,aaroi,aaroienable. | expmode,metime,gainmode,mgain,aatarget,aemaxtime,exptime,curgain,aaroi,aaroienable. | ||
| − | ===== gamma ===== | + | =====gamma===== |
<code>./mv_mipi_i2c_new.sh -r gamma -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r gamma -b your_i2c_bus_number</code> | ||
| Line 696: | Line 706: | ||
For now, gamma only works on 8bit depth image. | For now, gamma only works on 8bit depth image. | ||
| − | ===== gammaenable ===== | + | =====gammaenable===== |
<code>./mv_mipi_i2c_new.sh -r gammaenable -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r gammaenable -b your_i2c_bus_number</code> | ||
| Line 703: | Line 713: | ||
Enable/Disable gamma function. | Enable/Disable gamma function. | ||
| − | ===== dpcenable ===== | + | =====dpcenable===== |
<code>./mv_mipi_i2c_new.sh -r dpcenable -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r dpcenable -b your_i2c_bus_number</code> | ||
| Line 710: | Line 720: | ||
Enable/Disable DPC(Defect Point Correction) function. | Enable/Disable DPC(Defect Point Correction) function. | ||
| − | ===== lutenable ===== | + | =====lutenable===== |
<code>./mv_mipi_i2c_new.sh -r lutenable -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r lutenable -b your_i2c_bus_number</code> | ||
| Line 717: | Line 727: | ||
Enable/Disable LUT(Look-Up-Table) function. | Enable/Disable LUT(Look-Up-Table) function. | ||
| − | ===== lut ===== | + | =====lut===== |
<code>./mv_mipi_i2c_new.sh -r lut [lutfilename] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r lut [lutfilename] -b your_i2c_bus_number</code> | ||
| Line 724: | Line 734: | ||
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_new.sh -r expmode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r expmode -b your_i2c_bus_number</code> | ||
| Line 747: | Line 757: | ||
RAW-MIPI-AR0234M do not support AE once mode. | RAW-MIPI-AR0234M do not support AE once mode. | ||
| − | ===== metime ===== | + | =====metime===== |
<code>./mv_mipi_i2c_new.sh -w metime [us] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w metime [us] -b your_i2c_bus_number</code> | ||
| Line 756: | Line 766: | ||
Unit: microseconds. | Unit: microseconds. | ||
| − | ===== gainmode ===== | + | =====gainmode===== |
<code>./mv_mipi_i2c_new.sh -r gainmode -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r gainmode -b your_i2c_bus_number</code> | ||
| Line 781: | Line 791: | ||
RAW-MIPI-AR0234M can not enable AG in ME mode. | RAW-MIPI-AR0234M can not enable AG in ME mode. | ||
| − | ===== mgain ===== | + | =====mgain===== |
<code>./mv_mipi_i2c_new.sh -w mgain [gain] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w mgain [gain] -b your_i2c_bus_number</code> | ||
| Line 790: | Line 800: | ||
Read back to confirm the real mgain take effect. | Read back to confirm the real mgain take effect. | ||
| − | ===== aatarget ===== | + | =====aatarget===== |
<code>./mv_mipi_i2c_new.sh -r aatarget -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r aatarget -b your_i2c_bus_number</code> | ||
| Line 801: | Line 811: | ||
and increase the gain if the exposure time reaches the maximum and still cannot reach the set target brightness value. | and increase the gain if the exposure time reaches the maximum and still cannot reach the set target brightness value. | ||
| − | ===== aemaxtime ===== | + | =====aemaxtime===== |
<code>./mv_mipi_i2c_new.sh -r aemaxtime -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r aemaxtime -b your_i2c_bus_number</code> | ||
| Line 812: | Line 822: | ||
Unit: microseconds. | Unit: microseconds. | ||
| − | ===== agmaxgain ===== | + | =====agmaxgain===== |
<code>./mv_mipi_i2c_new.sh -r agmaxgain -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r agmaxgain -b your_i2c_bus_number</code> | ||
| Line 823: | Line 833: | ||
Note:For RAW-MIPI-AR0234M, agmaxgain cannot be configured and remains fixed at 24dB. | Note:For RAW-MIPI-AR0234M, agmaxgain cannot be configured and remains fixed at 24dB. | ||
| − | ===== exptime ===== | + | =====exptime===== |
<code>./mv_mipi_i2c_new.sh -r exptime -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r exptime -b your_i2c_bus_number</code> | ||
| Line 830: | Line 840: | ||
Unit: microseconds. | Unit: microseconds. | ||
| − | ===== curgain ===== | + | =====curgain===== |
<code>./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r 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_new.sh -w aaroienable [0,1] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w aaroienable [0,1] -b your_i2c_bus_number</code> | ||
| Line 842: | Line 852: | ||
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_new.sh -w aaroi [x] [y] [width] [height] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w aaroi [x] [y] [width] [height] -b your_i2c_bus_number</code> | ||
| Line 849: | Line 859: | ||
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. | ||
| − | ===== exptime_range ===== | + | =====exptime_range===== |
<code>./mv_mipi_i2c_new.sh -r exptime_range -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r exptime_range -b your_i2c_bus_number</code> | ||
| Line 856: | Line 866: | ||
Unit: microseconds. | Unit: microseconds. | ||
| − | ===== aeag_run_once_save ===== | + | =====aeag_run_once_save===== |
<code>./mv_mipi_i2c_new.sh -w aeag_run_once_save -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w aeag_run_once_save -b your_i2c_bus_number</code> | ||
| Line 865: | Line 875: | ||
It performs the following operations: | It performs the following operations: | ||
| − | # Set AE and AG range to MAX. | + | #Set AE and AG range to MAX. |
| − | # Run AE once and AG once. | + | #Run AE once and AG once. |
| − | # Wait 5 seconds. | + | #Wait 5 seconds. |
| − | # Check AE once and AG once result. | + | #Check AE once and AG once result. |
| − | # Save the previous result to manual mode. | + | #Save the previous result to manual mode. |
#Run paramsave,save to flash. | #Run paramsave,save to flash. | ||
| − | ===== snsreg ===== | + | =====snsreg===== |
<code>./mv_mipi_i2c_new.sh -r snsreg [sensor reg addr] -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r snsreg [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. | ||
| − | ==== Notes ==== | + | ====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. | 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. | ||
| Line 888: | Line 898: | ||
<br /> | <br /> | ||
| − | === Configuration Method for Typical Application Scenarios: === | + | ===Configuration Method for Typical Application Scenarios:=== |
| − | ==== Manual Exposure Mode: ==== | + | ====Manual Exposure Mode:==== |
<code>./mv_mipi_i2c_new.sh -w expmode 0 -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w expmode 0 -b your_i2c_bus_number</code> | ||
| Line 907: | Line 917: | ||
'''Note:''' The maximum exposure time must be strictly less than the reciprocal of the '''fps'''. | '''Note:''' The maximum exposure time must be strictly less than the reciprocal of the '''fps'''. | ||
| − | ==== Continuous Auto Exposure Mode: ==== | + | ====Continuous Auto Exposure Mode:==== |
<code>./mv_mipi_i2c_new.sh -w expmode 2 -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w expmode 2 -b your_i2c_bus_number</code> | ||
| Line 924: | Line 934: | ||
<code>./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number</code> | ||
| − | ==== Normal Trigger Mode: ==== | + | ====Normal Trigger Mode:==== |
First, stop the image acquisition to enter a state where the trigger mode can be modified: | First, stop the image acquisition to enter a state where the trigger mode can be modified: | ||
| Line 947: | Line 957: | ||
<code>./mv_mipi_i2c_new.sh -w imgacq 1 -b your_i2c_bus_number</code> | <code>./mv_mipi_i2c_new.sh -w imgacq 1 -b your_i2c_bus_number</code> | ||
| − | ==== Long Exposure Mode ==== | + | ====Long Exposure Mode==== |
Some models support long exposure times, such as the MV-MIPI-IMX178M, which supports exposure times up to 100 seconds. The usage is as follows: | Some models support long exposure times, such as the MV-MIPI-IMX178M, which supports exposure times up to 100 seconds. The usage is as follows: | ||
Latest revision as of 07:23, 4 March 2026
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_veye_bsp/tree/main/mv_tools_rockchip/i2c_tools
4 Prepare
cd mv_tools_rpi/sources/
./make.sh
cd ..
chmod +x *
5 Runtime Environment Verification
Before executing the main logic, retrieve the camera version information and verify that a reasonable value is returned.
A valid response indicates that the camera is accessible and the script runtime environment is properly set up.
./mv_mipi_i2c_new.sh -r version -b your_i2c_bus_number
6 mv_mipi_i2c_new.sh USAGE
This script is a simplified version of mv_mipi_i2c.sh, in which -f is no longer needed.
$ ./mv_mipi_i2c_new.sh
Usage: ./mv_mipi_i2c_new.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 mv_mipi_i2c.sh USAGE(Legacy)
./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.
8 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
9 Functions list
9.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.
9.2 Basic Parameters
9.2.1 manufacturer
./mv_mipi_i2c_new.sh -r manufacturer -b your_i2c_bus_number
Get the manufacturer name, which is VEYE.
9.2.2 model
./mv_mipi_i2c_new.sh -r model -b your_i2c_bus_number
Get the product model, such as MV-MIPI-IMX178M / MV-MIPI-SC132M.
9.2.3 version
./mv_mipi_i2c_new.sh -r 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.
9.2.4 serialno
./mv_mipi_i2c_new.sh -r serialno -b your_i2c_bus_number
Get the unique serial number of this module.
9.2.5 timestamp
./mv_mipi_i2c_new.sh -r 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.
9.2.6 errcode
./mv_mipi_i2c_new.sh -r 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.
9.2.7 fmtcap
./mv_mipi_i2c_new.sh -r fmtcap -b your_i2c_bus_number
Capbility of data formats supported by the camera.
bit0: Mono8
bit1: Mono10
bit2: Mono12
bit3: Mono14
bit4: UYVY
9.2.8 readmodecap
./mv_mipi_i2c_new.sh -r readmodecap -b your_i2c_bus_number
Capbility of read mode supported by the camera.
bit0: Normal
bit1: Binning
bit2: Subsampling
9.2.9 trgmodecap
./mv_mipi_i2c_new.sh -r 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.
9.2.10 factoryparam
./mv_mipi_i2c_new.sh -w factoryparam -b your_i2c_bus_number
All parameters restored to factory default values.
This operation will erase the system flash and rewrite it. Please ensure that the power is not interrupted during the operation.
Additionally, it is recommended not to perform frequent factoryparam operations.
9.2.11 paramsave
./mv_mipi_i2c_new.sh -w paramsave -b your_i2c_bus_number
Save all parameters to flash, and they will not be lost when power off.
This operation will erase the system flash and rewrite it. Please ensure that the power is not interrupted during the operation.
Additionally, it is recommended not to perform frequent paramsave operations.
9.2.12 reboot
./mv_mipi_i2c_new.sh -w reboot -b your_i2c_bus_number
Reboot the camera.
9.2.13 i2caddr
./mv_mipi_i2c_new.sh -w i2caddr [new] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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 .
9.2.14 slavemode
./mv_mipi_i2c_new.sh -w slavemode [0/1] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.2.15 minwh
./mv_mipi_i2c_new.sh -r minwh -b your_i2c_bus_number
Get the minimum width and height supported by the camera.
9.2.16 temp
./mv_mipi_i2c_new.sh -r temp -b your_i2c_bus_number
For cameras that support temperature sensors, obtain the temperature inside the camera chip.
9.2.17 minfps
./mv_mipi_i2c_new.sh -r minfps -b your_i2c_bus_number
Read the minimum frame rate supported by the current module.
9.3 Image Acquisition
9.3.1 imgacq
./mv_mipi_i2c_new.sh -w imgacq [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.
9.3.2 trgmode*
./mv_mipi_i2c_new.sh -w trgmode [0,2] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.3.3 trgsrc*
./mv_mipi_i2c_new.sh -w trgsrc [0,1] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r trgsrc -b your_i2c_bus_number
| value | description |
|---|---|
| 0 | Software trigger |
| 1 | Hardware trigger |
9.3.4 trgnum*
./mv_mipi_i2c_new.sh -w trgnum [1,255] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r trgnum -b your_i2c_bus_number
The number of image frames output by one trigger signal in trigger mode.
9.3.5 trginterval*
./mv_mipi_i2c_new.sh -w trginterval [us] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r trginterval -b your_i2c_bus_number
Trigger interval in normal trigger mode, in microseconds. Range:[0.0xFFFFFF].
9.3.6 trgcycle
./mv_mipi_i2c_new.sh -r trgcycle -b your_i2c_bus_number
Reads the lowest trigger cycle in the current trigger mode.
9.3.7 trgone
./mv_mipi_i2c_new.sh -w trgone -b your_i2c_bus_number
Software trigger command.One execution will perform a soft trigger.
9.3.8 trgcount
./mv_mipi_i2c_new.sh -r trgcount -b your_i2c_bus_number
Trigger count statistics.
Get the total number of triggers and the number of trigger loss.
./mv_mipi_i2c_new.sh -w trgcountclr -b your_i2c_bus_number
Clear trigger count.
9.3.9 framecount
./mv_mipi_i2c_new.sh -r 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.
9.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.
9.4.1 trgdelay*
./mv_mipi_i2c_new.sh -r trgdelay -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgdelay [us] -b your_i2c_bus_number
Trigger delay, effective under both soft trigger and hard trigger mode.
range: 0 to 1000000 (unit: microsecond)
9.4.2 trgedge*
./mv_mipi_i2c_new.sh -r trgedge -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgedge [0,1] -b your_i2c_bus_number
Effective trigger edge in hard trigger mode.
| value | description |
|---|---|
| 0 | Rising edge |
| 1 | Falling edge |
9.4.3 trgfilter_enable*
./mv_mipi_i2c_new.sh -r trgfilter_enable -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgfilter_enable [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 |
9.4.4 trgfilter_time*
./mv_mipi_i2c_new.sh -r trgfilter_time -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgfilter_time [us] -b your_i2c_bus_number
Trigger signal filtering window width.
range: 1 to 1000000 (unit: microsecond)
9.4.5 trgexp_delay*
./mv_mipi_i2c_new.sh -r trgexp_delay -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgexp_delay [us] -b your_i2c_bus_number
Exposure delay, i.e. the time to turn on the Strobe signal in advance.
range: 0 to 1000000 (unit: microsecond)
The difference between trgexp_delay and trgdelay, see manual for details.
9.4.6 gpios_status
./mv_mipi_i2c_new.sh -r gpios_status -b your_i2c_bus_number
Get TriggerIN_IO, OUT_IO1 and OUT_IO2 status.
9.4.7 outio1_mode
./mv_mipi_i2c_new.sh -r outio1_mode -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio1_mode [0,1] -b your_i2c_bus_number
| value | description |
|---|---|
| 0 | strobe |
| 1 | user out |
strobe: High level active.
user out: defined by outio1_usr.
9.4.8 outio1_usr
./mv_mipi_i2c_new.sh -r outio1_usr -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio1_usr [0,1] -b your_i2c_bus_number
| value | description |
|---|---|
| 0 | low |
| 1 | high |
9.4.9 outio1_rvs
./mv_mipi_i2c_new.sh -r outio1_rvs -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio1_rvs [0,1] -b your_i2c_bus_number
Reverse OUT_IO1 high and low levels if set to 1.
9.4.10 outio2_mode
./mv_mipi_i2c_new.sh -r outio2_mode -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio2_mode [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).
9.4.11 outio2_usr
./mv_mipi_i2c_new.sh -r outio2_usr -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio2_usr [0,1] -b your_i2c_bus_number
| value | description |
|---|---|
| 0 | low |
| 1 | high |
9.4.12 outio2_rvs
./mv_mipi_i2c_new.sh -r outio2_rvs -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w outio2_rvs [0,1] -b your_i2c_bus_number
Reverse OUT_IO1 high and low levels if set to 1.
9.5 Image Features
9.5.1 maxwh
./mv_mipi_i2c_new.sh -r maxwh -b your_i2c_bus_number
Get the maximum supported resolution of the sensor.
9.5.2 maxfps
./mv_mipi_i2c_new.sh -r 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.
9.5.3 fps*
./mv_mipi_i2c_new.sh -w fps [framerate] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.5.4 fps_ex*
./mv_mipi_i2c_new.sh -w fps_ex [framerate] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r fps_ex -b your_i2c_bus_number
Extended functionality of fps: fps_ex supports a precision of up to 1/10,000, primarily for more accurate exposure time control in long exposure mode.
9.5.5 roi*
./mv_mipi_i2c_new.sh -w roi [x] [y] [width] [height] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.5.6 imgdir
./mv_mipi_i2c_new.sh -w imgdir [0,3] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.5.7 pixelformat
./mv_mipi_i2c_new.sh -w pixelformat [0,2] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.5.8 blacklevel
./mv_mipi_i2c_new.sh -w blacklevel [blacklevel] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r blacklevel -b your_i2c_bus_number
This black level value will be set directly to the sensor.
9.5.9 blcmode
./mv_mipi_i2c_new.sh -w blcmode [0/1] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r blcmode -b your_i2c_bus_number
Black level calibration modes:
0: Sensor automatic calibration or use default black level.
1: Manually specify black level.
9.5.10 testimg
./mv_mipi_i2c_new.sh -w testimg [0,2] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r testimg -b your_i2c_bus_number
| value | description |
|---|---|
| 0 | Normal image |
| 1 | Test image 1 |
| 2 | Test image 2 |
9.5.11 readmode*
./mv_mipi_i2c_new.sh -w readmode [0/1/2] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r readmode -b your_i2c_bus_number
Read mode:
0: Normal
1: Binning
2: Subsampling
9.5.12 lanenum*
./mv_mipi_i2c_new.sh -w lanenum [2/4] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r lanenum -b your_i2c_bus_number
For modules that support lane number configuration, use this register to modify the lane number.
9.5.13 mipidatarate
./mv_mipi_i2c_new.sh -r mipidatarate -b your_i2c_bus_number
The MIPI datarate for each lane, measured in Kbps.
9.5.14 osdmode
./mv_mipi_i2c_new.sh -r osdmode -b your_i2c_bus_number
OSD mode bit definition:
0: Disabled
1: Crosshair enabled, overlays a crosshair at the center of the image for assisting with coordinate calibration.
9.6 ISP
9.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.
9.6.2 gamma
./mv_mipi_i2c_new.sh -r gamma -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gamma [gamma] -b your_i2c_bus_number
Range (0,4.0],accurate is 0.01.
For now, gamma only works on 8bit depth image.
9.6.3 gammaenable
./mv_mipi_i2c_new.sh -r gammaenable -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gammaenable [0,1] -b your_i2c_bus_number
Enable/Disable gamma function.
9.6.4 dpcenable
./mv_mipi_i2c_new.sh -r dpcenable -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w dpcenable [0,1] -b your_i2c_bus_number
Enable/Disable DPC(Defect Point Correction) function.
9.6.5 lutenable
./mv_mipi_i2c_new.sh -r lutenable -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w lutenable [0,1] -b your_i2c_bus_number
Enable/Disable LUT(Look-Up-Table) function.
9.6.6 lut
./mv_mipi_i2c_new.sh -r lut [lutfilename] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w lut [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.
9.6.7 expmode
./mv_mipi_i2c_new.sh -r expmode -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w expmode [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.
9.6.8 metime
./mv_mipi_i2c_new.sh -w metime [us] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
Unit: microseconds.
9.6.9 gainmode
./mv_mipi_i2c_new.sh -r gainmode -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gainmode [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.
9.6.10 mgain
./mv_mipi_i2c_new.sh -w mgain [gain] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.6.11 aatarget
./mv_mipi_i2c_new.sh -r aatarget -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w aatarget [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.
9.6.12 aemaxtime
./mv_mipi_i2c_new.sh -r aemaxtime -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w aemaxtime [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.
Unit: microseconds.
9.6.13 agmaxgain
./mv_mipi_i2c_new.sh -r agmaxgain -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w agmaxgain [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.
9.6.14 exptime
./mv_mipi_i2c_new.sh -r exptime -b your_i2c_bus_number
Get the current exposure time. This command is valid in any exposure mode.
Unit: microseconds.
9.6.15 curgain
./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number
Gets the current gain. This command is valid in any exposure mode.
9.6.16 aaroienable
./mv_mipi_i2c_new.sh -w aaroienable [0,1] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r aaroienable -b your_i2c_bus_number
Whether to enable AAROI statistics function, not enable means full ROI statistics.
9.6.17 aaroi
./mv_mipi_i2c_new.sh -w aaroi [x] [y] [width] [height] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r 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.
9.6.18 exptime_range
./mv_mipi_i2c_new.sh -r exptime_range -b your_i2c_bus_number
Maximum and minimum exposure time in the current mode.
Unit: microseconds.
9.6.19 aeag_run_once_save
./mv_mipi_i2c_new.sh -w 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:
- Set AE and AG range to MAX.
- Run AE once and AG once.
- Wait 5 seconds.
- Check AE once and AG once result.
- Save the previous result to manual mode.
- Run paramsave,save to flash.
9.6.20 snsreg
./mv_mipi_i2c_new.sh -r snsreg [sensor reg addr] -b your_i2c_bus_number
Read the sensor's register indirectly via the camera controller unit.
9.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.
10 Configuration Method for Typical Application Scenarios:
10.1 Manual Exposure Mode:
./mv_mipi_i2c_new.sh -w expmode 0 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gainmode 0 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w metime exptime_you_want_to_set_us -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w mgain 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_new.sh -r exptime -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number
Note: The maximum exposure time must be strictly less than the reciprocal of the fps.
10.2 Continuous Auto Exposure Mode:
./mv_mipi_i2c_new.sh -w expmode 2 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gainmode 2 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w aatarget brightness_target -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w aemaxtime [16,1000000/fps] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w agmaxgain [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_new.sh -r exptime -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r curgain -b your_i2c_bus_number
10.3 Normal Trigger Mode:
First, stop the image acquisition to enter a state where the trigger mode can be modified:
./mv_mipi_i2c_new.sh -w imgacq 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_new.sh -w trgmode 1 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgsrc 1 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgnum 1 -b your_i2c_bus_number
You may optionally execute the following two commands to set the trigger edge and delay:
./mv_mipi_i2c_new.sh -w trgedge [0,1] -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w trgdelay [us] -b your_i2c_bus_number
After configuration, you can start the image acquisition to accept trigger signals:
./mv_mipi_i2c_new.sh -w imgacq 1 -b your_i2c_bus_number
10.4 Long Exposure Mode
Some models support long exposure times, such as the MV-MIPI-IMX178M, which supports exposure times up to 100 seconds. The usage is as follows:
1. Stop image acquisition.
./mv_mipi_i2c_new.sh -w imgacq 0 -b your_i2c_bus_number
2. Set exposure and gain to manual mode:
./mv_mipi_i2c_new.sh -w expmode 0 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -w gainmode 0 -b your_i2c_bus_number
3. Read the minimum frame rate:
./mv_mipi_i2c_new.sh -r minfps -b your_i2c_bus_number
r minfps @ current setting is 0.0100 fps
4. Set the current frame rate to 0.016:
./mv_mipi_i2c_new.sh -w fps_ex 0.016 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r fps_ex -b your_i2c_bus_number
5. Read the current exposure time range:
./mv_mipi_i2c_new.sh -r exptime_range-b your_i2c_bus_number
6. Set the exposure time:
./mv_mipi_i2c_new.sh -w metime 10000000 -b your_i2c_bus_number
./mv_mipi_i2c_new.sh -r exptime-b your_i2c_bus_number
After completing the above configuration, you can proceed to start capturing images.
Please note that if you need to adjust the frame rate during the image acquisition process, you must first stop the acquisition before making the changes.
After stopping the acquisition, the camera will still complete the capture of the current frame.
The newly set parameters will only take effect afterward.