1、参考
UG585
网络笔记
2、理论知识
参见上一次实验:基于ZYNQ 的UART中断实验
3、实验目的
练习使用UART的中断实验,并将接收到的数据写入到DDR3中。
4、实验过程
建立工程,设置并初始化串口中断,在运行程序之后,如果串口接收到N(1-63)个字节数据,则产生串口中断,Zynq响应中断,将数据从RXFIFO读出之后写入到DDR3预定的地址中。
5、实验平台
Microphase ZUS zynq7020 开发板。 串口使用 uart1[48,49]. DDR选择 MT41J256M16 RE-125,32bit. BANK1 = 1.8v.
6、Vivado 建立工程
block design 如下:
7、SDK的工程程序
main.c
/*
* main.c
*
* Created on: 2019年8月27日
* Author: admin
*/
#include "sys_intr.h"
#include "user_uart.h"
XScuGic Intc; //GIC
XUartPs Uart_Ps; //UART
void System_Init(void)
{
Init_Intr_System(&Intc);
Setup_Intr_Exception(&Intc);
Uart_Intr_System(&Intc, &Uart_Ps, UART_INT_TRQ_ID);
}
int main(void)
{
int Status;
/* 串口初始化 */
Status = Uart_Init(&Uart_Ps, UART_DEVICE_ID);
if (Status == XST_FAILURE) {
xil_printf("Uartps Failed\r\n");
return XST_FAILURE;
}
System_Init(); //中断初始化
while (1){
sleep(1);
xil_printf("Hello World!\r\n");
}
return Status;
}
sys_intr.h
/*
* sys_intr.h
*
* Created on: 2019年8月27日
* Author: admin
*/
#ifndef SRC_SYS_INTR_H_
#define SRC_SYS_INTR_H_
#include "xparameters.h"
#include "xil_exception.