cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lilongguang
Observer
Observer
3,861 Views
Registered: ‎08-16-2010

xuartile interrupt

I write a program about the xuartlite receive interrupt.my purpose is to send the text thorough the compiuter,that will cause the recevice interrupter.in the recevice interrupt function,it sends "helloworld" to the computer.but it just doesn't work.How to use the Xuartlite recevie interrupt?

 

#include <stdio.h>
//#include "platform.h"
#include"xuartlite.h"
#include"xil_types.h"
#include"xparameters.h"
XUartLite  xuar;
u8 p[]="Hello\n,world";
u8 pStr[188];
 void RecHandler(void *CallBackRef, unsigned int ByteCount)
 {
  //XUartLite_Recv(&xuar,pStr ,10);
  XUartLite_Send(&xuar,p ,10);
 }

int main()
{
  XUartLite_Initialize(&xuar, (u16)XPAR_RS232_DCE_DEVICE_ID);
  XUartLite_ResetFifos(&xuar);
  XUartLite_EnableInterrupt(&xuar);
  XUartLite_SetRecvHandler(&xuar,RecHandler,(void *)0);
 // XUartLite_Send(&xuar,p ,10);
 // XUartLite_Recv(&xuar,pStr ,10);
 // while(1);
     return 0;
}

0 Kudos
4 Replies
pumaju1808
Scholar
Scholar
3,848 Views
Registered: ‎08-14-2007

Hi,

Do you already connect the interrupts signal of your UART to Interrupt input of Microblaze??

Also you missed to enable microblaze interrupt using the function
microblaze_enable_interrupts();

regards
0 Kudos
lilongguang
Observer
Observer
3,841 Views
Registered: ‎08-16-2010

"Do you already connect the interrupts signal of your UART to Interrupt input of Microblaze?? " What do you mean ? I use the Spartan 3E Starter Kit Board ,I just use the BSP,Do I need to make some change in the XPS?
0 Kudos
Anonymous
Not applicable
3,836 Views

It doesn't look like you have setup the interrupt system alongside of UartLite driver.

 

Missing calls to initialize, connect, and enable the interrupt controller driver.  Not sure which version of the tools you are using but look for the example driver file for the Uartlite - such as the "xuartlite_intr_example.c".

 

For me the file is located in the following directory:

C:\Xilinx\13.1\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\uartlite_v2_00_a\examples

 

Regards,

Mike

0 Kudos
pumaju1808
Scholar
Scholar
3,820 Views
Registered: ‎08-14-2007

can you put your MHS file?? it depends if you are connecting directly your UART IP to Microblaze or if you are using an interrupt controller IP, if you are using this last one, then you need to use more functions to initialize, connect , etc as "mlhdev" said

regards
0 Kudos