Independent Real Time Clock (IRTC) for KW40Z Connectivity

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Independent Real Time Clock (IRTC) for KW40Z Connectivity

595 Views
lucianfiran
Contributor V

IAR 7.50;  KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0)

 

In Kinetis SDK v.1.3 API Reference Manual, Document Number: KSDK13APIRM Rev. 0 Sept 2015

There is a reference about IRTC

Chapter 29  Independent Real Time Clock (IRTC)
29.1 Overview
The Kinetis SDK provides both HAL and Peripheral drivers for the Independent Real Time Clock (IRTC)
block of Kinetis devices.

28.10 IRTC HAL driver
28.10.1 Overview
28.11 IRTC Peripheral Driver
28.11.1 Overview

 

The files can be found in KSDK platform release:

KSDK_1.3.0\platform\hal\src\irtc\fsl_irtc_hal.c
KSDK_1.3.0\platform\hal\inc\fsl_irtc_hal.h

 

But are not integrated (are missing) in Connectivity framework release:

KW40Z_Connectivity_Software_1.0.1\KSDK_1.3.0\platform\hal\src
KW40Z_Connectivity_Software_1.0.1\KSDK_1.3.0\platform\hal\inc

 

Can these IRTC drivers be used for MKW30Z with the Connectivity Software 1.0.1 ?

Should additional set-up be done for that ?

The IRTC lib is fully supported by this framework ?

 

Examples:

irtc_datetime_t datetimeToSet;


IRTC_DRV_Init(0);


datetimeToSet.
year = 2013;
datetimeToSet.
month = 10;
datetimeToSet.
day = 13;
datetimeToSet.
hour = 18;
datetimeToSet.
minute = 55;
datetimeToSet.
second = 30;


// set the datetime //
result = IRTC_DRV_SetDatetime(0, &datetime);


// get datetime //
IRTC_DRV_GetDatetime(0, &datetime);
printf(
"Current datetime: %04hd-%02hd-%02hd %02hd:%02hd:%02hdnrnn",
datetime.year, datetime.month, datetime.day, datetime.hour, datetime.minute, datetime.second);

 

// alarm set //

alrmTimeToSet.year = datetimeToSet.year;
alrmTimeToSet.
month = datetimeToSet.month;
alrmTimeToSet.
day = datetimeToSet.day;
alrmTimeToSet.
minute = datetimeToSet.minute + 5;
alrmTimeToSet.
second = datetimeToSet.second;
IRTC_DRV_SetAlarm(0, &alrmTimeToSet);
IRTC_DRV_SetAlarmMatchMode(0, kIRTCSecMinHourDayMonYear);
IRTC_HAL_SetIntCmd(0, kIRTCAlarmIntFlag);

 

Best Regards,

Lucian.

Labels (1)
Tags (2)
1 Reply

410 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Lucian

This post is related to this one: MKW30Z; KSDK board disable hw RTC 

If you want to use LPO as source clock for the RTC, you don't need to change RTC drivers ( to IRTC), you can change the clock source when they call BOARD_ClockInit, as I mentioned you in the other thread, here you can find a BOARD_InitRtcOsc(); which enable the OSC with the RTC. This IRTC is mostly used with Kinetis M family, thats why KW doesn't implement them in the connectivity software.


Hope this information helps you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------