Skip to main content
Knowledgebase
Home
Renesas India - Knowledgebase

r_rtc Module Guide Resources

Last Updated:03/12/2018

Question:

Where can I find the references to module guide resources for the RTC HAL module on r_rtc?

Answer:

Information on the module guide itself and the associated resources and known issues are available here.

Introduction

The Real-Time Clock (RTC) HAL module is a high-level API for RTC applications and is implemented on r_rtc. The RTC HAL module configures the RTC module and controls clock, calendar, and alarm functions. The RTC uses the real-time clock module on the Synergy MCU. A user-defined callback can be created to respond to any of the three supported interrupt types- alarm, periodic, or carry.

The RTC HAL module supports the following features:

  • RTC peripheral configuration
  • Clock and calendar functions:
  • Alarm, periodic, and carry interrupts
  • Time-capture function
  • Event linkage to other peripherals

Module Guide

The r_rtc HAL module guide is targeted for SSP 1.2.0 and above and the SK-S7G2 Kit.

The most recent versions of the RTC HAL module guide application note, application project and import guide are available here

 

Module Guide Errata

Section 1- Features added bullets

  • RTC sub-clock error adjustment
  • RTC status get

 

Section 3.1.2- RTC HAL Module Limitations edit to bullet

  • LOCO clock-error correction

 

Section 6- Using the RTC HAL Module in an Application added sections

Avoid drift issue after reset

To avoid drift in RTC time across MCU reset, the application needs to follow the steps given below.

Make these changes to module configuration settings:

  1. Disable the “Configure Subclock Drive On Reset” option in the CGC stack element of the ISDE configurator.
  2. Disable the “Configure RTC hardware in open() call” option in the RTC stack element of the ISDE configurator.

Make these calls in the application code:

  1. Call the RTC open API as usual.
  2. Call the RTC configure API only on a cold start. This will initialize the RTC only in a cold start condition.

The aforementioned steps can be performed by using the following initialization sequence in the application:

    g_rtc.p_api->open(g_rtc.p_ctrl,g_rtc.p_cfg);

    g_rtc.p_api->infoGet(g_rtc.p_ctrl,&info1);

    /* initialize RTC if its status is stopped state i.e. on cold start */

    if(RTC_STATUS_STOPPED == info1.status)

    {

/* if the RTC clock source is sub-clock, stop it so that the sub-clock drive capacity is set correctly in the configure API */

           g_cgc.p_api->clockStop(CGC_CLOCK_SUBCLOCK);

           g_rtc.p_api->configure(g_rtc.p_ctrl);

           g_rtc.p_api->calendarTimeSet(g_rtc.p_ctrl,&rt_time,true);

                 }

An alternative way to determine cold start condition (instead of status) is to obtain the information from the reset status registers (RSTSRx).

 

Date and Time validation

The “Parameter Checking” needs to be enabled in the ISDE configurator if date and time validation is required for calendarTimeSet and calendarAlarmSet APIs. If “Parameter Checking” is enabled, the 'day of the week' field is automatically calculated and updated by the driver for the provided date. When using the calendarAlarmSet API, only the fields which have their corresponding match flag set are written to the registers. Other register fields are reset to default value.

 

Sub-Clock error adjustment

The errorAdjustmentModeSet and errorAdjustmentSet APIs can be used to correct the error in the RTC sub-clock source. These APIs need to be used only after the RTC is configured and time is set.

The error adjustment is reset every time RTC is reconfigured or time is set.

 

Usage Note:

The configuration property ‘Configure RTC hardware in open() call’ in the RTC stack of ISDE configurator controls the behavior of open API. If enabled, the RTC peripheral is configured in the open API. If disabled, it is the responsibility of the application to make sure that RTC is configured before usage, by using the configure API.

 

Module Guide Resources

  • The RTC HAL module is used in the Developer Examples available for the DK-S7G2. You can find a Knowledge Base article that describes the Developer Examples and how to create a project using the template here.

Known issues

  • Refer to the SSP release notes for known issues, available here.
Suitable Products
SSP
  • Was this article helpful?