HAL Library 24- RTC for STM32Fxxx

RTC library was ported to HAL drivers for STM32Fxxx line from my previously library RTC for STM32F4xx. If features similar things as before except some functions were changed, which are already described in HAL API.


Read more about new HAL libraries


  • Support Internal or external clock source
    • PC14 and PC15 pins are used for external crystal oscillator
    • STM32F4/429 Discovery does not have RTC crystal onboard. Check board’s manual on how to set it up
  • Support wakeup interrupt
  • Support to set 2 internal alarms to trigger interrupts
  • they can also wake up STM32Fxxx from any low power mode
  • Get seconds from 01.01.1970 00:00:00
  • Get readable time from seconds from 01.01.1970 00:00:00
  • Support to save/get data in binary or BCD format
  • Support for read/write data to/from RTC backup registers
  • Support for subsecond
  • Support to write data in string format
  • Date and time are checked before saved for valid input data
  • Get days in month and year


  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h configuration file
    • attributes.h

Functions and enumerations

Full functions list can be found on HAL API section.


Projects are available on Github, download all libraries below.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...