- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-04-2012 03:00 AM - edited 07-04-2012 05:05 AM
Hello,
I am aware that it is quite a discussed topic in this forum. But I am still having troubles setting up the Microblaze to handle interrupts from my Custom Peripheral.
I have used the EDK Generated code to trigger an interrupt in my Custom IP ... The Custom IP generates only one interrupt. And I have checked the option use Device ISC in the EDK project CIP, when creating my custom IP with Interrupt control (I did not want to do this since I only want my custom IP to generate an Interrupt, but this was the only way I was able to initialize the xps_intc component in my EDK design. Otherwise it won't be initialized ). I have connected my Interrupt controller to the Microblaze Interrupt Pin. Now I am trying to detect an itnerrupt from my Custom peripheral in the software , but the C program control call never goes to the Interrupt Handle function (myhandle) that corresponds to interrupt from my custom IP name DEMO_INT. Instead it goes to (myhandler3) which is The Interrupt handler corresponding to a XPS timer, that also has an interrupt functionality. The DISR that i read in the C program alwasy reads back 0 always!! !.
------------------------------------------
-- Example code to generate user logic interrupts
--
-- Note:
-- The example code presented here is to show you one way of generating
-- interrupts from the user logic. This code snippet infers a counter
-- and generate the interrupts whenever the counter rollover (the counter
-- will rollover ~21 sec @50Mhz).
------------------------------------------
INTR_PROC : process( Bus2IP_Clk ) is
constant COUNT_SIZE : integer := 30;
constant ALL_ONES : std_logic_vector(0 to COUNT_SIZE-1) := (others => '1');
variable counter : std_logic_vector(0 to COUNT_SIZE-1);
begin
if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then
if ( Bus2IP_Reset = '1' ) then
counter := (others => '0');
intr_counter <= (others => '0');
else
counter := counter + 1;
if ( counter = ALL_ONES ) then
intr_counter <= (others => '1');
else
intr_counter <= (others => '0');
end if;
end if;
end if;
end process INTR_PROC;
IP2Bus_IntrEvent <= intr_counter;
BEGIN microblaze PARAMETER INSTANCE = microblaze_0 PARAMETER C_USE_BARREL = 1 PARAMETER C_DEBUG_ENABLED = 1 PARAMETER HW_VER = 8.20.a BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb BUS_INTERFACE DPLB = mb_plb BUS_INTERFACE IPLB = mb_plb BUS_INTERFACE DEBUG = microblaze_0_mdm_bus PORT MB_RESET = mb_reset PORT INTERRUPT = microblaze_0_Interrupt 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 = mb_plb PORT Intr = xps_timebase_wdt_0_Timebase_Interrupt & xps_timebase_wdt_0_WDT_Interrupt & xps_timer_0_Interrupt & cf_interface_v2_0_IP2INTC_Irpt PORT Irq = microblaze_0_Interrupt END ------------------------------------------- BEGIN int_demo PARAMETER INSTANCE = int_demo_0 PARAMETER HW_VER = 1.00.a PARAMETER C_BASEADDR = 0xca800000 PARAMETER C_HIGHADDR = 0xca80ffff BUS_INTERFACE SPLB = mb_plb PORT IP2INTC_Irpt = cf_interface_v2_0_IP2INTC_Irpt END
#include <stdio.h>
#include "platform.h"
#include "xtmrctr.h"
#include "xintc.h"
#include "xil_exception.h"
#include "xparameters.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "xintc_l.h"
#include "xintc_i.h"
int IntrStatus;
int IpStatus;
static XIntc InterruptController ;
void myhandler(void *baseAddr_p)
{
xil_printf("Caught interrupt from My Demo Controller Controller!\n\r");
}
void myhandler1(void *baseAddr_p)
{
xil_printf("Caught interrupt from My Demo Controller Controller 1!\n\r");
}
void myhandler2(void *baseAddr_p)
{
xil_printf("Caught interrupt from My Demo Controller Controller 2!\n\r");
}
void myhandler3(void *baseAddr_p)
{
xil_printf("Caught interrupt from My Demo Controller Controller 3!\n\r");
}
int main()
{
XStatus Status;
init_platform();
/* Initialize the interrupt controller driver so that
* it's ready to use, specify the device ID that is generated in
* xparameters.h
*/
xil_printf("Starting interrupts...\n\r");
xil_printf("\n\r");
Status = XIntc_Initialize(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_DEVICE_ID);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
// Register the interrupt
XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_INT_DEMO_0_IP2INTC_IRPT_INTR, (XInterruptHandler)myhandler, (void *)XPAR_INT_DEMO_0_BASEADDR);
XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_XPS_TIMER_0_INTERRUPT_INTR, (XInterruptHandler)myhandler1, (void *)XPAR_XPS_TIMER_0_BASEADDR);
XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_XPS_TIMEBASE_WDT_0_WDT_INTERRUPT_I NTR, (XInterruptHandler)myhandler2, (void *)XPAR_XPS_TIMEBASE_WDT_0_BASEADDR);
XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, XPAR_XPS_INTC_0_XPS_TIMEBASE_WDT_0_TIMEBASE_INTERR UPT_INTR, (XInterruptHandler)myhandler3, (void *)0);
// Enable all the individual interrupts
XIntc_EnableIntr(XPAR_XPS_INTC_0_BASEADDR,
XPAR_INT_DEMO_0_IP2INTC_IRPT_MASK | XPAR_XPS_TIMER_0_INTERRUPT_MASK
| XPAR_XPS_TIMEBASE_WDT_0_WDT_INTERRUPT_MASK | XPAR_XPS_TIMEBASE_WDT_0_TIMEBASE_INTERRUPT_MASK);
// Start the interrupt controller
XIntc_MasterEnable(XPAR_XPS_INTC_0_BASEADDR);
microblaze_enable_interrupts();
while(1)
{
IntrStatus = XIntc_GetIntrStatus(XPAR_XPS_INTC_0_BASEADDR);
if (IntrStatus != 0)
{
xil_printf("\n\r - Waiting for Device Interrupt! DISR value : 0x%08x \n \n ", IntrStatus);
}
}
xil_printf("Waiting for interrupts...\n\r");
xil_printf("\n\r");
cleanup_platform();
return 0;
}
All the code is attached. Could someone point me to the mistake?
Thank You,
Venkat
Solved! Go to Solution.
Re: Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-05-2012 05:16 AM
Also I read out the Registers in my XPS_INTC block from the base address+offset
while(1)
{
for (i=0;i<REG_COUNT;i++)
{
Intr_Reg[i] = MY_INTR_mReadReg(XPAR_XPS_INTC_0_BASEADDR, i*4);
xil_printf("read %08x from Intr register %08x \n", Intr_Reg[i], XPAR_XPS_INTC_0_BASEADDR+(i*4));
}
printf("\n\n");
}
The values I get are
read 00000000 from Intr register 81800000
read 00000000 from Intr register 81800004
read 0000000F from Intr register 81800008
read 00000000 from Intr register 8180000C
read 00000000 from Intr register 81800010
read 00000000 from Intr register 81800014
read FFFFFFFF from Intr register 81800018
read 00000003 from Intr register 8180001C
I am running out out Ideas. Could someone help me with whats going wrong ?
Thanks,
Venkat.
Re: Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-18-2012 01:07 AM
I am still not able to solve this issue . Could some one point me to the mistake I am doing ?
Strange thing is ,,, the interrupt from XPS_Timer_wdt works fine. But I do not see the interrupt from my the Custom IP ..
Re: Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-27-2012 08:19 AM
You should try to connect to Interrupt Controller directly your signal without the device interrupt controller (inside your device) that EDK instances when you create the peripheral and select interruptions. In other words, don't use IP2Bus_IntrEvent signal. Instead of this, create a output signal of your peripheral and connect directly this signal to the Interrupt Controller.
But I have also a similar problem. I'm detecting my device interrupt in the registers of the interrupt controller, but the program don't call my handle function. I'm executing also the example code xintc_example.c,v 1.1.2.1 2011/05/24 07:09:38 vidhum Exp, and I'm still having the same problem. My EDK version is 13.4.
Re: Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-27-2012 09:08 AM
Ha,,, Finally one reply for my post .
Yea,, its really wierd ..... you are right.. Actually,, I bypassed the Interrupt controller inside my custom IP and connected the signal from my user logic to an LED signal of the board. And it worked. I haven't tried bypassing this int controller inside custom IP and connecting my signal directly to XPS_INTC. dont know how I missed that. really stupid of me. I will try it and keep you updated. In the meanwhile, I have also opened up a webcase regarding this issue. I hope they ll be able to provide some answers.
Cheers
Venkat.
Re: Microblaze interrupts with custom peripheral doesn't WORK with EDK13.3!!!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-08-2012 07:12 AM
Hello Again ,,
your solution worked.. I dont know why you do not see the software callback function of your custom IP.
But when i bypassed the interrupt_control_v2_01_a.interrupt_control component inside the toplevel.vhd in the customIP, I was able to see my interrrupts in the software..
Regards,
Venkat.











