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
- Archive of Arduino sketchbook rtc32 and libraries Simple real time clock (7th February 2016)
I used a lot of freely available software. Credit to the people who wrote it and made it available.
Software sources:
- Serial Command library by Stefan Rado