cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
2,363 Views
Registered: ‎07-13-2017

ERROR in SDK Example xgpoi_intr_tapp_example.c on VCU108 board

I build the example microblaze with AXI support which synthesized, implemented and built the bit stream.  I exported the hardware and luanched the SDK.  I created some of the examples for the gpio.  I was able to get 3 of the four examples working.  I recieved a compile error in the xgpoi_intr_tapp_example.c example.

 

'XPAR_INTC_0_GPIO_0_VEC_ID' undeclared (first use in this function)	
xgpio_intr_tapp_example.c
/helloworld_bsp_xgpio_intr_tapp_example_1/src
line 93 C/C++ Problem

It's failing on the define of INTC_GPIO_INTERRUPT_ID:

#ifdef XPAR_INTC_0_DEVICE_ID
 #define INTC_GPIO_INTERRUPT_IDXPAR_INTC_0_GPIO_0_VEC_ID
 #define INTC_DEVICE_ID	XPAR_INTC_0_DEVICE_ID
#else
 #define INTC_GPIO_INTERRUPT_ID	XPAR_FABRIC_AXI_GPIO_0_IP2INTC_IRPT_INTR
 #define INTC_DEVICE_ID	XPAR_SCUGIC_SINGLE_DEVICE_ID
#endif /* XPAR_INTC_0_DEVICE_ID */

Given that this an example, I figured that there is something wrong in the steps leading up to this.

 

I did a search of the forums for: xgpoi_intr_tapp_example nad XPAR_INTC_0_GPIO_0_VEC_ID and came up with a few results but not related to my problem.

 

0 Kudos
2 Replies
Highlighted
Visitor
Visitor
411 Views
Registered: ‎04-25-2019

I imagine the original poster figured this out.  I'm replying for the benefit of other newbies like me who may run into this thread.  

In Vivado 18.3, axiGPIO instances do not have interrupts enabled by default.  First, turn it on for your instance by double-clicking the center and checking the box.  Then connect the newly created interrupt port to your interrupt concatentor (e.g., microblaze_0_xlconcat).  You probably will need to reconfigure it for more ports - turns out the interrupt vector of interest will be the same as the "In{x}[0:0]" in the concatenator.

Regenerate the bitstream and export it to the SDK.  I had some problem getting the new BSP to take, so I trashed my .src directory and started over with the export->SDK.  Probably a simpler way for experienced users.

0 Kudos
Highlighted
Visitor
Visitor
346 Views
Registered: ‎04-25-2019

Revised answer - This assumes that you are using Microblaze and need external interrupts and are starting from the SDK sample code (see the hyperlinks in {your project}_bsp/system.mss). 

The "XPAR_INTC_0_GPIO_0_VEC_ID" is not generated unless the AXI_GPIO instance in the board design has its interrupts enabled (double-click & checkbox), and its ip2intc_irpt is connected to a concatenator which is connected to an axi interrupt controller which connected to the Microblaze. 

At some point in the bitstream generation process, a file called xparameter.h (or similar) is created and it will include definitions for everything properly connected in the design file, including the missing vector id definition.  Export to SDK and launch it.  

Other potential stumbling blocks -

If you are testing leds and buttons, they should connect in the design to a single axi_gpio instance (the demo source assumes it's #0, if you have more than one), using its two available channels.  The demo source lets you define the constant "GPIO_CHANNEL1" to 1 or 2, corresponding respectively to GPIO and GPIO2 of the axi_gpio in the Vivado design file.  (A clearer label would be "GPIO_CHANNEL" without the digit.)

Also, check that the #define BUTTON_INTERRUPT references the correct channel for your design: XGPIO_IR_CH1_MASK, or XGPIO_IR_CH2_MASK, or XGPIO_IR_MASK (for either channel).

Sounds more complicated than it is.  Pick a channel for buttons in the design and make sure the code references the same channel consistently.

I have seen recommendations to include "microblaze_enable_interrupts(); early in the source code.  The demo code seems to have sufficient, if more targeted, interrupt enabling in my tests, but YMMV.

 

0 Kudos