The system is built on the Zybo board in standalone mode. So far I had success sending interrupts from PL via GPIO. In order to reduce complexity I decided to try sending interrupts directly as it is shown on the included diagram. The RTL module is a simple counter sending a pulse once in a period of time. ILA confirmed the pulse. The application is supposed to count 50 interrupt events and quit. However, no triggering is happening. Clock freq is 50 MHz and a counter is 16 bit.
The C-code is taken from two sources: Xilinx Timer-interrupt example and Avnet interrupt tutorial controlling brightness with PWM. The issue in my opinion is that I can't find the parameter called INTERRUPT_ID. The file xparameter.h has nothing related to IRQ interrupt or anything else related to the INTERRUPT_ID or INTC_ID. Below is the last used C-code snapshot.
Question
Notarobot
Hello to al,
The system is built on the Zybo board in standalone mode. So far I had success sending interrupts from PL via GPIO. In order to reduce complexity I decided to try sending interrupts directly as it is shown on the included diagram. The RTL module is a simple counter sending a pulse once in a period of time. ILA confirmed the pulse. The application is supposed to count 50 interrupt events and quit. However, no triggering is happening. Clock freq is 50 MHz and a counter is 16 bit.
The C-code is taken from two sources: Xilinx Timer-interrupt example and Avnet interrupt tutorial controlling brightness with PWM. The issue in my opinion is that I can't find the parameter called INTERRUPT_ID. The file xparameter.h has nothing related to IRQ interrupt or anything else related to the INTERRUPT_ID or INTC_ID. Below is the last used C-code snapshot.
#include <stdio.h>
#include "platform.h"
#include "xparameters.h"
#include "xscugic.h"
#include "xil_printf.h"
#include "xil_exception.h"
#define INTC_INTERRUPT_ID 84 // IRQ [0]
#define INTC XScuGic
#define INTC_HANDLER XScuGic_InterruptHandler
#define INTC_DEVICE_ID XPAR_PS7_SCUGIC_0_DEVICE_ID // =0
static INTC Intc;
unsigned int LED = 0; // Interrupt counter
void PIsr(void *InstancePtr){ // INTERRUPT SERVICE ROUTINE(ISR)
LED ++;
}
int SetupInterruptSystem() {
int result;
XScuGic *IntcInstancePtr = &Intc;
XScuGic_Config *IntcConfig;
IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
if (IntcConfig == NULL) {
return XST_FAILURE;
}
result = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig, IntcConfig->CpuBaseAddress);
if (result != XST_SUCCESS) {
return XST_FAILURE;
}
/* Connect the interrupt handler */
result = XScuGic_Connect(IntcInstancePtr, INTC_INTERRUPT_ID, (Xil_ExceptionHandler) PIsr, 0);
if (result != XST_SUCCESS) {
return result;
}
/* Enable the interrupt for the controller device. */
XScuGic_Enable(IntcInstancePtr, INTC_INTERRUPT_ID);
Xil_ExceptionInit();
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler)INTC_HANDLER, IntcInstancePtr);
Xil_ExceptionEnable(); /* Enable non-critical exceptions */
return XST_SUCCESS;
}
int main(void) {
int status = XST_SUCCESS;
xil_printf("\nLED=%d\n",LED);
status = SetupInterruptSystem();
if (status != XST_SUCCESS) {
return XST_FAILURE;
}
while (LED < 50) {
}
xil_printf("LED=%d",LED);
return 0;
}
Hope someone could share insights and educate me.
Thank you very much!
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.