STM32 RTC

Started 7th February 2016

The STM32 board I used has a 32768 Hz crystal to allow operation of the the real time clock. To make use of this it is necessary to connect a 3 V battery to the VB (or VBAT) pin. I used a CR2032 and bearing in mind the warnings [2], connected it via a BAS 85 Schottky diode.

With the USB power disconnected current was 1.3 μA. Time keeping seems around a second per day.

The sketch below allows reading and setting the clock. With a serial connection, various commands can be used.

rt
Read Time - show the current time

wy <year>
Write Year - set clock year

wn <month>
Write moNth - set clock month

wd <day>
Write Day of month

wh <hour>
Write Hour (24 hour format)

wm <minute>
Write Minute

ws <second>
Write Second

Downloads:

Sources:

  1. STM32F101xx and STM32F103xx RTC calibration
  2. Re: RTC Libs

I used a lot of freely available software. Credit to the people who wrote it and made it available.

Software sources:

Comments

Click to return to index

Page last modified on December 06, 2016, at 02:39 AM
Powered by PmWiki