cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vikaskanha
Contributor
Contributor
1,306 Views
Registered: ‎10-24-2018

MICROBLAZE IN VIRTEX-7

Jump to solution

Hello all,

I want to a create a microblaze design with AXI Timer interrupt, AXI Dma interrupt and GPIO Interrupt driven by virtex-7 FPGA core. Please help me with any availaible design or answer records.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
stephenm
Moderator
Moderator
837 Views
Registered: ‎09-12-2007

Can you mark this thread as solved, and open a new thread for this latest question please?

View solution in original post

0 Kudos
23 Replies
vikaskanha
Contributor
Contributor
1,261 Views
Registered: ‎10-24-2018

Hello all,

I am eagerly waiting for your reply so that i can proceed. Please guide me.

Thanks & Regards

 

0 Kudos
dpaul24
Scholar
Scholar
1,249 Views
Registered: ‎08-07-2014

@vikaskanha,

Self-help is the best help!

Instead of waiting for others, why don't you search with the phrase - "getting started with microblaze"?

There are numerious tutorials available.

------------FPGA enthusiast------------
Consider giving "Kudos" if you like my answer. Please mark my post "Accept as solution" if my answer has solved your problem

vikaskanha
Contributor
Contributor
1,197 Views
Registered: ‎10-24-2018

I followed the ug940 lab 3 and finished lab 3. Now i want to generate  interrupt at every 2 ms from timer that will read in microblaze. How this i have to do? Please guide.

0 Kudos
stephenm
Moderator
Moderator
1,187 Views
Registered: ‎09-12-2007

There is a example code or the drivers that you can use as a reference:

https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/tmrctr/examples

vikaskanha
Contributor
Contributor
1,166 Views
Registered: ‎10-24-2018

I am able to generate 2 ms interrupt. Now i want gpio interuppt. My target is when i will press push button it should print a message on terminal. Currently when pressing push button and releasing it both time it is pring on the terminal. I think it is configured for both rising and falling edge. How to configure it for rising edge only. I am following  the xgpio_intr_tapp_example.

0 Kudos
stephenm
Moderator
Moderator
1,155 Views
Registered: ‎09-12-2007

You can set the interrupt sensivity in the Interrupt controller:

sen.PNG

By default this will be level edge. However, you can se this to be rising edge (Level=0, rising= 1):

for example, this capture the interupt on the rising edge on the gpio interrupt signal:

rising_edge.PNG

I used the VIO to stimulate a GPIO signal (If you are uisng a psuhbutton you might want to use debounce logic):

bd.PNG

 

My code is seen above. In the handler, I print out the amout of interrupts that have occured:

Note: I also ack and clear the gpio interrupt

void InterruptHandler(void *CallbackRef)
{
 xil_printf("Interrupt Count: %u\r\n", count);
 XGpio_InterruptClear(&Gpio, 0x1);
 XIntc_Acknowledge(&Intc, XPAR_MICROBLAZE_0_AXI_INTC_AXI_GPIO_0_IP2INTC_IRPT_INTR);
 count++;
}

You should see the interrupts increment:

console.png

My code is attached

 

 

vikaskanha
Contributor
Contributor
1,138 Views
Registered: ‎10-24-2018

Sir,

I have completely followed the sequence given in the  .c file and block design, but still i am getting the inrerrupt on both the edge.

Thanks & Regards

0 Kudos
vikaskanha
Contributor
Contributor
1,123 Views
Registered: ‎10-24-2018

I checked in ILA. Problem is not with the interrupt controller. Its AXI GPIO problem. Actually ip2intcirpt giving interrupt at both pressing and releasing time. How to configure AXI GPIO to give interrupt at rising edge only?

0 Kudos
stephenm
Moderator
Moderator
1,115 Views
Registered: ‎09-12-2007

This is the expected behaviour as mentioned i nthe AXI GPIO guide:

interrupt.PNG

 

vikaskanha
Contributor
Contributor
1,097 Views
Registered: ‎10-24-2018

Sir,

I want to pass only rising edge transition interrupt from gpio module  to interrupt  controller module. How Should i block the falling edge transition transition interrupt from gpio module to interrupt controller module.  

Thanks & Regards

0 Kudos
stephenm
Moderator
Moderator
1,086 Views
Registered: ‎09-12-2007

When you added the ILA, Did you see two interrupts. One for press, one for release?

vikaskanha
Contributor
Contributor
1,070 Views
Registered: ‎10-24-2018

