|
ZYNQ核配置流程
1、根据开发板上内存容量配置好DDR3型号,选择MT41K128M16(单片256MB),或MT41K256M16(单片512MB),后缀任意,位宽根据硬件结构选择16bit(1片)或32bit(2片)
2、配置好MIO的电压,将Bank1的切换为1.8V
3、如需要将程序固化到QSPI,请打开QSPI控制器,管脚选择MIO1~MIO6
4、如需将程序固化到SD卡,请打开SD0控制器,管脚选择MIO40-MIO45
5、如需使用串口打印调试信息,请使能UART1,管脚选择MIO48和MIO49
6、如需通过PS给PL提供时钟,配置PL Fabric Clocks中的时钟频率和个数
7、如需通过AXI-Lite读写FPGA侧的逻辑,使能PS-PL Configuration中的GP Master AXI Interface
8、如需使用FPGA获取PS侧存储器中的内容,使能PS-PL Configuration中的HP Slave AXI Interface
9、更多内容,根据自己需求配置
本系统用到2路时钟,一路给AXI总线使用,用来完成各个外设的寄存器读写,以及VDMA读取PS的DDR3使用。另一路给显示时序生成器和同步器使用,并输出给TFT显示屏作为像素时钟。
RGB TFT管脚信息约束内容
- set_property IOSTANDARD LVCMOS33 [get_ports lcd_pclk]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[15]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[14]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[13]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[12]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[11]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[10]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[9]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[8]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[7]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[6]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[5]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[4]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[3]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[2]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[1]}]
- set_property IOSTANDARD LVCMOS33 [get_ports {lcd_data[0]}]
- set_property IOSTANDARD LVCMOS33 [get_ports lcd_de]
- set_property IOSTANDARD LVCMOS33 [get_ports lcd_hs]
- set_property IOSTANDARD LVCMOS33 [get_ports lcd_vs]
- set_property IOSTANDARD LVCMOS33 [get_ports lcd_bl]
- set_property PACKAGE_PIN U15 [get_ports lcd_pclk]
- set_property PACKAGE_PIN W20 [get_ports {lcd_data[15]}]
- set_property PACKAGE_PIN W19 [get_ports {lcd_data[14]}]
- set_property PACKAGE_PIN V17 [get_ports {lcd_data[13]}]
- set_property PACKAGE_PIN V16 [get_ports {lcd_data[12]}]
- set_property PACKAGE_PIN T15 [get_ports {lcd_data[11]}]
- set_property PACKAGE_PIN V20 [get_ports {lcd_data[10]}]
- set_property PACKAGE_PIN U17 [get_ports {lcd_data[9]}]
- set_property PACKAGE_PIN V18 [get_ports {lcd_data[8]}]
- set_property PACKAGE_PIN T16 [get_ports {lcd_data[7]}]
- set_property PACKAGE_PIN R16 [get_ports {lcd_data[6]}]
- set_property PACKAGE_PIN U19 [get_ports {lcd_data[5]}]
- set_property PACKAGE_PIN Y19 [get_ports {lcd_data[4]}]
- set_property PACKAGE_PIN W18 [get_ports {lcd_data[3]}]
- set_property PACKAGE_PIN Y18 [get_ports {lcd_data[2]}]
- set_property PACKAGE_PIN W16 [get_ports {lcd_data[1]}]
- set_property PACKAGE_PIN Y17 [get_ports {lcd_data[0]}]
- set_property PACKAGE_PIN W15 [get_ports lcd_de]
- set_property PACKAGE_PIN U14 [get_ports lcd_hs]
- set_property PACKAGE_PIN W14 [get_ports lcd_vs]
- set_property PACKAGE_PIN R17 [get_ports lcd_bl]
复制代码
RGB888转RGB565代码
- module rgb888to565(
- input [23:0]rgb888_data,
- output [15:0]rgb565_data
- );
- wire [4:0]r_data;
- wire [5:0]g_data;
- wire [4:0]b_data;
- assign r_data = rgb888_data[23:19];
- assign g_data = rgb888_data[15:10];
- assign b_data = rgb888_data[ 7:3];
- assign rgb565_data = {r_data,g_data,b_data};
- endmodule
复制代码
SDK中软件C代码
- #include "xparameters.h"
- #include "xaxivdma.h"
- #include "xvtc.h"
- #include "xil_cache.h"
- #include "pic0.h"
- 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);
- unsigned int srcBuffer = (XPAR_PS7_DDR_0_S_AXI_BASEADDR + 0x1000000);
- void Vtc_Init(XVtc *Vtc_Inst)
- {
- XVtc_Config *vtcConfig;
- vtcConfig = XVtc_LookupConfig(XPAR_VTC_0_DEVICE_ID);
- XVtc_CfgInitialize(Vtc_Inst, vtcConfig, vtcConfig->BaseAddress);
- }
- //显示图片
- void Pic_Display(uint8_t *frame,const uint8_t *Pic)
- {
- uint16_t width,height;
- uint16_t x_pos, y_pos;
- uint16_t x_max, y_max;
- uint32_t stride_mm = 0;
- uint32_t stride_pic = 8;
- uint16_t Cnt = 0;
- width = (Pic[2]<<8) + Pic[3];//读取图片宽度
- height = (Pic[4]<<8) + Pic[5];//读取图片高度
- if(width < 800)
- x_max = width;
- else
- x_max = 800;
- if(height < 480)
- y_max = height;
- else
- y_max = 480;
- for(y_pos=0;y_pos<y_max;y_pos++)
- {
- for(x_pos=0;x_pos<x_max;x_pos++)
- {
- frame[stride_mm + Cnt] = Pic[stride_pic + Cnt];
- frame[stride_mm + Cnt + 1] = Pic[stride_pic + Cnt + 1];
- frame[stride_mm + Cnt + 2] = Pic[stride_pic + Cnt + 2];
- Cnt+=3;
- }
- stride_mm += 800*3;
- stride_pic += width*3;
- Cnt = 0;
- }
- //刷新Cache,更新图像
- Xil_DCacheFlush();
- }
- int main(void)
- {
- XAxiVdma Vdma_Inst;
- XVtc Vtc_Inst;
- //清空Buffer
- memset((uint8_t*)srcBuffer,0x00,800*480*3);
- run_triple_frame_buffer(&Vdma_Inst, 0, 800, 480,srcBuffer, 0, 0);
- Vtc_Init(&Vtc_Inst);
- XVtc_EnableGenerator(&Vtc_Inst);
- Pic_Display((uint8_t*)srcBuffer,gImage_pic0);
- return 0;
- }
复制代码
图片数据文件:
pic0.rar
(845.25 KB, 下载次数: 363)
|
|