This demo application demonstrates how to use the RTC driver.
Overview
This RTC demo application demonstrates the important features of the RTC Module by using the RTC Periperhal Driver.
It supports these features:
- Calendar
- Get the current date time with Year, Month, Day, Hour, Minute and Second.
- Set the current date time with Year, Month, Day, Hour, Minute and Second.
- Alarm
- Set the alarm based on the current time.
- Application prints a notification when the alarm expires.
- Seconds interrupt
- Use second interrupt function to display a digital time blink every second.
- Compensation
- Configure the compensation with cycles.
- The 1 Hz RTC clock with compensation configured is output to a pin. Use an oscilloscope to check the compensation result.
Supported Hardware
These Freescale Freedom development platforms and Tower System modules are supported by the KSDK RTC Function demo.
- FRDM-K22F
- FRDM-K64F
- FRDM-KL03Z
- 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-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/rtc_func/<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 these settings:
- 115200 baud rate
- 8 data bits
- No parity
- One stop bit
- No flow control (Note that for the FRDM-KL03 platform, the terminal baud rate should be 9600)
- Download the program to the target board.
- Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Note: For the MRB-KW01, it is necessary to connect on the J8 pins 2-3 and change the CLOCK_SETUP to 1 (or change the RTC input to OSC32KCLK by another way).
For detailed instructions, see a Kinetis SDK User's Guide for your board.
Run the demo
This menu is displayed on the serial terminal:
Please choose the sub demo to run:
1) Get current date
time.
2) Set current date
time.
3) Alarm trigger show.
4) Second interrupt show (demo for 20s).
5) Set RTC compensation.
Select: