將OV7725+FIFO接到Blackfin531非同步記憶體匯流排上
OV7725+FIFO
AL422B的控制流程
影像進入FIFO的部分利用VSYNC、WRST、WEN來控制,這部分使用GPIO
影像從FIFO讀入DSP記憶體的部分利用D0~D7、RRST、OE、RCK接非同步記憶體介面來達成
SCL、SDA控制CMOS SCCB部分以GPIO模擬達成
XCLK利用Timer產生PWM訊號當作Clock
Num.
|
OV7725+FIFO
|
BF531
|
Num.
|
OV7725+FIFO
|
BF531
|
1
|
VCC
|
VCC3
|
11
|
RCLK
|
ARE
|
2
|
GND
|
GND
|
12
|
GND
|
GND
|
3
|
SCL
|
PF11
|
13
|
D0
|
PD0
|
4
|
SDA
|
PF10
|
14
|
D1
|
PD1
|
5
|
VSYNC
|
PF0
|
15
|
D2
|
PD2
|
6
|
WRST
|
PF2
|
16
|
D3
|
PD3
|
7
|
WEN
|
PF1
|
17
|
D4
|
PD4
|
8
|
XCLK
|
TMR2
|
18
|
D5
|
PD5
|
9
|
RRST
|
PA19
|
19
|
D6
|
PD6
|
10
|
OE
|
AMS2
|
20
|
D7
|
PD7
|
程式流程
先將FIFO write disable,write reset,等到Frame出現打開write enable,抓完一個Frame後write disable
WEN_OFF
WRST_OFF
Delay_us(1);
WRST_ON
while(VSYNC);
while(!(VSYNC));
WEN_ON
while(VSYNC);
while(!(VSYNC));
WEN_OFF
讀取位置0x20200000進行read reset,讀取位置0x20280000將FIFO資料搬回記憶體
FIFO=(unsigned char *)0x20200000;
i=*FIFO;
FIFO=(unsigned char *)0x20280000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima[i][j]=*FIFO;
i=*FIFO;
FIFO=(unsigned char *)0x20280000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima[i][j]=*FIFO;
增加第二組OV7725+FIFO
Num.
|
OV7725+FIFO
|
BF531
|
Num.
|
OV7725+FIFO
|
BF531
|
1
|
VCC
|
VCC3
|
11
|
RCLK
|
ARE
|
2
|
GND
|
GND
|
12
|
GND
|
GND
|
3
|
SCL
|
PF11
|
13
|
D0
|
PD0
|
4
|
SDA
|
PF10
|
14
|
D1
|
PD1
|
5
|
VSYNC2
|
PF3
|
15
|
D2
|
PD2
|
6
|
WRST
|
PF2
|
16
|
D3
|
PD3
|
7
|
WEN2
|
PF4
|
17
|
D4
|
PD4
|
8
|
XCLK
|
TMR2
|
18
|
D5
|
PD5
|
9
|
RRST
|
PA19
|
19
|
D6
|
PD6
|
10
|
OE
|
AMS3
|
20
|
D7
|
PD7
|
程式流程
先將兩組FIFO write disable,同時write reset,等到CMOS1 Frame出現打開FIFO1 write enable,抓完Frame1後FIFO1 write disable
WEN_OFF
WEN2_OFF
WRST_OFF
Delay_us(1);
WRST_ON
while(VSYNC);
while(!(VSYNC));
WEN_ON
while(VSYNC);
while(!(VSYNC));
WEN_OFF
WEN2_OFF
WRST_OFF
Delay_us(1);
WRST_ON
while(VSYNC);
while(!(VSYNC));
WEN_ON
while(VSYNC);
while(!(VSYNC));
WEN_OFF
等到CMOS2 Frame出現打開FIFO2 write enable,抓完Frame2後FIFO2 write disable
while(VSYNC2);
while(!(VSYNC2));
WEN2_ON
while(VSYNC2);
while(!(VSYNC2));
WEN2_OFFwhile(!(VSYNC2));
WEN2_ON
while(VSYNC2);
while(!(VSYNC2));
讀取位置0x20200000進行read reset,讀取位置0x20280000將FIFO資料搬回記憶體
FIFO=(unsigned char *)0x20200000;
i=*FIFO;
FIFO=(unsigned char *)0x20280000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima[i][j]=*FIFO;
i=*FIFO;
FIFO=(unsigned char *)0x20280000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima[i][j]=*FIFO;
讀取位置0x20300000進行read reset,讀取位置0x20380000將FIFO資料搬回記憶體
FIFO=(unsigned char *)0x20300000;
i=*FIFO;
FIFO=(unsigned char *)0x20380000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima2[i][j]=*FIFO;
i=*FIFO;
FIFO=(unsigned char *)0x20380000;
for(i=0;i<640;i++)
for(j=0;j<480;j++)
ima2[i][j]=*FIFO;
沒有留言:
張貼留言