Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Hardware Timer Demo

This demo application demonstrates using the hardware timer driver.

Overview

The Hardware Timer project is a demonstration program to show how to use the Hardware Timer driver. A Hardware Timer interrupt is created and fires multiple times until it reaches the requested number.

Supported Platforms

These Freescale Freedom development platforms and Tower System modules are supported by the Kinetis SDK Hardware Timer demo.

System Requirement

Hardware requirements

Toolchain requirements

Software requirements

Getting Started

Prepare the Demo

  1. Connect a USB cable between the PC host and the OpenSDA USB port on the board.
  2. Open a serial terminal with the following settings:
    • 115200 baud rate
    • 8 data bits
    • No parity
    • One stop bit
    • No flow control
  3. Download the program to the target board.
  4. Either press the reset button on the board or launch the debugger in the IDE to begin running the demo.

For detailed instructions, see the appropriate board User's Guide.

Run the demo

  1. Press the reset button on your board.
  2. "Hwtimer Example" message is displayed on the terminal.
  3. A dot is printed when an Hwtimer interrupt occurs until the HWTIMER_DOTS_PER_LINE * HWTIMER_LINES_COUNT (defined in hwtimer_demo.c) interrupts occur.
  4. Finally, the "End" message is displayed.
Hwtimer Example
........................................
........................................
End

Customization Options

This demo application is customizable to show different types of hardware timers.

Configure the Hardware Timer Used

Determine which timer the hardware timer driver uses. The ARM core Systick timer is used by default.

#define HWTIMER_LL_DEVIF kSystickDevif

Configure which clock is used by the hardware timer

Determine which clock source is used by the hardware timer.

#define HWTIMER_LL_SRCCLK kCoreClock

Configure which instance of the module is used

Determine which instance of the selected hardware module to use. For the Systick timer only '0' is valid. If the PIT is used, use this to select the PIT channel.

#define HWTIMER_LL_ID 0

Hardware Timer Period

Determine the timer period (in microseconds).

#define HWTIMER_PERIOD 100000