element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development FIT(Fixed interval timer) not doing interrupts
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 0 replies
  • Subscribers 327 subscribers
  • Views 200 views
  • Users 0 members are here
Related

FIT(Fixed interval timer) not doing interrupts

Former Member
Former Member over 12 years ago

Hi all,

I want to implement a FIT(fixed interval timer). I created one using XPS and connected the interrupt to the PS. I also implemented a timer/counter and connected that interrupt to the PS.
When writing code in the SDK, I can receive the interrupts from the timer/counter. But not from the FIT.

When looking in the FIT documentation I found the following for zynq implementation "Supported in ISE Design Suite implementations only". Does this mean it can't be done? Although connecting the FIT interrupt to the PS seems fine.

My SDK code looks like this:

/*
* Pl_timer_intr_test.c
*
*  Created on: 2012-6-8
*      Author: yzhang
*/

#include <stdio.h>
#include "platform.h"
#include "xil_types.h"

#include "xtmrctr.h"
#include "xparameters.h"

#include "xil_io.h"
#include "xil_exception.h"
#include "xscugic.h"

XScuGic InterruptController; /* Instance of the Interrupt Controller */
static XScuGic_Config *GicConfig;/* The configuration parameters of the
controller */
volatile u32 interruptCount = 0;

//void print(char *str);
extern char inbyte(void);
void Timer_InterruptHandler(void *data, u8 TmrCtrNumber) {
txil_printf(" Interrupt %d acknowledged
r ", interruptCount);
txil_printf("r
");
txil_printf("r
");
tXTmrCtr_Stop(data, TmrCtrNumber);
tXTmrCtr_Reset(data, TmrCtrNumber);
tXTmrCtr_Start(data, TmrCtrNumber);
t++interruptCount;
}

void fit250ms_InterruptHandler(void *data) {
txil_printf(" Interrupt fit250ms acknowledged
r ");
txil_printf("r
");
txil_printf("r
");
}

int SetUpInterruptSystem(XScuGic *XScuGicInstancePtr) {
t/*
t * Connect the interrupt controller interrupt handler to the hardware
t * interrupt handling logic in the ARM processor.
t */
tXil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
ttt(Xil_ExceptionHandler) XScuGic_InterruptHandler, XScuGicInstancePtr);
t/*
t * Enable interrupts in the ARM
t */
tXil_ExceptionEnable();
treturn XST_SUCCESS;
}
int ScuGicInterrupt_Init(u16 DeviceId, XTmrCtr *TimerInstancePtr) {
tint Status;
t/*
t * Initialize the interrupt controller driver so that it is ready to
t * use.
t * */
tGicConfig = XScuGic_LookupConfig(DeviceId);
tif (NULL == GicConfig) {
ttreturn XST_FAILURE;
t}
tStatus = XScuGic_CfgInitialize(&InterruptController, GicConfig,
tttGicConfig->CpuBaseAddress);
tif (Status != XST_SUCCESS) {
ttreturn XST_FAILURE;
t}
t/*
t * Setup the Interrupt System
t * */
tStatus = SetUpInterruptSystem(&InterruptController);
tif (Status != XST_SUCCESS) {
ttreturn XST_FAILURE;
t}
t/*
t * Connect a device driver handler that will be called when an
t * interrupt for the device occurs, the device driver handler performs
t * the specific interrupt processing for the device
t */
tStatus = XScuGic_Connect(&InterruptController,
tttXPAR_FABRIC_AXI_TIMER_0_INTERRUPT_INTR,
ttt(Xil_ExceptionHandler) XTmrCtr_InterruptHandler,
ttt(void *) TimerInstancePtr);
tif (Status != XST_SUCCESS) {
ttreturn XST_FAILURE;
t}

ttStatus = XScuGic_Connect(&InterruptController,
ttttXPAR_FABRIC_FIT_TIMER_250MS_INTERRUPT_INTR,
tttt(Xil_ExceptionHandler) fit250ms_InterruptHandler,
tttt(void *) NULL);
ttif (Status != XST_SUCCESS) {
tttreturn XST_FAILURE;
tt}
t/*
t * Enable the interrupt for the device and then cause (simulate) an
t * interrupt so the handlers will be called
t */
ttXScuGic_Enable(&InterruptController, XPAR_FABRIC_AXI_TIMER_0_INTERRUPT_INTR);
ttXScuGic_Enable(&InterruptController, XPAR_FABRIC_FIT_TIMER_250MS_INTERRUPT_INTR);
treturn XST_SUCCESS;
}
int main() {

tXTmrCtr TimerInstancePtr;
tint xStatus;
tinit_platform();
txil_printf("##### Application Starts #####
r");
txil_printf("r
");
txStatus = XTmrCtr_Initialize(&TimerInstancePtr, XPAR_AXI_TIMER_0_DEVICE_ID);
tif (XST_SUCCESS != xStatus)
ttxil_printf("TIMER INIT FAILED
r");

t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t//Set Timer Handler
t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tXTmrCtr_SetHandler(&TimerInstancePtr, Timer_InterruptHandler,
ttt&TimerInstancePtr);

t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t//Setting timer Reset Value
t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tXTmrCtr_SetResetValue(&TimerInstancePtr, 0, //Change with generic value
ttt0xf8000000);

t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t//Setting timer Option (Interrupt Mode And Auto Reload )
t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tXTmrCtr_SetOptions(&TimerInstancePtr, XPAR_AXI_TIMER_0_DEVICE_ID,
ttt(XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION));

t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t//SCUGIC interrupt controller Intialization
t//Registration of the Timer ISR
t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

txStatus = ScuGicInterrupt_Init(XPAR_PS7_SCUGIC_0_DEVICE_ID,
ttt&TimerInstancePtr);
tif (XST_SUCCESS != xStatus)
ttxil_printf(" :( SCUGIC INIT FAILED
r");

t//Start Timer

tXTmrCtr_Start(&TimerInstancePtr, 0);
txil_printf("timer start
r");

t//Wait For interrupt;

txil_printf("Wait for the Timer interrupt to tigger r
");
txil_printf("########################################r
");
txil_printf(" r
");

twhile (1) {
tt/*if(interruptCount > 20){
tttbreak;
tt}*/
t}
tcleanup_platform();
treturn 0;
}

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube