07-25-2020 10:24 PM - edited 07-26-2020 04:02 AM
Halo,everyone.
I use VDMA to build video channel in my vivado project, i use cmos sensor ov5640 to capture image,and it works well. My system is below
and my sdk code like below:
/*
* main.c
*
* Created on: 2019年05月10日
* Author: Administrator
*/
#include "I2C_16bit.h"
#include "xiicps.h"
#include "xil_io.h"
#include "xparameters.h"
#include "sleep.h"
#define VDMA_BASEADDR XPAR_AXI_VDMA_0_BASEADDR
#define VIDEO_BASEADDR0 0x01000000
#define VIDEO_BASEADDR1 0x02000000
#define VIDEO_BASEADDR2 0x03000000
#define VIDEO_BASEADDR3 0x04000000
#define VIDEO_BASEADDR4 0x05000000
#define POWER_DONE XPAR_SEND_POWERDONE_INFO_0_S00_AXI_BASEADDR
#define H_ACTIVE 1280
#define V_ACTIVE 720
#define H_STRIDE 1280
XIicPs Iic;
int main()
{
xil_printf("%d", Xil_In32(POWER_DONE));
xil_printf("Sensor reset done\tIIC init start\r\n");
I2C_config_init();
Xil_Out32((VDMA_BASEADDR + 0x030), 0x108B);// 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 + 0x0B8), VIDEO_BASEADDR3); // start address
Xil_Out32((VDMA_BASEADDR + 0x0BC), VIDEO_BASEADDR4); // start address
Xil_Out32((VDMA_BASEADDR + 0x0A8), (H_STRIDE*3)); // h offset (H_STRIDE* 3) bytes
Xil_Out32((VDMA_BASEADDR + 0x0A4), (H_ACTIVE*3)); // h size (H_ACTIVE * 3) bytes
Xil_Out32((VDMA_BASEADDR + 0x0A0), V_ACTIVE); // v size (V_ACTIVE)
/*****************从DDR读数据设置**********************/
Xil_Out32((VDMA_BASEADDR + 0x000), 0x8B); // 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 + 0x068), VIDEO_BASEADDR3); // start address
Xil_Out32((VDMA_BASEADDR + 0x06C), VIDEO_BASEADDR4); // start address
Xil_Out32((VDMA_BASEADDR + 0x058), (H_STRIDE*3)); // h offset (H_STRIDE * 3) bytes
Xil_Out32((VDMA_BASEADDR + 0x054), (H_ACTIVE*3)); // h size (H_ACTIVE * 3) bytes
Xil_Out32((VDMA_BASEADDR + 0x050), V_ACTIVE); // v size (V_ACTIVE)
while (1) ;
return 0;
}
Actually, i can see very clear video caputered by camera on the monitor, but i wanna to access the image saved in ddr memory, then i open memory viewer in debug mode , nothing happened.
What solution i had tried?
I think the problem maybe vivado sdk, i uninstalled vivado2018.2, installed vitis and vivado2020.1 .. doest work ethier
I have been busy with this matter for many days, Thank u for help!
07-26-2020 04:26 AM
Well, i found solution...
data to DMA is in cache,
use Xil_DCacheFlushRange(DDR_BASE,Length)
in while(1), to Flush to ddr memory