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.
- FRDM-K22F
- FRDM-K64F
- FRDM-KL02Z
- FRDM-KL03Z
- FRDM-KL25Z
- FRDM-KL26Z
- FRDM-KL27Z
- FRDM-KL43Z
- FRDM-KL46Z
- FRDM-KW24
- MRB-KW01
- TWR-K21D50M
- TWR-K21F120M
- TWR-K22F120M
- TWR-K24F120M
- TWR-K60D100M
- TWR-K64F120M
- TWR-K65F180M
- TWR-KL43Z48M
- TWR-KV10Z32
- TWR-KV31F120M
- TWR-KV46F150M
- TWR-KW24D512
- USB-KW24D512
System Requirement
Hardware requirements
- J-Link ARM
- P&E Micro Multi-link universal
- Mini/micro USB cable
- USB A to micro AB cable
- Hardware (tower/base board, ...) for specific device
- Personal Computer
Toolchain requirements
- IAR embedded Workbench version 7.30.4
- ARM GCC 4.8.3 2014q3
- Keil MDK 5.13
- Kinetis Design Studio IDE v.2.5.0
- Atollic TrueSTUDIO for ARM win32 v5.2.1
Software requirements
- The project files are in: <SDK_Install>/examples/<board>/demo_apps/hwtimer_demo/<toolchain>.
- Library dependencies: ksdk_platform_lib
Getting Started
Prepare the Demo
- Connect a USB cable between the PC host and the OpenSDA USB port on the board.
- Open a serial terminal with the following settings:
- 115200 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control
- Download the program to the target board.
- 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
- Press the reset button on your board.
- "Hwtimer Example" message is displayed on the terminal.
- 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.
- 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.
Hardware Timer Period
Determine the timer period (in microseconds).
#define HWTIMER_PERIOD 100000