ZYNQ이 EMIO 두 가지 일 1 PS 끝에 마침내 성공 직렬 포트를 사용하여 실험을 매핑 할, 그 이유는 첫째 CP2012 지금 SDK와 함께 사용되는 트랜시버 제어 EMIO를 통해 게시 할 수있는 논리적 인 증거를 만들어, SDK 트랜시버 절차가 적용되지 않는 것으로 밝혀졌다 엔지니어링 :
지도 첫 :
먼저 BD는 : EMIO는 UART를 통해 인도
2, XDC :
set_property IOSTANDARD LVCMOS33 [get_ports UART_1_rxd]
set_property IOSTANDARD LVCMOS33 [get_ports UART_1_txd]
set_property PACKAGE_PIN AB10 [get_ports UART_1_txd]
set_property PACKAGE_PIN AB9 [get_ports UART_1_rxd]
3, SDK 소개 :
은 HelloWorld 시험 절차가 구현 될 수있다;
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
int main()
{
// init_platform();//无用
print("Hello World\n\r");
// cleanup_platform();//无用
return 0;
}
UART 송신 데이터 (시도되지 않음)
테라 용어 COM4 9600 (상기 코드 정합)로 설정된
COM5는 전송 속도 115200 설정
UART는 데이터를 수신
main.c를
/******************************************************************************
*
* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*
* helloworld.c: simple test application
*
* This application configures UART 16550 to baud rate 9600.
* PS7 UART (Zynq) is not initialized by this application, since
* bootrom/bsp configures it to baud rate 115200
*
* ------------------------------------------------
* | UART TYPE BAUD RATE |
* ------------------------------------------------
* uartns550 9600
* uartlite Configurable only in HW design
* ps7_uart 115200 (configured by bootrom/bsp)
*/
/*
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
int main()
{
init_platform();
while(1){
print("Hello World\n\r");
}
cleanup_platform();
return 0;
}*/
#include "xparameters.h"
#include "xuartps.h"
#include "xil_printf.h"
#include "sleep.h"
int main()
{
//使用UART0实现发送数据
XUartPs Uart_Ps;//uart对象
//查找uart配置
XUartPs_Config *Config;
Config = XUartPs_LookupConfig(XPAR_XUARTPS_0_DEVICE_ID);//ID来源于xparameters.h
if (Config == NULL)
{
//在bsp中设置为uart1负责stdout
print("failed XUartPs_LookupConfig\n\r");
return XST_FAILURE;
}
else
{
print("succeed XUartPs_LookupConfig\n\r");
}
//uart初始化
int Status;
Status = XUartPs_CfgInitialize(&Uart_Ps, Config, Config->BaseAddress);
if (Status != XST_SUCCESS)
{
print("failed XUartPs_CfgInitialize\n\r");
return XST_FAILURE;
}
else
{
print("succeed XUartPs_CfgInitialize\n\r");
}
//接收缓冲
u8 buf[64];
//接收字节数
u32 recv_cnt = 0;
while (TRUE)
{
usleep(500000);//等待500ms
recv_cnt = XUartPs_Recv(&Uart_Ps, buf, 64);//接收数据
if (recv_cnt > 0)
{
//返回接收到的数据
xil_printf("%s", buf);
//清空缓冲
memset(buf, 0, 64);
}
}
return 0;
}
문제 설명 참조 https://blog.csdn.net/botao_li/article/details/85302027
UART를 일부 표시 수신의 경우
는 원래 다음 XUartPs_Recv 수신 사용 도착합니다 UART 데이터를 방해하여 응답하는 데 사용할 의도이 실험을하지만, 아무리 실험 인터럽트 응답 기능을 입력 할 수 없습니다.
그리고 제대로 인터럽트 응답 기능을 입력 할 수 없습니다 같은에서 발견 system.mss에서 예제 프로그램을 중단.
Vivado 작동하거나 올바른 BSP는 발생하지 않습니다에서 일부 설정이 있는지 확인할 수 없습니다
임베디드 애플리케이션의 개발에 과거의 경험을 바탕으로, 단일 스레드 프로그램에 상대적으로 말하기, 응답이 수신되면, 다음 (작업을 저장하고 사이트를 다시로드 때문에) 더 많은 CPU 시간을 소비하는 인터럽트를 사용하여 데이터가 계속 실행되고 더 높은 운영 효율에 도달 할 수 폴링 방법. 데이터 수신을 비교하여 폴링 수신 인터럽트 수신 가끔 버스트를 들어, 더 빠른 응답을 얻을 수있다.
기능 설명을 인터럽트 : 며칠을 시도했지만 성공하지 못했습니다
#include "sys_intr.h"
#include "uartps_intr.h"
void init_intr_sys(void)
{
Init_UartPsIntr(&UartPs,UART_DEVICE_ID);
Init_Intr_System(&Intc);
Setup_Intr_Exception(&Intc);
UartPs_Setup_IntrSystem(&Intc, &UartPs, UART_INT_IRQ_ID);
}
int main(void)
{
init_intr_sys();
XUartPs_Recv(&UartPs, RecvBuffer, TEST_BUFFER_SIZE);
while(1);
return 0;
}