ZynqはEMIOの2日間は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を導入しました:
Helloword試験手順を実施することができます。
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
int main()
{
// init_platform();//无用
print("Hello World\n\r");
// cleanup_platform();//无用
return 0;
}
UARTの送信データ(試行されていません)
Tera Termの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は、何らかの指示受信するため
、この実験のを、それが最初に到着したUARTデータを遮断することにより応答するために使用することを意図していた、そしてXUartPs_Recvが受け取る使用しますが、実験は、割り込み応答関数を入力することはできませんどんなに。
そして、適切に割り込み応答関数を入力することはできません同じで見つかったsystem.mssからサンプルプログラムを中断。
作品や正しいBSPにはなりませんVivadoでいくつかの設定があるかどうかを決定することができません。
シングルスレッドプログラムが実行されているため、組み込みアプリケーションの開発における過去の経験に基づいて、応答が受信された場合に割り込みを使用してデータを受信し続ける、そして比較的に言えば、(操作を保存して、サイトをリロードするので)、より多くの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;
}