Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Newbie
dedanan
Posts: 1
Registered: ‎02-16-2009
0

how to read data from the serial port?

Hello everybody, i have a problem: i dont know how to read data from the serial port.

 

i explain my goal: i have a mobile platform with 2 motored wheels, a nexys2 fpga board and a pc on my mobile platform. i have to create a connection between the pc and the fpga with the serial port. At the moment i can write on the serial (i use xil_printf) and i see all with hyperterminal on my pc but it isnt very important for my project. the problem is that i cant do the opposite, i dont know how to read data in the same way. The goall will be to elaborate data with the pc and send the velocity to the fpga via serial.

 

thanks for help and sorry for the bad english! 

Visitor
rents85
Posts: 4
Registered: ‎12-10-2008
0

Re: how to read data from the serial port?

I have the same problem . I would like use rs232 with interrupt and i find this http://warp.rice.edu/trac/browser/trunk/EDK_Demos/UberDemo/demoapp2.c?rev=15 . I don't understand this function :

XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR, XPAR_OPB_INTC_0_RS232_INTERRUPT_INTR, (XInterruptHandler)uart_int_handler, (void *) 0);.

What is XPAR_OPB_INTC_0_RS232_INTERRUPT_INTR?

 

Expert Contributor
bassman59
Posts: 4,741
Registered: ‎02-25-2008
0

Re: how to read data from the serial port?


rents85 wrote:

I have the same problem . I would like use rs232 with interrupt and i find this http://warp.rice.edu/trac/browser/trunk/EDK_Demos/UberDemo/demoapp2.c?rev=15 . I don't understand this function :

XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR, XPAR_OPB_INTC_0_RS232_INTERRUPT_INTR, (XInterruptHandler)uart_int_handler, (void *) 0);.

What is XPAR_OPB_INTC_0_RS232_INTERRUPT_INTR?

 


Look in xparameters.h.

 

-a


----------------------------------------------------------------
Yes, I do this for a living.
Contributor
tarzandavid
Posts: 48
Registered: ‎06-13-2008
0

Re: how to read data from the serial port?

 
Contributor
tarzandavid
Posts: 48
Registered: ‎06-13-2008
0

Re: how to read data from the serial port?

Hi all,

 

I'm a newbie and have a similar question. I am using a Spartan3A-1800A-DSP Board, and I want to communicate my board and PC. I'm trying to send data to RS232 by using a C program such as " printf"hello world" " , and hopefully can get it shown back on PC hyper-terminal.

 

Could anyone let me know how I can achieve this? Or some tutorials recommended will also be a help.Thank you in advance.

 

Kind regards,

tarzandavid

Regular Visitor
robbi11880
Posts: 14
Registered: ‎11-11-2008
0

Re: how to read data from the serial port?

Hello tarzan,

 

I work with the same board, EDK, MicroBlaze and RS232.

 

Sending Data: There are two opportunities. You can configure the RS232 as Standard I/O. From this it follows that the methods "xil_printf" or "print" prints a string via Standard I/O (in this case RS232) to the console which is connected to the serial port of the PC (in your (windows) case: hyperterminal; for linux: minicom). Write "xil_printf("Hello World\n\r"); in your C-File and you get what you want to.

The second opportunity is to send a databuffer via RS232. Then there is no need to set it as Standard I/O. An example for sending a buffer, is delievered with EDK in its installation path (installationpath/EDK/sw/XilinxProcessorIPLib/drivers/uartlite_v_1_12_a/examples). You can find necessary functions in xuartlite.h.

 

Receivind Data: see examples and xuartlite.h.

 

Hope this helps.

 

Best regards, Robbi

 

Contributor
tarzandavid
Posts: 48
Registered: ‎06-13-2008
0

Re: how to read data from the serial port?

hi robbi,

Thanks a lot for your suggestion, I'll try to do as what you told me. Really appreciated. :-)

tarzan

Regular Visitor
ralfcantnerbosch
Posts: 22
Registered: ‎09-05-2008
0

Re: how to read data from the serial port?

Hi together,

if you want to read data from a serial port that is connected to stdin,

you may follow this link :

http://forums.xilinx.com/xlnx/board/message?board.id=EDK&message.id=6717#M6717

 

--Ralf

Contributor
tarzandavid
Posts: 48
Registered: ‎06-13-2008
0

Re: how to read data from the serial port?

Hi ralfcantnerbosch,

 

In the link you posted you mentioned "Hyperterminal sends each character as soon as you type it. It does not wait for the <RETURN> key. ", have you connected the board to PC under this circumstances?

 

tarzan

Regular Visitor
robbi11880
Posts: 14
Registered: ‎11-11-2008
0

Re: how to read data from the serial port?

Hello tarzan,

 

are you working with EDK? If true, you can set the RS232 device as STD I/O in *.mss-file for your OS like:

BEGIN OS
 PARAMETER OS_NAME = standalone
 PARAMETER OS_VER = 2.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER STDIN = RS232_Uart_1
 PARAMETER STDOUT = RS232_Uart_1
END

 

-> "Hyperterminal sends each character as soon as you type it. It does not wait for the <RETURN> key. "

I think this simply means how Hyperterminal works. If the serial connection is build up and you press a key on your keyboard (of the pc), the ASCII code of the key you pressed is sended via serial-interface. There is no need of pressing <RETURN> to confirm the sending.

 

I also have connected the Spartan-3A DSP Board to PC to communicate. 

More questions?

 

Greetz Robbi