Difference between revisions of "VEYE-MIPI-290/327 i2c/"

From wiki_veye
Jump to navigation Jump to search
(8 intermediate revisions by 2 users not shown)
Line 38: Line 38:
 
./veye_mipi_i2c.sh
 
./veye_mipi_i2c.sh
  
Usage: ./veye_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -b bus
+
Usage: ./veye_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -b bus -d i2caddr
  
 
options:
 
options:
Line 54: Line 54:
 
-b [i2c bus num] i2c bus number
 
-b [i2c bus num] i2c bus number
  
 +
-d [i2c addr] i2c device address
 
=== i2c bus number on different board ===
 
=== i2c bus number on different board ===
 
Please refer to the following article to determine which -b parameter you need to use.
 
Please refer to the following article to determine which -b parameter you need to use.
Line 201: Line 202:
 
agc indicated max gain of AE mode.
 
agc indicated max gain of AE mode.
  
Agc stands for auto gain control. It is a part of auto exposure, in different light intensity, will try to adjust the gain of sensor to achieve the same image brightness.
+
Agc stands for auto gain control. It is a part of auto exposure, in different light intensity, will try to adjust the gain of sensor to achieve the same image brightness. 0xC by default.
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
Line 219: Line 220:
 
{| class="wikitable"
 
{| class="wikitable"
 
!value
 
!value
!description
+
!minimum fps
 
|-
 
|-
 
|0x01
 
|0x01
Line 310: Line 311:
 
|}
 
|}
 
=====mshutter=====
 
=====mshutter=====
close AE, use manual shutter
+
Automatic exposure, manual exposure mode selection and configuration.
  
 
<code>./veye_mipi_i2c.sh -r -f mshutter</code>
 
<code>./veye_mipi_i2c.sh -r -f mshutter</code>
Line 486: Line 487:
 
|0x0
 
|0x0
 
| sharppen disable
 
| sharppen disable
 +
|-
 +
|0x1
 +
| sharppen enable
 +
|}default: 0x1
 +
 +
param2: sharppen strength, range [0x0-0xA]
 +
=====wdrsharppen=====
 +
<code>./veye_mipi_i2c.sh -r -f wdrsharppen</code>
 +
 +
<code>./veye_mipi_i2c.sh -w -f wdrsharppen -p1 [val1] -p2 [value]</code>
 +
 +
