Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Quad Timer Peripheral Driver

This section describes the programming interface of the Quad Timer Peripheral driver.

Quad Timer Overview

The Quad Timer module supports a 64-bit counter and generation of PWM signals.

Quad Timer Initialization

  1. To initialize the Quad Timer driver, call the QUADTMR_DRV_Init() function and pass the instance number of the relevant Quad Timer. For example, to use Quad timer 0, pass a value of 0 to the initialization function.

Quad Timer Generate a PWM signal

Quad timer calls the QUADTMR_DRV_SetupFlexPwm() function to generate a PWM signal. The user provides the input clock source which is derived from the IP Bus clock. The user also provides the desired PWM signal's period in microseconds and the pulse width in microseconds. This function enables the pre-load function for each compare register to allow updating the PWM signal characteristics at a later time. To update the PWM period and/or pulse width, call the QUADTMR_DRV_UpdatePwm() function. The PWM continues to be derived from the clock source provided during setup.

Quad Timer as a 64-bit counter

Quad timer calls the QUADTMR_DRV_Start64BitCounter() function to start a 64-bit counter. The user chooses which source clock is used to run the counter. User must ensure that QUADTMR_DRV_Init() is called on all timer instances as all will be used in this mode. Timer 0 is clocked via the source clock and Timers 1, 2 and, 3 are set up in cascade mode. All 4 counters count up to 0xFFFF, then roll-over and continue counting. All 4 timers are used in this mode and cannot be used for any other operation. Call the QUADTMR_DRV_Get64BitCountVal() to read the count value.