OPB timer Microblaze

Feb 06, 2008 2 Replies

Hello all. below is a part of my code for an OPB timer attached to a Microblaze with no inerrupts. the timer counts correct but when reaches the value 0xFFFFFFFF ( end point) should roll over and start again counting but this doesn't happend. what might be wrong here?



#include "xparameters.h" #include "xstatus.h" #include "xtmrctr_l.h"


#define TMRCTR_BASEADDR XPAR_OPB_TIMER_1_BASEADDR #define TIMER_COUNTER_0 0



int main(void) {



Xuint32 *memloc; Xuint32 Value1; Xuint32 Value2; Xuint32 *TimerCurrentValue; Xuint32 ControlStatus; Xuint32 TmrCtrBaseAddress; Xuint32 HasEventOccurred; Xuint8 TmrCtrNumber; XTmrCtr_mSetControlStatusReg(TmrCtrBaseAddress, TmrCtrNumber,0x0);



/* * Set the value that is loaded into the timer counter and cause it to * be loaded into the timer counter */ XTmrCtr_mSetLoadReg(TmrCtrBaseAddress, TmrCtrNumber, 0xFFFFF000); XTmrCtr_mLoadTimerCounterReg(TmrCtrBaseAddress, TmrCtrNumber);



/* * Clear the Load Timer bit in the Control Status Register */ ControlStatus = XTmrCtr_mGetControlStatusReg(TmrCtrBaseAddress, TmrCtrNumber);



XTmrCtr_mSetControlStatusReg(TmrCtrBaseAddress, TmrCtrNumber,ControlStatus & (~XTC_CSR_LOAD_MASK ));


/* * Start the timer counter such that it's incrementing by default */ XTmrCtr_mEnable(TmrCtrBaseAddress, TmrCtrNumber);


thank you all Xenix


perhaps you need to set XTC_CSR_AUTO_RELOAD_MASK.

alan nishioka snipped-for-privacy@nishioka.com

yes the roll over done.:)) some conflict was with the declarations and i assigned the HEX value of its setting straitgh away. now i am trying to find if there is any signal that idicating when the counter has rollover but as far now didnt find any.:(

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required