cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bartiko
Adventurer
Adventurer
12,444 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
stefana
Xilinx Employee
Xilinx Employee
20,958 Views
Registered: ‎10-08-2010

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
siktap
Scholar
Scholar
12,428 Views
Registered: ‎06-14-2012

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
bartiko
Adventurer
Adventurer
12,425 Views
Registered: ‎11-23-2014

Hi siktap,

 

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

0 Kudos
bartiko
Adventurer
Adventurer
12,424 Views
Registered: ‎11-23-2014

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
stefana
Xilinx Employee
Xilinx Employee
12,410 Views
Registered: ‎10-08-2010

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.

 

bartiko
Adventurer
Adventurer
12,405 Views
Registered: ‎11-23-2014

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
stefana
Xilinx Employee
Xilinx Employee
20,959 Views
Registered: ‎10-08-2010

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
bartiko
Adventurer
Adventurer
12,400 Views
Registered: ‎11-23-2014

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
bartiko
Adventurer
Adventurer
12,383 Views
Registered: ‎11-23-2014

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
mloutris
Visitor
Visitor
2,131 Views
Registered: ‎11-21-2018

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