AM263Px MCU+ SDK  10.01.00
Timer

Features Supported

  • APIs to setup timer configuration
  • APIs to start and stop the timer
  • APIs to get the current timer count
  • APIs to check for counter overflow and clear timer overflow interrupt

Features NOT Supported

NA

Important Usage Guidelines

  • Support configuration for RTI timer
  • Value for 'inputPreScaler' should be set to 1
    • RTI timer does not have a clock prescaler. However, RTI supports two 32 bit counters (UC and FRC) per block, out of which UC can be used as a prescaler to run FRC.
    • RTI based TimerP driver makes use of both UC and FRC to achieve the required tick period and generate interrupt. So in this design RTICLK cannot be prescaled. RTI TimerP driver assumes prescaler is 1 and the value provided in 'inputPreScaler' is not used.
  • Supports continues and oneshot mode
  • When configuring the timer period in micro second the 'periodInNsec' should be set to 0

Example Usage

Include the below file to access the APIs,

Example usage to initialize the timer

TimerP_Params timerParams;
/* setup timer but dont start it */
TimerP_Params_init(&timerParams);
timerParams.inputPreScaler = 1u;
timerParams.inputClkHz = 250u*1000u*1000u;
timerParams.periodInUsec = 10u*1000u;
timerParams.oneshotMode = 0;
timerParams.enableOverflowInt = 1;
TimerP_setup(timerBaseAddr, &timerParams);

Example usage to start the timer

/* start the tick timer */
TimerP_start(timerBaseAddr);

Example usage to get the current count value

uint32_t count;
/* start the tick timer */
count = TimerP_getCount(timerBaseAddr);
(void) count; /* kill warning of variable set but not used */

Example usage to stop the timer

/* stop the tick timer */
TimerP_stop(timerBaseAddr);

API

APIs for timer setup and control

TimerP_setup
void TimerP_setup(uint32_t baseAddr, TimerP_Params *params)
Setup timer but does not start it.
TimerP_Params::enableOverflowInt
uint32_t enableOverflowInt
Definition: TimerP.h:94
TimerP_stop
void TimerP_stop(uint32_t baseAddr)
Stop timer.
TimerP.h
TimerP_start
void TimerP_start(uint32_t baseAddr)
Start timer.
TimerP_Params
Parameters for TimerP_setup.
Definition: TimerP.h:64
TimerP_getCount
uint32_t TimerP_getCount(uint32_t baseAddr)
Get timer current count.
TimerP_Params_init
void TimerP_Params_init(TimerP_Params *params)
Set default value for TimerP_Params.
TimerP_Params::oneshotMode
uint32_t oneshotMode
Definition: TimerP.h:90
TimerP_Params::inputClkHz
uint32_t inputClkHz
Definition: TimerP.h:73
TimerP_Params::inputPreScaler
uint32_t inputPreScaler
Definition: TimerP.h:66
TimerP_Params::periodInUsec
uint32_t periodInUsec
Definition: TimerP.h:78