PCF8523 Bare metal example project

Document created by David Diaz Marin Employee on Mar 9, 2018
Version 1Show Document
  • View in full screen mode

In this publication, an example project using the PCF8523 is shown to demonstrate the easy use of the RTC devices from NXP.


The PCF8523 is a real-time clock based on an ultra -low power oscillator and using an I2C- bus for interfacing. Some of its features are shown below:

  • Has an ultra -low power consumption
  • Provides time and calendar from seconds to years
  • Accuracy is based on a 32.768 kHz quartz crystal
  • Clock operating voltage: 1.0 V to 5.5 V
  • Low backup current: typical 150 nA at VDD = 3.0 V and Tamb = 25 °C
  • 2- line bidirectional 1 MHz Fast-mode Plus (Fm+) I2C interface, slave address: read D1h, write D0h
  • Battery backup input pin and switch-over circuit
  • Freely programmable timer and alarm with interrupt capability
  • Integrated oscillator load capacitors, programmable for quartz crystals with CL=7pF or CL=12.5 pF
  • Programmable offset register for frequency adjustment
  • Internal Power-On Reset (POR)



In this example, the PCF8523 is configured using the I2C interface based on the document UM10760 to generate an interrupt every second. Once the interrupt is generated, the time is read and stored into different variables.


The project was created using the FRDM-KL25Z platform and the OM13511 (I²C-bus RTC PCF8523 demo board). The complete source code is written in KDS IDE. You may find the complete project attached to this post.


I highly recommend using the OM13511 as a reference for your projects.