cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
9,867 Views
Registered: ‎04-09-2008

Microblaze: interrupt from custom made peripheral

Jump to solution

Hi,

 

my intension is to detect an interrupt from a custom made peripheral. I use the following code (just for testing):

 

int IntrStatus;

int IpStatus;

static XIntc InterruptController;

void Int_Handler(void){

 

  EXT_INT_mWriteReg(XPAR_EXT_INT_0_BASEADDR, EXT_INT_INTR_DGIER_OFFSET, 0x0);

 

 

  IntrStatus = EXT_INT_mReadReg(XPAR_EXT_INT_0_BASEADDR,EXT_INT_INTR_DISR_OFFSET);

  xil_printf(
"\n\r - Device Interrupt! DISR value : 0x%08x \n\r", IntrStatus);

 

  IpStatus = EXT_INT_mReadReg(XPAR_EXT_INT_0_BASEADDR, EXT_INT_INTR_IPISR_OFFSET);

  EXT_INT_mWriteReg(XPAR_EXT_INT_0_BASEADDR, EXT_INT_INTR_IPISR_OFFSET, IpStatus);

}

 

int main()

{

XStatus Status;

 

 

Status = XIntc_Initialize(&InterruptController, XPAR_XPS_INTC_0_DEVICE_ID);

 

if (Status != XST_SUCCESS)

{

print(
"\n\r --> ERROR 1"); return XST_FAILURE;

}

 

 

Status = XIntc_Connect(&InterruptController, XPAR_XPS_INTC_0_EXT_INT_0_IP2INTC_IRPT_INTR, (XInterruptHandler)Int_Handler,(
void *)0);

 

if (Status != XST_SUCCESS)

{

print(
"\n\r --> ERROR 2"); return XST_FAILURE;

}

 

Status = XIntc_Start(&InterruptController, XIN_REAL_MODE);

 

if (Status != XST_SUCCESS)

{

print(
"\n\r --> ERROR 3"); return XST_FAILURE;

}

 

XIntc_Enable(&InterruptController, XPAR_XPS_INTC_0_EXT_INT_0_IP2INTC_IRPT_INTR);

 

 

EXT_INT_EnableInterrupt((
void *)XPAR_EXT_INT_0_BASEADDR);

 

IntrStatus = EXT_INT_mReadReg(XPAR_EXT_INT_0_BASEADDR,EXT_INT_INTR_DISR_OFFSET);

xil_printf(
"\n\r - Device Interrupt! DISR value : 0x%08x \n\r", IntrStatus);

 

 

microblaze_enable_interrupts();

while(1)

{

IntrStatus = EXT_INT_mReadReg(XPAR_EXT_INT_0_BASEADDR,EXT_INT_INTR_DISR_OFFSET);

xil_printf("\n\r - Device Interrupt! DISR value : 0x%08x \n\r", IntrStatus);

 

}

 

return 0;

 

I can see that the interrupt status register changes from 0x00000000 to 0x00000004 when an interrupt is detected. The problem however is that the program never jumps to the Int_Handler function.

Does anyone knows the reason for this?

 

Thx in advance,

Ruben

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
10,838 Views
Registered: ‎10-02-2007

Hi,

 

The Interrupt Status bit is High, has the interrupt signal reached to xps_intc.

Is it connectable with microblaze from xps_intc?

Although the following is an extract from a part of an MHS file, Irq of xps_intc has

connected with Interrupt of Microblaze.

 

Best Regards,

Yoshio Kashiwagi - Nissin Systems

 

BEGIN microblaze
 PARAMETER INSTANCE = microblaze_0
 PARAMETER C_INTERCONNECT = 1
 PARAMETER HW_VER = 7.10.b
 PARAMETER C_DEBUG_ENABLED = 1
 PARAMETER C_AREA_OPTIMIZED = 1
 BUS_INTERFACE DLMB = dlmb
 BUS_INTERFACE ILMB = ilmb
 BUS_INTERFACE DPLB = mb_plb
 BUS_INTERFACE IPLB = mb_plb
 BUS_INTERFACE DEBUG = microblaze_0_dbg
 PORT MB_RESET = mb_reset

 PORT Interrupt = Interrupt
END


BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0x81800000
 PARAMETER C_HIGHADDR = 0x8180ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT Irq = Interrupt
 PORT Intr = RS232_DTE_Interrupt & Rotary_Encoder_IP2INTC_Irpt & Ethernet_MAC_IP2INTC_Irpt
END

 

View solution in original post

0 Kudos
3 Replies
Highlighted
Contributor
Contributor
10,839 Views
Registered: ‎10-02-2007

Hi,

 

The Interrupt Status bit is High, has the interrupt signal reached to xps_intc.

Is it connectable with microblaze from xps_intc?

Although the following is an extract from a part of an MHS file, Irq of xps_intc has

connected with Interrupt of Microblaze.

 

Best Regards,

Yoshio Kashiwagi - Nissin Systems

 

BEGIN microblaze
 PARAMETER INSTANCE = microblaze_0
 PARAMETER C_INTERCONNECT = 1
 PARAMETER HW_VER = 7.10.b
 PARAMETER C_DEBUG_ENABLED = 1
 PARAMETER C_AREA_OPTIMIZED = 1
 BUS_INTERFACE DLMB = dlmb
 BUS_INTERFACE ILMB = ilmb
 BUS_INTERFACE DPLB = mb_plb
 BUS_INTERFACE IPLB = mb_plb
 BUS_INTERFACE DEBUG = microblaze_0_dbg
 PORT MB_RESET = mb_reset

 PORT Interrupt = Interrupt
END


BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0x81800000
 PARAMETER C_HIGHADDR = 0x8180ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT Irq = Interrupt
 PORT Intr = RS232_DTE_Interrupt & Rotary_Encoder_IP2INTC_Irpt & Ethernet_MAC_IP2INTC_Irpt
END

 

View solution in original post

0 Kudos
Highlighted
Visitor
Visitor
9,800 Views
Registered: ‎04-09-2008

Here's my mhs file:

 

PARAMETER VERSION = 2.1.0


 PORT fpga_0_RS232_RX_pin = fpga_0_RS232_RX, DIR = I
 PORT fpga_0_RS232_TX_pin = fpga_0_RS232_TX, DIR = O
 PORT sys_clk_pin = dcm_clk_s, DIR = I, SIGIS = CLK, CLK_FREQ = 50000000
 PORT sys_rst_pin = sys_rst_s, DIR = I, RST_POLARITY = 1, SIGIS = RST
 PORT ext_int_0_interrupt_pin_pin = ext_int_0_interrupt_pin, DIR = I


BEGIN microblaze
 PARAMETER INSTANCE = microblaze_0
 PARAMETER C_INTERCONNECT = 1
 PARAMETER HW_VER = 7.10.a
 PARAMETER C_DEBUG_ENABLED = 1
 PARAMETER C_AREA_OPTIMIZED = 1
 BUS_INTERFACE DLMB = dlmb
 BUS_INTERFACE ILMB = ilmb
 BUS_INTERFACE DPLB = mb_plb
 BUS_INTERFACE IPLB = mb_plb
 BUS_INTERFACE DEBUG = microblaze_0_dbg
 PORT MB_RESET = mb_reset
END

BEGIN plb_v46
 PARAMETER INSTANCE = mb_plb
 PARAMETER HW_VER = 1.02.a
 PORT PLB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN lmb_v10
 PARAMETER INSTANCE = ilmb
 PARAMETER HW_VER = 1.00.a
 PORT LMB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN lmb_v10
 PARAMETER INSTANCE = dlmb
 PARAMETER HW_VER = 1.00.a
 PORT LMB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN lmb_bram_if_cntlr
 PARAMETER INSTANCE = dlmb_cntlr
 PARAMETER HW_VER = 2.10.a
 PARAMETER C_BASEADDR = 0x00000000
 PARAMETER C_HIGHADDR = 0x00003fff
 BUS_INTERFACE SLMB = dlmb
 BUS_INTERFACE BRAM_PORT = dlmb_port
END

BEGIN lmb_bram_if_cntlr
 PARAMETER INSTANCE = ilmb_cntlr
 PARAMETER HW_VER = 2.10.a
 PARAMETER C_BASEADDR = 0x00000000
 PARAMETER C_HIGHADDR = 0x00003fff
 BUS_INTERFACE SLMB = ilmb
 BUS_INTERFACE BRAM_PORT = ilmb_port
END

BEGIN bram_block
 PARAMETER INSTANCE = lmb_bram
 PARAMETER HW_VER = 1.00.a
 BUS_INTERFACE PORTA = ilmb_port
 BUS_INTERFACE PORTB = dlmb_port
END

BEGIN xps_uartlite
 PARAMETER INSTANCE = RS232
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BAUDRATE = 9600
 PARAMETER C_DATA_BITS = 8
 PARAMETER C_ODD_PARITY = 0
 PARAMETER C_USE_PARITY = 0
 PARAMETER C_SPLB_CLK_FREQ_HZ = 50000000
 PARAMETER C_BASEADDR = 0x84000000
 PARAMETER C_HIGHADDR = 0x8400ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT RX = fpga_0_RS232_RX
 PORT TX = fpga_0_RS232_TX
END

BEGIN clock_generator
 PARAMETER INSTANCE = clock_generator_0
 PARAMETER HW_VER = 2.00.a
 PARAMETER C_EXT_RESET_HIGH = 1
 PARAMETER C_CLKIN_FREQ = 50000000
 PARAMETER C_CLKOUT0_FREQ = 50000000
 PARAMETER C_CLKOUT0_BUF = TRUE
 PARAMETER C_CLKOUT0_PHASE = 0
 PARAMETER C_CLKOUT0_GROUP = NONE
 PORT CLKOUT0 = sys_clk_s
 PORT CLKIN = dcm_clk_s
 PORT LOCKED = Dcm_all_locked
 PORT RST = net_gnd
END

BEGIN mdm
 PARAMETER INSTANCE = debug_module
 PARAMETER HW_VER = 1.00.b
 PARAMETER C_MB_DBG_PORTS = 1
 PARAMETER C_USE_UART = 1
 PARAMETER C_UART_WIDTH = 8
 PARAMETER C_BASEADDR = 0x84400000
 PARAMETER C_HIGHADDR = 0x8440ffff
 BUS_INTERFACE SPLB = mb_plb
 BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg
 PORT Debug_SYS_Rst = Debug_SYS_Rst
END

BEGIN proc_sys_reset
 PARAMETER INSTANCE = proc_sys_reset_0
 PARAMETER HW_VER = 2.00.a
 PARAMETER C_EXT_RESET_HIGH = 1
 PORT Slowest_sync_clk = sys_clk_s
 PORT Dcm_locked = Dcm_all_locked
 PORT Ext_Reset_In = sys_rst_s
 PORT MB_Reset = mb_reset
 PORT Bus_Struct_Reset = sys_bus_reset
 PORT MB_Debug_Sys_Rst = Debug_SYS_Rst
 PORT Peripheral_Reset = sys_periph_reset
END

BEGIN ext_int
 PARAMETER INSTANCE = ext_int_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0xcd800000
 PARAMETER C_HIGHADDR = 0xcd80ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT IP2INTC_Irpt = ext_int_0_IP2INTC_Irpt_0
 PORT interrupt_pin = ext_int_0_interrupt_pin
 PORT SPLB_Clk = sys_clk_s
END

BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0x81800000
 PARAMETER C_HIGHADDR = 0x8180ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT SPLB_Clk = sys_clk_s
 PORT Intr = ext_int_0_IP2INTC_Irpt_0
END

 

I just can't figure out what's wrong

Ruben

0 Kudos
Highlighted
Visitor
Visitor
9,797 Views
Registered: ‎04-09-2008

Ok I can see what I did wrong

It's like you suggested: I didn't  connect the output of the xps_intc_0 device to the interrupt input of the microblaze processor.

Thank you very much for your help
Ruben

0 Kudos