cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
6,916 Views
Registered: ‎04-07-2015

UART interrupt

Hi,

 

I use a AXI UART in Zynq-7000 and I have some problems with the interrupt. I created two functions in order to initialize the gic controller and the uart :

 

int InitInterruptSystem()
{
	int status;

	gicconfig = XScuGic_LookupConfig(XPAR_SCUGIC_0_DEVICE_ID); //Initialize the interrupt controller driver
	if (gicconfig == NULL) {printf("Intialization of interrupt controller driver (LookupConfig) failed \n\r"); return XST_FAILURE;}

	status = XScuGic_CfgInitialize(&interruptcontroller, gicconfig, gicconfig->CpuBaseAddress); //Initialize the interrupt controller driver
	if (status != XST_SUCCESS) {printf("Intialization of interrupt controller driver (CfgInitialize) failed \n\r"); return XST_FAILURE;}

	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) XScuGic_InterruptHandler, &interruptcontroller); //Connect the interrupt controller interrupt handler to the hardware interrupt handling logic in the ARM processor

	Xil_ExceptionEnable(); //Enable ARM Exception

	return XST_SUCCESS;
}

 

int InitUart()
{
	int status, i;
	u8 sendbuffer[BUFFER_SIZE];

	uart_interrupt = 0;

	uartconfig = XUartLite_LookupConfig(XPAR_AXI_UARTLITE_0_DEVICE_ID); //Initialize UART
	if (uartconfig == NULL) {printf("Intialization of uart driver (LookupConfig) failed \n\r"); return XST_FAILURE;}

	status = XUartLite_CfgInitialize(&uartcontroller, uartconfig, uartconfig->RegBaseAddr); //Initialize UART
	if (status != XST_SUCCESS) {printf("Intialization of uart driver (CfgInitialize) failed \n\r"); return XST_FAILURE;}

	status = XScuGic_Connect(&interruptcontroller, XPAR_FABRIC_AXI_UARTLITE_0_INTERRUPT_INTR, (Xil_InterruptHandler)XUartLite_InterruptHandler, (void *)&uartcontroller); //Connect a device driver handler that will be called when an interrupt for the device occurs
	if (status != XST_SUCCESS) {printf("Connection of gpio interrupt handler failed \n\r"); return XST_FAILURE;}

	XScuGic_Enable(&interruptcontroller, XPAR_FABRIC_AXI_UARTLITE_0_INTERRUPT_INTR); //Enable the interrupt for the device

	XUartLite_SetRecvHandler(&uartcontroller, (XUartLite_Handler)UartInterruptHandler, &uartcontroller); //Setup the handlers for the Uart

	XUartLite_EnableInterrupt(&uartcontroller); //Enable interrupt

	//XUartLite_ResetFifos(&uartcontroller); //Reset FIFO UART

	for (i = 0; i < BUFFER_SIZE; i++) {
		sendbuffer[i] = i;
		receivebuffer[i] = 0;
	}

	XUartLite_Recv(&uartcontroller, receivebuffer, BUFFER_SIZE);

	XUartLite_Send(&uartcontroller, sendbuffer, BUFFER_SIZE);


	return XST_SUCCESS;
}

The problem is that the interrupt never happen when I send or receive a buffer from UART.

Have you any ideas why ?

 

Thanks Jo

0 Kudos
2 Replies
Highlighted
Adventurer
Adventurer
6,902 Views
Registered: ‎04-07-2015

Re: UART interrupt

I also have a AXI GPIO in the same project and the interrupt works perfectly but not UART interrupt.

 

Jo

0 Kudos
Highlighted
Adventurer
Adventurer
6,892 Views
Registered: ‎04-07-2015

Re: UART interrupt

When I send or receive data from uart, the Gic interrupt handler (XScuGic_InterruptHandler) is executed but when the function read which device has generated this interrupt the Interrupt ID returned is 1023 instead of 61 in my case and I don't know why ?

 

Jo

0 Kudos