Changes

Jump to navigation Jump to search
Line 297: Line 297:     
Note: script [https://github.com/veyeimaging/mvcam_raspberrypi/tree/main/mv_tools_rpi link].
 
Note: script [https://github.com/veyeimaging/mvcam_raspberrypi/tree/main/mv_tools_rpi link].
<br />
+
====Compiling drivers from source code====
<br />
+
Please refer to: [http://wiki.veye.cc/index.php/Build_drivers_from_source_for_rpi Build drivers from source for rpi].
 +
 
 +
=== Legacy mode manual ===
 +
We store the code for legacy patterns in this [https://github.com/veyeimaging/mvcam_raspberrypi github repository].
 +
 
 +
==== Download the software package ====
 +
<code>git clone <nowiki>https://github.com/veyeimaging/mvcam_raspberrypi.git</nowiki></code>
 +
 
 +
Add executable permissions:
 +
 
 +
<code>chmod +x -R ./mvcam_raspberrypi/</code>
 +
 
 +
==== Software package main content introduction ====
 +
camera_i2c_config:Automatically recognizes different Raspberry Pi board types and controls the power on pins to power the camera.
 +
 
 +
mv_raspicam:Realize image preview, image saving and other functions.
 +
 
 +
mv_mipi_i2c.sh:Scripts for reading and setting camera parameters via i2c protocol.
 +
 
 +
veye_i2c_upgrade:Camera firmware upgrade tool.
 +
 
 +
==== Camera power on ====
 +
<code>./camera_i2c_config</code>
 +
 
 +
When the camera is powered on, try:
 +
 
 +
<code>i2cdetect -y 10</code>
 +
 
 +
The presence of a 0x3b device indicates that the camera is on and the i2c channel is working properly.
 +
 
 +
==== Preview ====
 +
<code>./mv_raspicam -t -1 -roi 0,0,3088,2064 -md 0</code>
 +
 
 +
where -md specifies the pixel data format.
 +
{| class="wikitable"
 +
!-md option
 +
!data type
 +
|-
 +
|0
 +
|8bit Y
 +
|-
 +
|1
 +
|10bit Y
 +
|-
 +
|2
 +
|12bit Y
 +
|}
 +
-roi specifies  the desired ROI size.
 +
 
 +
For sizes larger than 1920 in width, mv_raspicam will first reduce to half the original size of the image  and then send to render.
 +
 
 +
==== Save image ====
 +
<code>./mv_raspicam -t 1000 -roi 0,0,3088,2064 -md 0 -sr 10 -o /dev/shm/y8-3104x2064_%04d.yuv</code>
 +
 
 +
-sr is the interval for storing images, one image is saved every 10 images here.
 +
 
 +
-t 1000, in ms, it means 1 second here.
 +
 
 +
Several files will be saved in the /dev/shm/ directory after completion.
 +
 
 +
==== Tightly aligned image format ====
 +
The data format saved by mv_raspicam is the data format on the MIPS bus, with no empty bit padding between pixels.
 +
 
 +
As an example, in the 12bit Y data format, two pixels are saved in 3 bytes.
 +
{| class="wikitable"
 +
! colspan="8" |Byte3
 +
! colspan="8" |Byte2
 +
! colspan="8" |Byte1
 +
|-
 +
|bit7
 +
|bit6
 +
|bit5
 +
|bit4
 +
|bit3
 +
| bit2
 +
|bit1
 +
|bit0
 +
|bit7
 +
|bit6
 +
|bit5
 +
|bit4
 +
|bit3
 +
|bit2
 +
|bit1
 +
|bit0
 +
|bit7
 +
|bit6
 +
|bit5
 +
|bit4
 +
|bit3
 +
|bit2
 +
|bit1
 +
|bit0
 +
|-
 +
| colspan="12" |Pixel N+1 data
 +
| colspan="12" |Pixel N data
 +
|}
 +
 
 +
==== Image size ====
 +
Buffersize= ALIGN_UP(width*bit_depth/8,32)*ALIGN_UP(height,16)
 +
 
 +
The row buffer size should be 32 bytes aligned; the column buffer size should be 16 bytes aligned.
 +
 
 +
For example, the image size of 3088*2064@8bit is 6406656; the image size of 3088*2064@10bit is 7991808; the image size of 3088*2064@12bit is 9576960.
 +
 
 +
PS. This y8 file can be used with this player: [https://yuv-player-deluxe.software.informer.com/2.6/ YUV Displayer Deluxe].
 +
 
 +
Since the memory requested by Raspberry Pi for the image, the width is 32-align and the height is 16-align, the 3088*2064 image will be saved as 3104*2064 size.
 +
 
 +
==== Trigger mode ====
 +
This section requires the use of mv_mipi_i2c.sh, please refer to the related i2c parameter configuration section below.
 +
 
 +
===== Software trigger mode =====
 +
 
 +
====== Set mode ======
 +
<code>./mv_mipi_i2c.sh -w -f trgmode -p1 1</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgsrc -p1 0</code>
 +
 
 +
====== Set trigger properties ======
 +
You can set the number of triggers, trigger interval, etc.
 +
 
 +
The following settings are for a single trigger of 5 images with an interval of 1 second each.
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgnum -p1 5</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trginterval -p1 1000</code>
 +
====== Start acquisition ======
 +
<code>./mv_raspicam -t -1 -roi 0,0,3088,2064 -md 0</code>
 +
 
 +
====== Perform soft trigger operation ======
 +
In other shell terminals, you can execute the following command multiple times for multiple triggers.
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgone</code>
 +
 
 +
===== Hardware trigger mode =====
 +
The following is an example of using Raspberry Pi GPIO21 as an trigger source with rising edge trigger.
 +
 
 +
You can use the [[Mv mipi i2c.sh user guide|mv_mipi_i2c.sh]] script for other trigger parameter setting.
 +
 
 +
====== Hardware Connection ======
 +
(TODO picture)
 +
 
 +
====== Set mode ======
 +
This time, we use high-speed continuous trigger as an example.
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgmode -p1 2</code>
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgsrc -p1 1</code>
 +
 
 +
====== Set trigger properties ======
 +
The trigger interval is invalid under high-speed continuous triggering. This time trigger 2 images.
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgnum -p1 2</code>
 +
 
 +
Set rising edge trigger
 +
 
 +
<code>./mv_mipi_i2c.sh -w -f trgedge -p1</code>
 +
 
 +
In addition, rich trigger attributes can be set for hard triggering, such as trigger delay, signal filtering, etc.
 +
====== Start acquisition ======
 +
<code>./mv_raspicam -t -1 -roi 0,0,3088,2064 -md 0</code>
 +
 
 +
====== Perform hardware trigger operation ======
 +
<code>python gpio_trigger.py</code>
 +
 
 +
Note: script [https://github.com/veyeimaging/mvcam_raspberrypi/tree/main/mv_tools_rpi link].
 +
===Shell script for parameter configuration===
 +
We provide shell scripts to configure the parameters.
 +
 
 +
[http://wiki.veye.cc/index.php/Mv_mipi_i2c.sh_user_guide mv_mipi_i2c.sh user guide]
 +
===References===
 +
 
 +
*[https://www.raspberrypi.com/documentation/computers/getting-started.html Installation of the Raspberry Pi system]
 +
*[https://www.raspberrypi.com/documentation/accessories/camera.html#libcamera-and-the-legacy-raspicam-camera-stack The difference between Raspberry Pi legacy camera stack and libcamera mode]
 +
 
 +
=== Document History ===
 +
 
 +
* 2022-04-14
 +
 
 +
Release 1st version.

Navigation menu