sharppeness setting on DOL WDR mode.
 +
{| class="wikitable"
 +
! param1 value
 +
!description
 +
|-
 +
|0x0
 +
|sharppen disable
 
|-
 
|-
 
|0x1
 
|0x1
Line 570: Line 589:
 
Note: only supported on hdver >= 0x4
 
Note: only supported on hdver >= 0x4
  
<br />
+
=== New function list ===
 +
The following new features are only supported in camera's firmware versions with ''release time'' later than 2022-11-22.
 +
 
 +
===== paramsave =====
 +
<code>./veye_mipi_i2c.sh -w -f paramsave</code>
 +
 
 +
Save isp-related parameters to flash.
 +
 
 +
===== new_expmode =====
 +
<code>./veye_mipi_i2c.sh -r -f new_expmode</code>
 +
 
 +
<code>./veye_mipi_i2c.sh -w -f new_expmode -p1 [0/1]</code>
 +
 
 +
Whether the new version of manual exposure is enabled.
 +
 
 +
If the new version manual exposure is enabled, then:
 +
 
 +
# The original ''mshutter'' command is no longer in effect, ''new_mshutter'' takes effect.
 +
# gain (agc) from automatic mode also changed to manual mode, ''new_mgain'' takes effect.
 +
 
 +
===== new_mshutter =====
 +
<code>./veye_mipi_i2c.sh -r -f new_mshutter</code>
 +
 
 +
<code>./veye_mipi_i2c.sh -w -f new_mshutter -p1 1000</code>
 +
 
 +
New version of manual exposure time configuration, in us in the range [1,1000000].
 +
 
 +
Since the sensor can not support accurate exposure time of 1us, it is recommended to read it for confirmation after configuration.
 +
 
 +
===== new_mgain =====
 +
<code>./veye_mipi_i2c.sh -r -f new_mgain</code>
 +
 
 +
<code>./veye_mipi_i2c.sh -w -f new_mgain -p1 2.1</code>
 +
 
 +
The new version manual gain, depending on the sensor, accurate to 0.1dB or 0.3dB.
 +
 
 +
===== auto_shutter_max =====
 +
This feature is only supported in versions with ''release time'' later than 2022-12-09.
 +
 
 +
Configure the upper limit of auto exposure when '''mshutter''' is configured to auto.
 +
 
 +
<code>./veye_mipi_i2c.sh -r -f auto_shutter_max</code>
 +
 
 +
<code>./veye_mipi_i2c.sh -w -f auto_shutter_max -p1 1000</code>
 +
 
 +
in us in the range [1,1000000/fps].
  
==== 新功能 ====
+
Since the sensor can not support accurate exposure time of 1us, it is recommended to read it for confirmation after configuration.
下面的新功能,只有release time晚于2022-11-22的版本才支持。
 

Revision as of 15:30, 16 October 2023

查看中文

VEYE-MIPI-X I2C.sh user guide

1 Overview

There are 4 files: camera_i2c_config、i2c_read、i2c_write、veye_mipi_i2c.sh

2 RaspberryPi Only, Set IO config

Running

./enable_i2c_vc.sh

./camera_i2c_config

first,it will config IO pin.

Then you can run veye_mipi_i2c.sh.

2.1 camera_i2c_config USAGE

  • for standard RPI, just run

./camera_i2c_config

  • for RPI Computer Module

./camera_i2c_config [cameranum]

cameranum description
0 CAM0
1 CAM1

3 veye_mipi_i2c.sh USAGE

./veye_mipi_i2c.sh

Usage: ./veye_mipi_i2c.sh [-r/w] [-f] function name -p1 param1 -p2 param2 -b bus -d i2caddr

options:

-r read

-w write

-f [function name] function name

-p1 [param1] param1 of each function

-p2 [param1] param2 of each function

-b [i2c bus num] i2c bus number

-d [i2c addr] i2c device address

4 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

5 Functions list

5.1 devid
./veye_mipi_i2c.sh -r -f devid
value description
0x06 VEYE-MIPI-X series,IMX327 IMX462 IMX385
5.2 hdver
./veye_mipi_i2c.sh -r -f hdver
value description
0xXX Version

The isp fireware release time will also be printed.

5.3 sensorid

./veye_mipi_i2c.sh -r -f sensorid

Print sensor type and board information.

5.4 wdrmode
./veye_mipi_i2c.sh -r -f wdrmode
./veye_mipi_i2c.sh -w -f wdrmode -p1 [value]
value description
0x00 Back Light Mode OFF
0x01 Back Light Mode ON, LOW
0x02 Back Light Mode ON, HIGH
0x03 DOL WDR Enable
5.5 videoformat
./veye_mipi_i2c.sh -r -f videoformat
./veye_mipi_i2c.sh -w -f videoformat -p1 [value]

WARNING:THIS FUNCTION MUST BE CALLED BEFORE ANY video applications

value description frame rate
PAL PAL(50Hz) 25fps
NTSC NTSC(60Hz) 30fps
5.6 mirrormode
./veye_mipi_i2c.sh -r -f mirrormode
./veye_mipi_i2c.sh -w -f mirrormode -p1 [value]
value description
0x00 Normal
0x01 Mirror
0x02 V-Flip
0x03 Mirror And V-Flip(180 Degree Rotate)
5.7 denoise
./veye_mipi_i2c.sh -r -f denoise
./veye_mipi_i2c.sh -w -f denoise -p1 [value]
value description
0x00 NR 2D Mode = OFF; NR 3D Mode = OFF
0x01 NR 2D Mode = OFF; NR 3D Mode = LOW
0x02 NR 2D Mode = OFF; NR 3D Mode = MIDDLE
0x03 NR 2D Mode = OFF; NR 3D Mode = HIGH
0x04 NR 2D Mode = LOW; NR 3D Mode = OFF
0x05 NR 2D Mode = LOW; NR 3D Mode = LOW
0x06 NR 2D Mode = LOW; NR 3D Mode = MIDDLE
0x07 NR 2D Mode = LOW; NR 3D Mode = HIGH
0x08 NR 2D Mode =MIDDLE; NR 3D Mode = OFF
0x09 NR 2D Mode =MIDDLE; NR 3D Mode = LOW
0x0A NR 2D Mode = MIDDLE; NR 3D Mode = MIDDLE
0x0B NR 2D Mode = MIDDLE; NR 3D Mode = HIGH
0x0C NR 2D Mode =HIGH; NR 3D Mode = OFF
0x0D NR 2D Mode =HIGH; NR 3D Mode = LOW
0x0E NR 2D Mode = HIGH; NR 3D Mode = MIDDLE
0x0F NR 2D Mode = HIGH; NR 3D Mode = HIGH
5.8 agc
./veye_mipi_i2c.sh -r -f agc
./veye_mipi_i2c.sh -w -f agc -p1 [value]

agc indicated max gain of AE mode.

Agc stands for auto gain control. It is a part of auto exposure, in different light intensity, will try to adjust the gain of sensor to achieve the same image brightness. 0xC by default.

value description
0x00~0x0F AGC intensity
5.9 lowlight
./veye_mipi_i2c.sh -r -f lowlight
./veye_mipi_i2c.sh -w -f lowlight -p1 [value]

In the case of low illuminance, the camera module can prolong the exposure time and reduce the frame rate by configuring this parameter to achieve a better effect of low illuminance.

Note that the set value is the minimum frame rate value and the actual frame rate value is affected by the automatic exposure algorithm.

Note that it is not suitable for use in a sports scene.

value minimum fps
0x01 1/2*(FRAME RATE)
0x03 1/4*(FRAME RATE)
0x05 1/6*(FRAME RATE)
0x07 1/8*(FRAME RATE)
0x09 1/10*(FRAME RATE)
0x0B 1/15*(FRAME RATE)
0x0D 1/20*(FRAME RATE)
0x0F 1/25*(FRAME RATE)
0x11 1/30*(FRAME RATE)
0x00 Fixed frame rate (25/30)
5.10 daynightmode
./veye_mipi_i2c.sh -r -f daynightmode
./veye_mipi_i2c.sh -w -f daynightmode -p1 [value]
value description
0xFF Color Mode
0xFE Black&White Mode
0xFC Trigger Mode

IR-CUT (Infrared cut-off filter) is a mechanical shutter design. It is placed between the lens and the image sensor, and is controlled by a motor or an electromagnet.

IR-CUT has two status: Block or Deliver the infrared.

  • Color Mode

Image is Color Mode and IR_CUT status Block infrared.

  • Black&White Mode

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

  • Trigger Mode

Trigger pin : J3 pin1 of VEYE-MIPI-327 or J2 pin1 of VEYE-MIPI-IMX327S.

Trigger pin High(3.3~12V),Image is Black&White Mode and IR-CUT status Deliver infrared.

Trigger pin Low(GND),Image is Color Mode and IR-CUT status Bolck infrared.

5.11 ircutdir

./veye_mipi_i2c.sh -r -f ircutdir

./veye_mipi_i2c.sh -w -f ircutdir -p1 [value]

IR_CUT pins control direction. value could be 0 or 1.

5.12 irtrigger

./veye_mipi_i2c.sh -r -f irtrigger

./veye_mipi_i2c.sh -w -f irtrigger -p1 [value]

Polarity setting of the day/night switching external trigger mode pin.

value description
0x0 default value,refer to datasheet of different boards.
0x1 Reversed.
5.13 mshutter

Automatic exposure, manual exposure mode selection and configuration.

./veye_mipi_i2c.sh -r -f mshutter

./veye_mipi_i2c.sh -w -f mshutter -p1 [value]

value is exposure time(seconds)

If value is greater than or equal to 0x4B, it will reduce framerate.

value description
NTSC(PAL)
0x40 auto mode
0x41 1/30 (25)
0x42 1/60(50)
0x43 1/120(100)
0x44 1/240(200)
0x45 1/480(400)
0x46 1/1000
0x47 1/2000
0x48 1/5000
0x49 1/10000
0x4A 1/50000
0x4B 1/30 (25) *2
0x4C 1/30 (25) *4
0x4D 1/30 (25) *6
0x4E 1/30 (25) *8
0x4F 1/30 (25) *10
0x50 1/30 (25) *15
0x51 1/30 (25) *20
0x52 1/30 (25) *25
0x53 1/30 (25) *30
5.14 cameramode

Requirements:hdver >= 0x3

./veye_mipi_i2c.sh -r -f cameramode

./veye_mipi_i2c.sh -w -f cameramode -p1 [value]

value description
0x0 Stream mode
0x1 Capture mode

Stream mode: stream output

Caputre mode: output the next frame each capture cmd.

5.15 nodf

Requirements:hdver >= 0x3, effective in Stream mode

Number of dropped frames

It is a method of framerate control, output one frame,discard nodf frames,output next frame, and so on.

actual framerate = original framerate /(1+nodf)

For example,if the original framerate is 30fps, set nodf to 2, then actual framerate is 10fps.

./veye_mipi_i2c.sh -r -f nodf

./veye_mipi_i2c.sh -w -f nodf -p1 [value]

ntof range is [0-0xFF], default 0.

5.16 capture

Requirements:hdver >= 0x3, effective in Capture mode

./veye_mipi_i2c.sh -w -f capture

Output the next frame. This cmd does not interfere the sensor, it just output the next frame (the newest frame).

So it is not trigger mode, there will be a delay[0,1/framerate] between the cmd and the frame exposure.

It is applicable to those that do not require a high level of real-time performance.

5.17 csienable

Requirements:hdver >= 0x3

./veye_mipi_i2c.sh -r -f csienable

./veye_mipi_i2c.sh -w -f csienable -p1 [value]

value description
0x0 suspend csi output
0x1 enable csi output

default: 0x1

Note: This is not low power mode, the camera is still working.

5.18 brightness

./veye_mipi_i2c.sh -r -f brightness

./veye_mipi_i2c.sh -w -f brightness -p1 0x32

AE Target Brightness,rang: [0,0x64]

5.19 aespeed

./veye_mipi_i2c.sh -r -f aespeed

./veye_mipi_i2c.sh -w -f aespeed -p1 0x32 -p2 0x32

AE adjust speed,p1 is agc speed, p2 is shutter speed,Slow to Fast: [0,0x64]

5.20 contrast

./veye_mipi_i2c.sh -r -f contrast

./veye_mipi_i2c.sh -w -f contrast -p1 0x32

Contrast,range: [0,0xFF],default: 0x80.

5.21 saturation

./veye_mipi_i2c.sh -r -f saturation

./veye_mipi_i2c.sh -w -f saturation -p1 0x32

Saturation, range: [0,0x64].

5.22 sharppen

./veye_mipi_i2c.sh -r -f sharppen

./veye_mipi_i2c.sh -w -f sharppen -p1 [val1] -p2 [value]

param1 value description
0x0 sharppen disable
0x1 sharppen enable

default: 0x1

param2: sharppen strength, range [0x0-0xA]

5.23 wdrsharppen

./veye_mipi_i2c.sh -r -f wdrsharppen

./veye_mipi_i2c.sh -w -f wdrsharppen -p1 [val1] -p2 [value]

sharppeness setting on DOL WDR mode.

param1 value description
0x0 sharppen disable
0x1 sharppen enable

default: 0x1

param2: sharppen strength, range [0x0-0xA]

5.24 wdrtargetbr

./veye_mipi_i2c.sh -r -f wdrtargetbr

./veye_mipi_i2c.sh -w -f wdrtargetbr -p1 0x80

The overall AE target value in WDR mode.

Takes effect in WDR mode. range: [0-0xFF], default : 0x80.

5.25 wdrbtargetbr

./veye_mipi_i2c.sh -r -f wdrbtargetbr

./veye_mipi_i2c.sh -w -f wdrbtargetbr -p1 0x80

The AE target value of the bright area in WDR mode.

Takes effect in WDR mode. range: [0-0xFF], default : 0x80.

5.26 boardmodel

./veye_mipi_i2c.sh -r -f boardmodel

Requirment: hdver >=4.

Read the board number of the board, which can be used to distinguish between VEYE-MIPI-327 and VEYE-MIPI-IMX327S.

5.27 i2cwen

./veye_mipi_i2c.sh -r -f i2cwen

./veye_mipi_i2c.sh -w -f i2cwen -p1 [0/1]

Requirment: hdver >=4.

Whether to enable the i2C write register function of the camera, enabled by default. It is used for register write protection in special cases.

5.28 i2cauxenable

./veye_mipi_i2c.sh -r -f i2cauxenable

./veye_mipi_i2c.sh -w -f i2cauxenable -p1 [0/1]

Requirment: hdver >=4.

Whether to enable auxiliary i2C. If enable auxiliary i2C, the primary i2C on the FFC cable cannot be used. Used for bus conflict resolution in special cases.

5.29 awbgain

./veye_mipi_i2c.sh -r -f awbgain

Read the Rgain and Bgain of the current white balance status , parameter range [0,0xFF].

5.30 wbmode

./veye_mipi_i2c.sh -r -f wbmode

./veye_mipi_i2c.sh -w -f wbmode -p1 [value]

White balance mode setting.

value description
0x18 Auto white balance
0x1B Manual white balance
5.31 mwbgain

./veye_mipi_i2c.sh -r -f mwbgain

./veye_mipi_i2c.sh -w -f mwbgain -p1 [rgain] -p2 [bgain]

Rgain and Bgain setting in manual white balance mode.arameter range [0,0xFF].

5.32 yuvseq

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

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

./veye_mipi_i2c.sh -r -f yuvseq

Set yuv seq of camera.

Note: only supported on hdver >= 0x4

6 New function list

The following new features are only supported in camera's firmware versions with release time later than 2022-11-22.

6.1 paramsave

./veye_mipi_i2c.sh -w -f paramsave

Save isp-related parameters to flash.

6.2 new_expmode

./veye_mipi_i2c.sh -r -f new_expmode

./veye_mipi_i2c.sh -w -f new_expmode -p1 [0/1]

Whether the new version of manual exposure is enabled.

If the new version manual exposure is enabled, then:

  1. The original mshutter command is no longer in effect, new_mshutter takes effect.
  2. gain (agc) from automatic mode also changed to manual mode, new_mgain takes effect.
6.3 new_mshutter

./veye_mipi_i2c.sh -r -f new_mshutter

./veye_mipi_i2c.sh -w -f new_mshutter -p1 1000

New version of manual exposure time configuration, in us in the range [1,1000000].

Since the sensor can not support accurate exposure time of 1us, it is recommended to read it for confirmation after configuration.

6.4 new_mgain

./veye_mipi_i2c.sh -r -f new_mgain

./veye_mipi_i2c.sh -w -f new_mgain -p1 2.1

The new version manual gain, depending on the sensor, accurate to 0.1dB or 0.3dB.

6.5 auto_shutter_max

This feature is only supported in versions with release time later than 2022-12-09.

Configure the upper limit of auto exposure when mshutter is configured to auto.

./veye_mipi_i2c.sh -r -f auto_shutter_max

./veye_mipi_i2c.sh -w -f auto_shutter_max -p1 1000

in us in the range [1,1000000/fps].

Since the sensor can not support accurate exposure time of 1us, it is recommended to read it for confirmation after configuration.