| Kinetis SDK Demo Applications User Guide 1.0.0-beta Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- Demos

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
RTC Function Demo User Guide
RTC Function Demo

User guide on how to use RTC Function Demo application. More...

### RTC Function Demo User Guide

# Getting started

1. Download the program to a target broad.
2. Connect the USB cable to the PC host and open a serial terminal at 115200 baud, 8-bits no parity, 1 stop bit.
3. When successfully connected, you can input help to get the supported command list:

Available Commands:
help (0)- print command description/usage
alarm (1)- Set an alarm
date (2)- Get and set the datetime
time (3)- Get precise time in nanosec
comp (4)- Compensate demo

## Alarm Command

- Get current armed alarm.
  - Usage: alarm
  - Example:
    RTC Demo> alarm
    No alarm armed
- Set an alarm
  - Usage: alarm <sec>
  - Example: Set the alarm 10 sec later.
    RTC Demo> alarm 10
    Current alarm: 15:46:13

## Date Command

- Get date time
  - Usage: date
  - Example:
    RTC Demo> date
    Current datetime: 2013-12-12 16:46:39
- Set date time
  - Usage: date set <YYYY-MM-DD> <hh:mm:ss>
  - Example: Set datetime to 12/12/2013 16:46:39
    RTC Demo> date set 2013-12-12 16:46:39

## Time Command

- Get current time in us resolution
  - Usage: time
  - Example:
    RTC Demo> time
    Current time: 15:46:03 267ms 870us

## Compensation Command

- Get current compensation configurations
  - Usage: comp
  - Example:
    RTC Demo> comp
    Compensation, cycles: 32768, interval: 4
- Config compensation cycles and interval
  - Usage: comp <cycles> <interval>
    - Cycles: the number of 32.768 kHz clock cycles in each second. Range from 32641 Hz to 32896 Hz.
    - Interval: the compensation interval from 1 to 256 seconds to control how frequently the TCR should adjust the number of 32.768 kHz cycles in each second. The value written should be one less than the number of seconds. Range from 0 to 255.
  - Example:
    RTC Demo> comp 32780 4

The compensation result can be checked from the RTC_CLKOUT external output pin which outputs a 1 Hz signal with the compensated result. The RTC_CLKOUT pin can be found:

- TWR-K64F120M: pin2 on J31
- FRDM-K64F120M: pin1 on J2