Reply
Avnet Employee (Star Contributor)
Posts: 471
Registered: ‎04-16-2009

Tutorial - Adding Interrupts to Video DMA

[ Edited ]

Adding interrupt functionality to the Video DMA cores allows an application to react to the transfer completion of a frame of video. 

 

A typical application would be to use this interrupt to gather statistics on the camera input, and to perform adaptive processing such as automatic white balance.

 

The tutorial below describes how to enable interrupt functionality to the Video DMA cores in the Camera Reference Design (EDK 12.2 version).

 

===============================================================

To add interrupt functionality to the "hardware" portion of the FPGA design,

follow the following steps:

 

Step HW-1) Add a xps_intc PCORE to the project

  • click on the IP Catalog Tab
  • open the "Clock, Reset and Interrupt" category
  • add the "XPS Interrupt Controller" PCORE to the project
  • click OK to accept default settings

 

Step HW-2) Configure the xps_intc PCORE

  • connect the PCORE to the mb_plb PLB bus
                    BUS_INTERFACE SPLB = mb_plb
  • configure the address of the xps_intc PCORE
                    PARAMETER C_BASEADDR = 0x20020000
                    PARAMETER C_HIGHADDR = 0x2002FFFF

 

Step HW-3) Connect the xps_intc PCORE's Irq port to the MicroBlaze PCORE's INTERRUPT port

 

Step HW-4) Connect the following interrupt sources to the xps_intc PCORE's Intr Port

  • vdma_0:IP2INTC_Irpt
  • vdma_1:IP2INTC_Irpt

 

Step HW-5) Rebuild the FPGA design

 

===============================================================

 

To add interrupt functionality to the "software" portion of the FPGA design,
follow the following steps:

 

Step SW-1) Copy the ivk_interrupt.c/ivk_interrupt.h source files to the following location
           ..\Camera_Frame_Buffer_Sw\src

 

Step SW-2) Add the two source files to the application

 

Step SW-3) Modify the ivk_top.c source file as follows:

  • add the include directive
                    #include "ivk_interrupt.h"
  • add the init call (just before the "Wait for user to continue" comment)
                    // Initialize VDMA interrupts
                    ivk_interrupt_init();


Step SW-4) Rebuild the "Camera_Frame_Buffer_Sw" application

 

===============================================================
          
To load/run the new FPGA design, double-click on the following batch files (in order):
   ready_for_download\get_files.bat
   ready_for_download\run_demo.bat

 

In the serial consoel, there should be twice as many "R" being printed than "W".
This is because the image sensor (ie. "W") is running at 30 frames/sec
and the video output (ie. "R") is running at 60 frames/sec,

 

===============================================================

 

What Next ?

The next step should be to remove the print statements in the interrupt handlers,
and to add your custom code.

 

Enjoy !

 

Regards,

 

Mario.

Avnet Employee (Star Contributor)
Posts: 471
Registered: ‎04-16-2009

Re: Tutorial - Adding Interrupts to Video DMA

ivk_interrupt.c

Avnet Employee (Star Contributor)
Posts: 471
Registered: ‎04-16-2009

Re: Tutorial - Adding Interrupts to Video DMA

ivk_interrupt.h