An example project for using an STM32F0 or L0 chip to communicate with a DS3231 Real-Time Clock module over I2C. Example code for using an EEPROM chip on the same bus is also included.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
boot_code Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018
device_headers Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018
ld
src Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018
vector_tables
LICENSE Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018
Makefile Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018
README.md Initial commit; demonstrate basic usage of the DS3231 RTC module and … Apr 29, 2018

README.md

Overview

This is an example program to get the time from a DS3231 'Real-Time Clock' module using an STM32 chip. It is simply set to blink an LED every 10 "seconds", whatever those are.

It also sets a number of variables and demonstrates read/writing to the EEPROM chips included on the cheap and popular 'ZS-042' DS3231 boards, but those values are not surfaced outside of a debugger.

The included Makefile has options for building the program for an STM32L031K6 or STM32F031K6 chip - there are "Nucleo" boards available with both of those cores. Note that pins B6 and B7 are labeled D5 and D4 respectively, on those boards.

Building and Uploading

You can build the code with make, and upload it with the 'st-flash' utility:

st-flash write main.bin 0x08000000