• 0

How to read in data using UART on Zynq PS



While there are many examples showing a basic Hello World using a Zynq UART, how do we read in data from the console using the same UART? Can anyone please guide me to the right example. I cudn't find one. 

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0


One way to start would be to take a look at the examples provided by Xilinx.

You can find them at this location:


Or you can look at the "system.mss" file in SDK (bsp folder) and click on "import example".


Link to post
Share on other sites
  • 0

I am able to get Hello World working over UART and printing on serial console however I cannot make my program take user input on a terminal and have the result added or multiplied. My code is as follows:

#include <stdio.h>
#include "platform.h"
#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xuartps_hw.h"
#include "xplatform_info.h"
#include "xuartps.h"
#include "xil_io.h"
#include "xparameters.h"
#include "xil_types.h"
#include "xil_printf.h"


int main()

XUartPs Uart_Ps;        /* The instance of the UART Driver */

int A,B,C;
xil_printf("enter your data\n");

A = XUartPs_RecvByte(u32 BaseAddress);
XUartPs_SendByte(u32 BaseAddress, A);
B = XUartPs_RecvByte(u32 BaseAddress);
XUartPs_SendByte(u32 BaseAddress, B);

C = A*B;

xil_printf("\n mul=");
XUartPs_SendByte(u32 BaseAddress, C);
xil_printf("\n ");

return 0;

Any advice on how I could go about doing this?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now