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
Visitor
stechbeitel
Posts: 2
Registered: ‎04-06-2011
0

PPC Interrupt Problem

Hello,

 

im trying to implement an interrupt with the interrupt controller. The problem is, that the interrupt service routine will not be entered althought the output (irq) of the interrupt controller switches to high.

The interrupt signal is only a button wich is connected directly to the interrupt controller (intr). If i use push button GPIOs the interrupt works. Is it a problem to connect signals directly to the interrupt controller? I cant see the difference between the GPIO and non GPIO implementation

 

 

 

mhs:

 

 PORT fpga_0_RS232_Uart_RX_pin = fpga_0_RS232_Uart_RX_pin, DIR = I
 PORT fpga_0_RS232_Uart_TX_pin = fpga_0_RS232_Uart_TX_pin, DIR = O
 PORT fpga_0_clk_1_sys_clk_pin = CLK_S, DIR = I, SIGIS = CLK, CLK_FREQ = 100000000
 PORT fpga_0_rst_1_sys_rst_pin = sys_rst_s, DIR = I, SIGIS = RST, RST_POLARITY = 0
 PORT btn0 = btn0, DIR = I, SIGIS = INTERRUPT, SENSITIVITY = EDGE_RISING
 PORT IRQ_OUT = ppc405_0_EICC405EXTINPUTIRQ_0, DIR = O

 

BEGIN ppc405_virtex4
 PARAMETER INSTANCE = ppc405_0
 PARAMETER C_FASTEST_PLB_CLOCK = DPLB0
 PARAMETER C_IDCR_BASEADDR = 0b0100000000
 PARAMETER C_IDCR_HIGHADDR = 0b0111111111
 PARAMETER HW_VER = 2.01.b
 BUS_INTERFACE DPLB0 = plb
 BUS_INTERFACE IPLB0 = plb
 BUS_INTERFACE JTAGPPC = ppc405_0_jtagppc_bus
 BUS_INTERFACE RESETPPC = ppc_reset_bus
 PORT CPMC405CLOCK = clk_100_0000MHzDCM0
 PORT EICC405EXTINPUTIRQ = ppc405_0_EICC405EXTINPUTIRQ_0
END

 

BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 2.01.a
 PARAMETER C_BASEADDR = 0x81800000
 PARAMETER C_HIGHADDR = 0x8180ffff
 BUS_INTERFACE SPLB = plb
 PORT Irq = ppc405_0_EICC405EXTINPUTIRQ_0
 PORT Intr = btn0
END

 

 

c file non gpio (doesnt work):

 

#include "xparameters.h"

#include "stdio.h"

#include "xbasic_types.h"

#include "xintc.h"

#include "xexception_l.h"

 

 

static

XIntcInterruptController;

 

void

btn0_ISR(){

print("btn0_ISR_used");

XIntc_Acknowledge(&InterruptController, XPAR_XPS_INTC_0_SYSTEM_BTN0_INTR);

}

 

 

int

main()

{

 

print(

"enter main");

 

XExc_Init();

XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, (

XExceptionHandler)XIntc_DeviceInterruptHandler, (void*)XPAR_XPS_INTC_0_DEVICE_ID);

XIntc_Initialize(&InterruptController, XPAR_XPS_INTC_0_DEVICE_ID);

XIntc_MasterEnable(XPAR_XPS_INTC_0_BASEADDR); // For setting MER

 

XIntc_Connect(&InterruptController, 0, (XInterruptHandler)btn0_ISR, (void*)0); // Connecting service routine

 

XIntc_Enable(&InterruptController, XPAR_XPS_INTC_0_SYSTEM_BTN0_INTR); //For setting IER

 

XExc_mEnableExceptions(XEXC_ID_NON_CRITICAL_INT);

 

while(1){};

 

return 0;

}

 

 

 

 

 

c file GPIO (work):

 

static volatile unsigned int button_count = 0;

static XIntc InterruptController;

static XGpioButtons, Lights;

 

void button_pressed(void) {

print("interrupted..");

XGpio_InterruptClear(&Buttons, XGPIO_IR_CH1_MASK);

}

 

 

int

main (void) {

 

print("-- Entering ButtonsAndLights main() v1.9 --\r\n");

XExc_Init();

XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, (XExceptionHandler)XIntc_DeviceInterruptHandler, (void*)XPAR_XPS_INTC_0_DEVICE_ID);

XIntc_Initialize(&InterruptController, XPAR_XPS_INTC_0_DEVICE_ID);

XIntc_MasterEnable(XPAR_XPS_INTC_0_BASEADDR);

XIntc_Connect(&InterruptController, XPAR_XPS_INTC_0_PUSH_BUTTONS_POSITION_IP2INTC_IRPT_INTR,(

XInterruptHandler) button_pressed, (void*) 0);

XIntc_Enable(&InterruptController, XPAR_XPS_INTC_0_PUSH_BUTTONS_POSITION_IP2INTC_IRPT_INTR);

 

 

XExc_mEnableExceptions(XEXC_NON_CRITICAL);

if(XGpio_Initialize(&Buttons, XPAR_PUSH_BUTTONS_POSITION_DEVICE_ID) != XST_SUCCESS) {

 printf("Failed to initalize the buttons.\r\n");

}

else{

XGpio_SetDataDirection(&Buttons, 1, 0xFFFFFFFF);

XGpio_InterruptClear(&Buttons, XGPIO_IR_CH1_MASK);

XGpio_InterruptEnable(&Buttons, XGPIO_IR_CH1_MASK);

XGpio_InterruptGlobalEnable(&Buttons);

}

if(XGpio_Initialize(&Lights, XPAR_LEDS_4BIT_DEVICE_ID) != XST_SUCCESS) {

 

printf("Failed to initalize the LEDs.\r\n");

}

else{

XGpio_SetDataDirection(&Lights, 1, 0x00000000);

/* Switch all leds off */

XGpio_DiscreteWrite(&Lights, 1, 0x0F);

}

while(1) {}

 

 

return0;

}

 

 

 

 

 

Visitor
mehta.vishal.360
Posts: 14
Registered: ‎08-03-2011
0

Re: PPC Interrupt Problem

If you are using only one signal for interrupt i do not think so that you require an Interrupt Controller as per the document edk10_est_rm.pdf

Super Contributor
stephenm
Posts: 129
Registered: ‎05-06-2012
0

Re: PPC Interrupt Problem

I am not too sure if this line below is correct:

XIntc_Enable(&InterruptController, XPAR_XPS_INTC_0_SYSTEM_BTN0_INTR); //For setting IER

 

This needs to be the address mask, however, this seems to be a integer

 

See xapp778 for example code you can use as refernece.