S03_CH07_AXI_VDMA_OV5640攝像頭采集系統


S03_CH07_AXI_VDMA_OV5640攝像頭采集系統

7.1概述

本章內容和《S03_CH06_AXI_VDMA_OV7725攝像頭采集系統》只是攝像頭采用的分辨率不同,其他原理都一樣,由於在《S03_CH06_AXI_VDMA_OV7725攝像頭采集系統》中詳細介紹了VDMA的原理,如果讀者只是購買了OV5640,可以回到《S03_CH06_AXI_VDMA_OV7725攝像頭采集系統》仔細閱讀VDMA的基礎知識。

7.2 搭建VDMA圖像系統

7.2.1構架方案圖

wps7753.tmp

可以看到VMDA的圖像系統和前面介紹的DMA系統相比非常類似。實際上他們都是屬於DMA系統,只是VDMA在配置完成后,可以無需依賴CPU可以獨立運行,有點類似顯卡的功能了。

7.2.2構BLOCK模塊化設計方案圖

wps7754.tmp

7.3 PS部分

本課程提供了二種方式啟動VDMA,第一種是通過庫函數版本,第二種是通過寄存器版本。寄存器版本主要是驗證我們對VDMA的寄存器掌握情況。庫函數具備更強的功能,和可維護性。和OV7725相比,這里的分辨率設置為1280X720

表6-6-1

#include "sys_intr.h"

#include "xaxivdma.h"

#include "xaxivdma_i.h"

#define VTC_BASEADDR XPAR_MIZ702_VTG_VGA_0_BASEADDR

#define DDR_BASEADDR        0x00000000

//#define UART_BASEADDR       0xe0001000

#define VDMA_BASEADDR       XPAR_AXI_VDMA_0_BASEADDR

#define H_STRIDE            1280

#define H_ACTIVE            1280

#define V_ACTIVE            720

#define COUNTS_PER_SECOND (XPAR_CPU_CORTEXA9_CORE_CLOCK_FREQ_HZ)/64

#define VIDEO_LENGTH  (H_STRIDE*V_ACTIVE)

#define VIDEO_BASEADDR0 DDR_BASEADDR + 0x2000000

#define VIDEO_BASEADDR1 DDR_BASEADDR + 0x3000000

#define VIDEO_BASEADDR2 DDR_BASEADDR + 0x4000000

u32 *BufferPtr[3];

unsigned int srcBuffer = (XPAR_PS7_DDR_0_S_AXI_BASEADDR  + 0x1000000);

int run_triple_frame_buffer(XAxiVdma* InstancePtr, int DeviceId, int hsize,

int vsize, int buf_base_addr, int number_frame_count,

int enable_frm_cnt_intr);

int main(void)

{

u32 Status;

Miz702_EMIO_init();

ov7725_init_rgb();

XAxiVdma InstancePtr;

xil_printf("Starting the first VDMA \n\r");

Status = run_triple_frame_buffer(&InstancePtr, 0, 1280, 720,

srcBuffer, 2, 0);

if (Status != XST_SUCCESS) {

xil_printf("Transfer of frames failed with error = %d\r\n",Status);

return XST_FAILURE;

} else {

xil_printf("Transfer of frames started \r\n");

}

print("TEST PASS\r\n");

//VDMA configurateAXI VDMA0

/****************往DDR寫數據設置**********************/

/*Xil_Out32((VDMA_BASEADDR + 0x030), 0x00000003);// enable circular mode

Xil_Out32((VDMA_BASEADDR + 0x0AC), VIDEO_BASEADDR0); // start address

Xil_Out32((VDMA_BASEADDR + 0x0B0), VIDEO_BASEADDR1); // start address

Xil_Out32((VDMA_BASEADDR + 0x0B4), VIDEO_BASEADDR2); // start address

Xil_Out32((VDMA_BASEADDR + 0x0A8), (H_STRIDE*4)); // h offset (640 * 4) bytes

Xil_Out32((VDMA_BASEADDR + 0x0A4), (H_ACTIVE*4)); // h size (640 * 4) bytes

Xil_Out32((VDMA_BASEADDR + 0x0A0), V_ACTIVE);*/ // v size (480)

/*****************從DDR讀數據設置**********************/

/*Xil_Out32((VDMA_BASEADDR + 0x000), 0x00000003); // enable circular mode

Xil_Out32((VDMA_BASEADDR + 0x05c), VIDEO_BASEADDR0); // start address

Xil_Out32((VDMA_BASEADDR + 0x060), VIDEO_BASEADDR1); // start address

Xil_Out32((VDMA_BASEADDR + 0x064), VIDEO_BASEADDR2); // start address

Xil_Out32((VDMA_BASEADDR + 0x058), (H_STRIDE*4)); // h offset (640 * 4) bytes

Xil_Out32((VDMA_BASEADDR + 0x054), (H_ACTIVE*4)); // h size (640 * 4) bytes

Xil_Out32((VDMA_BASEADDR + 0x050), V_ACTIVE); // v size (480)

*/

while (1) ;

return XST_SUCCESS;

}

7.4 測試結果

wps7765.tmp


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM