UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
11,431 Views
Registered: ‎11-23-2014

MicroBlaze fast interrupt

Jump to solution

Hi,

 

I try to create design with microblaze on ZYNQ 7020 on Vivado/SDK 2015.1 wich uses AXI Interrupt Controller with this configuration:

 

Interrupt Type: Edge Interrupt

Edge Type: Rising

 

Enable Fast Interrupt Logic: Enabled

 

Enable Set Interrupt Enable Register: Disabled

Enable Clear Interrupt Enable Register: Disabled

Enable Interrupt Vector Register: Enabled

Enable Interrupt Pending Register: Enabled

Enable Interrupt Level Register: Disabled

 

Cascade Mode: Disabled at all

 

The interrupt source is only one and is connected to the external pin (button on zedboard)

 

the constraints for button is as follows:

 

set_property PACKAGE_PIN P16 [get_ports enb]
set_property IOSTANDARD LVCMOS33 [get_ports enb]
set_property PULLDOWN true [get_ports enb]

 

In the SDK part I try to initialize the interrupt controller and use my own handler for fast interrupt without any input arguments.

The code look as follows:

 

#include "xio.h"
#include "xil_types.h"
#include "xparameters.h"
#include "mb_interface.h"
#include "xil_exception.h"
#include "intc_v3_3/src/xintc.h"

 

unsigned X=0;

 

 

 

void testHandler(void)
{
X = 5 + 1;
}

 

int main(void)

{

XIntc XIntcSetStruct;

XIntc_Initialize(&XIntcSetStruct, XPAR_MICROBLAZE_0_AXI_INTC_DEVICE_ID);


XIntc_ConnectFastHandler(&XIntcSetStruct, 0, testHandler);


XIntc_Start(&XIntcSetStruct, XIN_REAL_MODE);

 

XIntc_Enable(&XIntcSetStruct, 0);


Xil_ExceptionInit();


Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XIntc_InterruptHandler,&XIntcSetStruct);


Xil_ExceptionEnable();


for(;;);

}

 

I use only one interrupt, hence the "0" in functions. There is no input argument for fast interrupt handler(pointer to the interrupt component instance) so I suppose there is no need to ack the intrrupt in the case of fast interrupt. But maybe this is the critical point but I'm not sure. The true is that after processing all functions when I push the button, the program doesn't jump to my "testHandler". Does anybody know where is a problem? Thank you a lot for any feebacks.

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
19,945 Views
Registered: ‎10-08-2010

Re: MicroBlaze fast interrupt

Jump to solution

In that case I think the issue has to be in hardware, because I have verified that the code works here. I would suggest that you start by double checking that your hardware interrupt source actually generates an interrupt. How are you checking if the handler is called?  What I did was set a breakpoint in the handler code, and check that it was reached.

 

View solution in original post

0 Kudos
9 Replies
Xilinx Employee
Xilinx Employee
11,415 Views
Registered: ‎06-14-2012

Re: MicroBlaze fast interrupt

Jump to solution

Hi

You have to check all the boxes for AXI INTC.

Enable Set Interrupt Enable Register Setting this option includes Set Interrupt Enable Register. Enable Clear Interrupt Enable Register Setting this option includes Clear Interrupt Enable Register. Enable Interrupt Vector Register Setting this option includes Interrupt Vector Register. Enable Interrupt Pending Register Setting this option includes Interrupt Pending register.

 

You can also check the example from SDK install.

 

Regards

Sikta

 

 

0 Kudos
Contributor
Contributor
11,412 Views
Registered: ‎11-23-2014

Re: MicroBlaze fast interrupt

Jump to solution

Hi siktap,

 

many thanks for fast reply, but still it doesn't work (no jumping to handler)...

0 Kudos
Contributor
Contributor
11,411 Views
Registered: ‎11-23-2014

Re: MicroBlaze fast interrupt

Jump to solution

I also tryed use this construct :

 

XIntc_ConnectFastHandler(&XIntcSetStruct, 0,  (XFastInterruptHandler)testHandler);

 

intead of this:

 

XIntc_ConnectFastHandler(&XIntcSetStruct, 0,  (XInterruptHandler)testHandler);

 

But still nothing...

0 Kudos
Xilinx Employee
Xilinx Employee
11,397 Views
Registered: ‎10-08-2010

Re: MicroBlaze fast interrupt

Jump to solution

Hi,

 

There is one thing missing from your code: With fast interrupts you need to use the attribute fast_interrupt when declaring the interrupt routine. This is necessary to tell the compiler to emit the special code required for a fast interrupt handler. You can read more about this in UG984, MicroBlaze Processor Reference Guide, p.171.

 

An updated code is attached, where I also changed the type cast to XFastInterruptHandler, like you already figured out.

 

This code works for me.

 

Contributor
Contributor
11,392 Views
Registered: ‎11-23-2014

Re: MicroBlaze fast interrupt

Jump to solution

Thanks for reply!

 

I believe that is one of the problems. But still no jump. I've noticed thet the Handler in Handler Table inside the "XIntcSetStruct" has different address stored then the actually address of handler wich is stored in other pointer for check. Even if I force the right address to the handler parameter of struct, nothing happens.  

0 Kudos
Xilinx Employee
Xilinx Employee
19,946 Views
Registered: ‎10-08-2010

Re: MicroBlaze fast interrupt

Jump to solution

In that case I think the issue has to be in hardware, because I have verified that the code works here. I would suggest that you start by double checking that your hardware interrupt source actually generates an interrupt. How are you checking if the handler is called?  What I did was set a breakpoint in the handler code, and check that it was reached.

 

View solution in original post

0 Kudos
Contributor
Contributor
11,387 Views
Registered: ‎11-23-2014

Re: MicroBlaze fast interrupt

Jump to solution

I'm checking it as well. In Vivado I enabled all registers adn Interrupt source is set as I write earlier: Edge Interrupt, Rising. The Pin in block design is set in Same way, as interrupt type and with "EDGE_RISING" param.

0 Kudos
Contributor
Contributor
11,370 Views
Registered: ‎11-23-2014

Re: MicroBlaze fast interrupt

Jump to solution

Well! Well! Well!

 

The problem was in reset of AXI Interrupt Controller. Reset wasn't connected to the processor reset of microblaze but to peripheral reset wich has diferent polarity and therefore the irq output of controller stil was in Hight state. But thank a lot both of you guys. The problem was on more places and you helped me figured it out. Thank you once more again. 

0 Kudos
Visitor mloutris
Visitor
1,118 Views
Registered: ‎11-21-2018

Re: MicroBlaze fast interrupt

Jump to solution

Could the attribute information please be placed in the online API documentation for 'XIntc_ConnectFastHandler()' please?
It makes more sense to group this information in one place.

0 Kudos