Yes, In ILA i saw two interrupts. One For press and one for release. If you will not release second one will not come.

0 Kudos
stephenm
Moderator
Moderator
1,052 Views
Registered: ‎09-12-2007

Ok, then you can simply add a check in the interruot handler to read the DATA register in the GPIO to see if this is 0 or 1 and act accordingly:

void InterruptHandler(void *CallbackRef)
{
 u32 data = Xil_In32(XPAR_AXI_GPIO_0_BASEADDR);
 if (data == 1) {
  xil_printf("Interrupt Count: %u\r\n", count);
  count++;
 }
 XGpio_InterruptClear(&Gpio, 0x1);
 XIntc_Acknowledge(&Intc, XPAR_MICROBLAZE_0_AXI_INTC_AXI_GPIO_0_IP2INTC_IRPT_INTR);
}

 

In the code above, the interrupt counter will only increment if the first bit in the data register is high. In your case if there is a press

on the button.

 

 

 

vikaskanha
Contributor
Contributor
1,032 Views
Registered: ‎10-24-2018

Sir,

Now i am able to get print at the time of button press. Thanks a lot for your valuable inputs and time. Meanwhile, with the reference of examples given with axi timer i  generated a 2 ms timer as a separate design. Now i want to stop and start my timer when there will be a button press. Basically there will be 2 sources of interrupts now. I want to give button press as higher priority. How to set this priority things? Apart from this what things i have to take care.

Thanks & Regards

0 Kudos
stephenm
Moderator
Moderator
1,025 Views
Registered: ‎09-12-2007

What are the two sources of the interrupt? Are you generating an interrupt from the AXI Timer?, and the GPIO. The priority on the Interrupt controller is determined by the vector position. So, the LSB is highest. So, if you want to GPIO to be the highest, then make sure that this is at the LSB:

https://www.xilinx.com/support/documentation/ip_documentation/axi_intc/v4_1/pg099-axi-intc.pdf

 

 

0 Kudos
vikaskanha
Contributor
Contributor
1,003 Views
Registered: ‎10-24-2018

Yes, For me two sources of interrupt are GPIO and Timer. I will stop and start my timer at the time of gpio interruppt. I connnected 0th bit (of INTR port on interrupt controller using concat)to the gpio interrupt and 1st bit to the timer interrupt.There is two concept one is normal interrupt and one is fast interrupt. what is fast interrupt . will it reduce my latency. How to infere this in my sdk side.

0 Kudos
stephenm
Moderator
Moderator
987 Views
Registered: ‎09-12-2007

Ok, so you will have two handlers; one for timer the other for gpio. In the gpio handler you can reuse the code I sent, but handle the timer here, stop, reset counter, ECT

 

The fast reset is discussed in ug984. Basically, it passes the vector address to the MB so it can just directly to the handler.

0 Kudos
vikaskanha
Contributor
Contributor
973 Views
Registered: ‎10-24-2018

Sir,

Now i am able to use gpio and timer interrupt simultaneously. Now i have checked fast interrupt logic mode option in a AXI-INTC IP customisation. In SDK, i wrote 0x03 at (INTC_BASE_ADDRESS +XIN_IMR_OFFSET). Is it correct.

1). If it is correct how i will verify its advantages over normal mode interrupt. My timer is giving interrupt at every 2ms.

2). SIr, i also want to reset my timer count not period  (for once  it will run with that count. )

Thanks & Regards

0 Kudos
stephenm
Moderator
Moderator
971 Views
Registered: ‎09-12-2007

Fast interrupts are not really needed in your setup. It would be more useful in a realtime app where users need deterministic interrupts. 

 

You could measure the performance by using a scope to measure time between push button and handler. 

0 Kudos
vikaskanha
Contributor
Contributor
959 Views
Registered: ‎10-24-2018

Sir, I also want to reset my timer count not period  (for once  it will run with that count). I think, i have to write TCR register for this purpose. Is it correct?

0 Kudos
vikaskanha
Contributor
Contributor
843 Views
Registered: ‎10-24-2018

Sir,

Meanwhile i am trying to add (AXI DMA + AXI-4 DATA FIFO) in microblaze. But i am not getting where to connect M_AXI_MM2S and M_AXI_S2MM.

Thanks & Regards

0 Kudos
stephenm
Moderator
Moderator
838 Views
Registered: ‎09-12-2007

Can you mark this thread as solved, and open a new thread for this latest question please?

View solution in original post

0 Kudos