Experience the precision of advanced real-time clock technology, ensuring reliable timekeeping and synchronization in your solution
A
A
Hardware Overview
How does it work?
RTC 20 Click is based on the AB0805, a low-power, real-time clock (RTC) time-keeping device from Abracon. The AB0805 is configured to transmit calendar and time data to the MCU based on a 32.768kHz quartz crystal and comes with 256 bytes of general-purpose RAM. It reads and writes clock/calendar data from and to the MCU in units ranging from seconds to the last two digits of the calendar year, providing seconds, minutes, hours, dates, days, weeks, months, years, and century information. The end-of-the-month date is automatically adjusted for months with fewer than 31 days, including corrections for the leap year until 2199. This Click board™
communicates with the MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting a Fast Mode operation up to 400kHz. By utilizing an automatic backup switch feature, this RTC can use an external power source (220mF supercapacitor) when there is no power supply on its main power terminals, thus allowing for uninterrupted operation. Besides an automatic backup switchover circuit, the AB0805 has flexible inputs that aggregate various interrupt sources to an MCU. Based on this, functions like external interrupt or watchdog timer reset could be found on this Click board™ routed on the EXT and WDI pins of the mikroBUS™ socket, as well as the
primary and secondary interrupt signals routed on the IR1 and IR2 pins of the mikroBUS™ socket. In addition to the alarm/interrupt feature, the IR1 signal also provides the selectable-frequency square wave signal (512Hz default value). This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Clicker 2 for Kinetis is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit ARM Cortex-M4F microcontroller, the MK64FN1M0VDC12 from NXP Semiconductors, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a JTAG programmer connector, and two 26-pin headers for interfacing with external electronics. Its compact design with clear and easily recognizable silkscreen markings allows you to build gadgets with unique functionalities and
features quickly. Each part of the Clicker 2 for Kinetis development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 2 for Kinetis programming method, using a USB HID mikroBootloader or an external mikroProg connector for Kinetis programmer, the Clicker 2 board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Micro-B cable, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or
using a Li-Polymer battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several user-configurable buttons and LED indicators. Clicker 2 for Kinetis is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M4
MCU Memory (KB)
1024
Silicon Vendor
NXP
Pin count
121
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Software Support
Library Description
This library contains API for RTC 20 Click driver.
Key functions:
rtc20_set_time- RTC 20 set time function.rtc20_set_date- RTC 20 set date function.rtc20_get_time- RTC 20 get time function.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief RTC 20 Click example
*
* # Description
* This example demonstrates the use of the RTC 20 Click board™
* by reading and displaying the RTC time and date values.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of I2C module, log UART and additional pins.
* After driver initialization the app set RTC time to 23:59:50
* and set date to Tuesday 28.02.2023.
*
* ## Application Task
* This is an example that shows the use of a RTC 20 Click board™.
* In this example, we read and display the current time ( PM )
* and date ( day of the week ), which we also previously set.
* Results are being sent to the Usart Terminal where you can track their changes.
* All data logs write on USB changes every 1 sec.
*
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "rtc20.h"
static rtc20_t rtc20;
static log_t logger;
static uint8_t new_sec = 255;
static rtc20_time_t time;
static rtc20_date_t date;
/**
* @brief RTC 20 display day of week name function.
* @details This function display the name of day of the week.
*/
static void display_day_of_week ( void );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
rtc20_cfg_t rtc20_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
rtc20_cfg_setup( &rtc20_cfg );
RTC20_MAP_MIKROBUS( rtc20_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == rtc20_init( &rtc20, &rtc20_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
time.hour = 23;
time.minute = 59;
time.second = 50;
if ( RTC20_OK == rtc20_set_time( &rtc20, time ) )
{
log_printf( &logger, " Set time : %.2d:%.2d:%.2d\r\n",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
date.day_of_week = RTC20_DW_TUESDAY;
date.day = 28;
date.month = 2;
date.year = 23;
if ( RTC20_OK == rtc20_set_date( &rtc20, date ) )
{
log_printf( &logger, " Set date : %.2d-%.2d-%.2d\r\n",
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
}
Delay_ms ( 1000 );
log_printf( &logger, "---------------------\r\n" );
}
void application_task ( void )
{
if ( RTC20_OK == rtc20_get_time( &rtc20, &time ) )
{
if ( RTC20_OK == rtc20_get_date( &rtc20, &date ) )
{
if ( time.second != new_sec )
{
log_printf( &logger, " Date : %.2d-%.2d-%.2d\r\n",
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
display_day_of_week( );
log_printf( &logger, " Time : %.2d:%.2d:%.2d\r\n",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
log_printf( &logger, "- - - - - - - - - - -\r\n" );
new_sec = time.second;
Delay_ms ( 1 );
}
}
}
Delay_ms ( 1 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
static void display_day_of_week ( void )
{
switch ( date.day_of_week )
{
case RTC20_DW_SUNDAY:
{
log_printf( &logger, "Sunday\r\n" );
break;
}
case RTC20_DW_MONDAY:
{
log_printf( &logger, "Monday\r\n" );
break;
}
case RTC20_DW_TUESDAY:
{
log_printf( &logger, "Tuesday\r\n" );
break;
}
case RTC20_DW_WEDNESDAY:
{
log_printf( &logger, "Wednesday\r\n" );
break;
}
case RTC20_DW_THURSDAY:
{
log_printf( &logger, "Thursday\r\n" );
break;
}
case RTC20_DW_FRIDAY:
{
log_printf( &logger, "Friday\r\n" );
break;
}
case RTC20_DW_SATURDAY:
{
log_printf( &logger, "Saturday\r\n" );
break;
}
default:
{
log_printf( &logger, "Unknown\r\n" );
}
}
}
// ------------------------------------------------------------------------ END

































