UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor lonterus
Visitor
8,474 Views
Registered: ‎02-23-2009

Getting an RS232 Uart to send and recieve

Hello, I am new to using the EDK, having used the Xilinx ISE previously, and need some basic help to get started.  I know that this is a basic question but one that I’m having trouble with. I'm trying to create a basic "Hello World" microBlaze processor to simulate in the ISE environment. Currently I’m at the stage of trying to get the system to spit out a single number on an output RS232 line. However, the system does not appear to be cooperating. I simulate the microBlaze, but regardless of the number proscribed the output is always 0. This is the code that I am currently running on boot:  #include "xparameters.h"#include "stdio.h"#include "uartlite_header.h"#include "xuartlite.h"//====================================================int main (void) {
 XUartLite OUT;
 Xuint8 buffer[1];
 buffer[0] = 1;
 if(XUartLite_Initialize(&OUT, XPAR_RS232_DEVICE_ID) != XST_DEVICE_NOT_FOUND)
 {
  while(1);
  {
   XUartLite_Send(&OUT, &buffer, 1);
  }
 } else {
  print("----RS232 NOT FOUND------");
 }
 return 0;
}
 Any help you guys could give would be most appreciated, either in direct help or pointing me to a decent tutorial so that i can help myself (note: I’ve looked in the EDK example projects and all I see are versions of the self test programs that don't send or receive any data).  Thanks,Lonterus

 

 

 

0 Kudos
3 Replies
Contributor
Contributor
8,364 Views
Registered: ‎06-13-2008

Re: Getting an RS232 Uart to send and recieve

I have the same questions as yours, didn't figure out how to communicate the board and pc by using EDK.

 

Btw, what's your edition of ISE and EDK?

0 Kudos
Explorer
Explorer
8,348 Views
Registered: ‎08-16-2008

Re: Getting an RS232 Uart to send and recieve

Hi guys! I also use UartLite and XUartLite_Initialize,  XUartLite_Send and XUartLite_Recv functions to communicate with PC.

 

XUartLite_Send works but XUartLite_Recv DO NOT WORK PROPER in my system.  I use it in polled mode. It receives trash. But when I run debugger step by step it receive data! I wonder why? 

 

PS. Windows Serial Port Programming Robertson Bayer March 30, 2008 and Serial Programming Guide for POSIX Operating Systems by Michael R. Sweet are good guides for writing programs for PC

Message Edited by k-50 on 02-28-2009 10:52 PM
0 Kudos
Visitor sebs
Visitor
7,961 Views
Registered: ‎03-26-2009

Re: Getting an RS232 Uart to send and recieve

You could start with using

 

RecvBuffer = XUartLite_RecvByte (STDIN_BASEADDRESS);

XUartLite_SendByte(STDOUT_BASEADDRESS, Sendbuffer);

 

both functions are blocking and send only 1 byte at a time. But it is a start. 

 

You should also have a look at the Xilinx Device Driver Documentation to get an idea what functions are available for the uartlite driver.

 

http://lmgtfy.com/?q=Xilinx+Device+Driver+Documentation+filetype%3Apdf

 

 

Sebastian