cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
4,940 Views
Registered: ‎04-03-2009

How to debug uartlite interrupt?

Hi there!

 

I'm new to xilinx embedded tools and need a little help. I'm working on a design that includes a microblaze processor that communicates over uart. UART send and receive works fine however i can't trigger the receive interrupt. The uart and xintc modules were set up according to the EDK example (xuartlite_intr_example.c).

My problem is that i have no idea where to start debugging this problem since the interrupt mechanism is hidden, i just see that my handler doesn't get called.

 

My setup code:

 

if (XUartLite_Initialize(&xuart, XPAR_RS232_DEVICE_ID) != XST_SUCCESS) { while(1){}; } if (XGpio_Initialize(&xgpio, XPAR_XPS_GPIO_0_DEVICE_ID) != XST_SUCCESS) { print("GPIO Init failed\r\n"); while(1){}; } print("GPIO Init Ok\r\n"); if (XIntc_Initialize(&xintc, XPAR_XPS_INTC_0_DEVICE_ID) != XST_SUCCESS) { print("Intc Init failed\r\n"); while(1){}; } if (XIntc_Connect(&xintc, XPAR_XPS_INTC_0_RS232_INTERRUPT_INTR,

(XInterruptHandler)XUartLite_InterruptHandler,

(void*)&xuart

) != XST_SUCCESS) { print("Intc connect failed\r\n"); while(1){}; } if (XIntc_Start(&xintc, XIN_REAL_MODE) != XST_SUCCESS) { print("Intc start failed\r\n"); while(1){}; } print("Intc Init Ok\r\n"); XIntc_Enable(&xintc, XPAR_XPS_INTC_0_RS232_INTERRUPT_INTR); XUartLite_SetRecvHandler(&xuart, RecvHandler, &xuart); XUartLite_SetSendHandler(&xuart, SendHandler, &xuart); XUartLite_EnableInterrupt(&xuart);

I'm not sure about XPAR_XPS_INTC_0_RS232_INTERRUPT_INTR being the interrupt id, but i couldn't find any better in xparameters.h. It's value is 0 and there are no other interrupt sources.

 

Handler:

void RecvHandler(void *CallBackRef, unsigned int EventData) { u8 data; if (EventData) if (XUartLite_Recv(&xuart,&data,1)) xil_printf("%c\r\n",(char)data); //simple echo with CR LF }

 

Where to start with this?

 

 Thank you!

 

 

 

0 Kudos
1 Reply
Highlighted
Adventurer
Adventurer
3,056 Views
Registered: ‎02-06-2008

I think the problem here is that you do not use an INTC for only 1 interrupt. I am currently having trouble with a UARTLITE interrupt also not being recognized. ( I get to the Handler when I start my debug session without any data sent, but after this I never get there even when I do send data to the receiver).

 

 // Initialize and Enable UART interrupt

XUartLite_Initialize(&RS485, XPAR_SYNTH_UART_DEVICE_ID);

XUartLite_InterruptHandler(&RS485);
XUartLite_ResetFifos(&RS485);  XUartLite_EnableInterrupt(&RS485);

  // Register interrupt handler  //microblaze_register_handler((XInterruptHandler)UartLite_InterruptHandler, (void *)0);  microblaze_register_handler((XInterruptHandler)UartLite_InterruptHandler, &RS485);  microblaze_enable_interrupts();

 

 

//Handler

void UartLite_InterruptHandler (XUartLite *InstancePtr){// microblaze_disable_interrupts();
while(!XUartLite_IsReceiveEmpty(XPAR_SYNTH_UART_BASEADDR))

 {

 UartRxHndlr();

 }
while(XUartLite_IsTransmitFull(XPAR_SYNTH_UART_BASEADDR))

 {

UartTxHndlr();

 }

0 Kudos