MT9M021/MT9m031在低光照度下和捕捉移動場景有非常優異的表現,屬於近紅外攝像頭,
S1:
Aptina's MT9M021/MT9M031 sensor is capable of a maximum resolution of 1280 x 960 at up to 45fps, or it may be configured to run 720p at 60fps。
Registers y_addr_start, x_addr_start, y_addr_end, and x_addr_end are used to specify the image window. The minimum value for x_addr_start is 0 and the maximum value for x_addr_end is 1279. The minimum y_addr_start and maximum y_addr_end are 0 and 975, respectively.
S2:
row_time = (active_pixels + horizontal_blank_pixels)/ PIXCLK_frequency
S3:
The MT9M021/MT9M031’s outputs can be tri-stated with the OE_BAR pin. Before the external pin can be used to control output enable, set register R0x301A[6] = 0 to disable the output drivers. Then set R0x301A[8] = 1 to enable the input pins (OE_BAR, TRIGGER, and STANDBY). Driving OE_BAR low will enable the output drivers, while driving it high will tri-state the parallel output pins. The parallel outputs can also be tri-stated by setting R0x301A[7] = 0.
S4:
芯片內部有一個PLL用來生成內部需要的時鍾,最大可以輸出pixel rate 74.25Mp/s, 需要一個外部時鍾輸入時鍾,范圍是6- 50 Mhz都行.
The MT9M021/MT9M031 works in master (video), trigger (single frame), or Auto Trig- ger modes. In master mode, the sensor generates the integration and readout timing. In trigger mode, it accepts an external trigger to start exposure, then generates the exposure and readout timing. The exposure time is programmed through the two- wire serial interface for both modes.
S5:
• Window Control Configurable window size and blanking times allow a wide range of resolutions and frame rates. Digital binning and skipping modes are supported, as are vertical and horizontal mirror operations. • Context Switching Context switching may be used to rapidly switch between two sets of register values. Refer to the MT9M021/MT9M031 Developer Guide for a complete set of context swit- chable registers. • Gain The MT9M021/MT9M031 Global Shutter sensor can be configured for analog gain of up to 8x, and digital gain of up to 8x. • Automatic Exposure Control The integrated automatic exposure control may be used to ensure optimal settings of exposure and gain are computed and updated every other frame. Refer to the MT9M021/MT9M031 Developer Guide for more details. • HiSPi The MT9M021/MT9M031 Global Shutter image sensor supports two or three lanes of Streaming-SP or Packetized-SP protocols of Aptina's High-Speed Serial Pixel Inter- face. • PLL An on chip PLL provides reference clock flexibility and supports spread spectrum sources for improved EMI performance. • Reset The MT9M021/MT9M031 may be reset by a register write, or by a dedicated input pin. • Output Enable The MT9M021/MT9M031 output pins may be tri-stated using a dedicated output enable pin. • Temperature Sensor • Black Level Correction • Row Noise Correction • Column Correction • Test Patterns Several test patterns may be enabled for debug purposes. These include a solid color, color bar, fade to grey, and a walking 1s test pattern.
S6:
MT9M021 有兩種輸出接口,一種是Parallel Pixel Data Interface,另一種是HISPI 接口(High-Speed Serial Pixel Inter- face, the MT9M021/MT9M031 supports only 2 or 3 lane HiSPi。 從原理圖上的連接來看,我們用前者作為輸出:
S7:
初始化MT9M021 sensor ,仿照mdk_14.10.1_general/mdk/common/components/CifVxplat/leon/APT_A1000_480p60.h 。
i2c 命令發送仿照:CifGeneric.c:I2CRegConfiguration函數
在一次看datashheet 和 program guide, 有新的收獲,繼續總結:
S8: Frame Time
The pixel clock (PIXCLK) represents the time needed to sample one pixel from the array.捕捉一個像素占的時間.
一行時間表示的是傳輸一行的第一個像素點到下一行第一個像素點的時間.
FV: Frame Valid, LV: Line Valid. 當FV和LV都是高的時候,Dout傳輸的才是有效的數據,從上圖中可以看出.
{0x3002, 0x0078}, // Y_ADDR_START {0x3004, 0x0000}, // X_ADDR_START {0x3006, 0x0347}, // Y_ADDR_END {0x3008, 0x04FF}, // X_ADDR_END {0x300A, 0x02EB}, // FRAME_LENGTH_LINES {0x300C, 0x0672}, // LINE_LENGTH_PCK
上面是實際情況設置的值:
A = 0x04FF - 0x0000 +1 =1280 Active data time是圖像的寬度,一行的有效數據 A(time) = 1280/74.25Mhz = 17.23us
P1, P2從FIGURE5能看出每一幀的開始與結束又一段固定的空白時間,這里是6pixclk
Q是水平空白時間 = 0x672 - A = 370 可以看到和table5的默認值是一樣的.
A+ Q就是實際一行的時間 = LINE LENGTH PCK
V:垂直空白時間,按照這個公示: FRAME LENGTH LINES和LINE LENGTH PCK是類似的是由實際的active lines + blank lines構成. 結合Figure4圖來看.
V = (0x300A - (0x3006 -0x3002 +1)) * (A +Q) = Vertical_blank * Line_length_pck = 1D * 672 = 47859pixel,雖然和表中的不一樣,因為數據不同所以不同,另外表格的公式看的也有些問題. 可以看出這一部分是Figure4中 Vertical blanking + vertical/horizontal blanking.
Nrows * (A + Q) = Frame valid time = (0x3006 -0x3002 +1)) * (A +Q) - Q+ P1 + P2 ,這個表達式最讓人疑惑的就是減去Q(horizontal blanking),參照Figure9可以看出最后一行只有A並沒有Q,所以需要減去一個Q. 這個表示的是V上面 Valid image + Horizontal blanking的數據,
F = Total frame time = V + (Nrows * (A + Q)).
Frame rate = 1/F
S9: Exposure
Coarse integration的解釋見image sensor 積分時間
Coarse Integration Time < Window Height + Vertical Blanking ,就是說曝光時間需要小於FRAME LENGTH LINES,否則一幀的時間不在是用上面那種方式來算,而是見下表:
總的曝光時間是總的coarse曝光時間加上Fine曝光時間,而且這依賴於是否開啟自動曝光AE
t(INT) = t(INTCoarse) + t(INTFine)= (number of lines of integration * line time) + (number of pixels of integration * pixel),
t(INTFine)的最大曝光時間是 line_length_pck - 750.
通常情況下曝光事件不能大於lines per frame(包含blanking lines),這種情況下幀率不受曝光時間影響.
exposure_time = coarse_integration_time × row_time
Master Mode In master mode, the exposure period occurs simultaneously with the frame readout (see Figures 12 and 13). This makes master mode the fastest mode of operation. When expo- sure time is greater than the frame length, the number of vertical blanking rows is increased automatically to accommodate the exposure time
當芯片工作在master模式下時:frame在讀的期間會持續曝光,master是最快的操作模式,當曝光時間比frame length大時,vertical blanking rows會自動增增加緩解曝光時間.
自動曝光(AEC):
自動曝光可以保證在每一幀更新的計算出最佳的曝光和增益設置.寄存器0x3100控制AEC的關閉.當R0x3100[0] =1時,AEC使能,寄存器0x3102設置luma(亮度)值,默認是是0x0500或者是一般.自動曝光的最大范圍在寄存器0x311C中定義,最小范圍在0x311E中定義,最小是一行.曝光控制是根據計算當前幀的Gr像素點的histogram的值得到當前場景的亮度值,然后和理想的狀態值進行比對,最后適當的調整曝光時間和增益.
S10:
S11: