Spark Logic

Ported: JChristensen/DS3232RTC

DS3231 SO-16 · 300 mil Pinout
DS3232 SO-20 · 300 mil Pinout
STM32F103C8T6 Example · LQFP48 Pinout

[2018-07-21 —UPDATE—] [ Updated to the latest version of DS3232RTC library of JChristensen]

Hello everyone,

I ported the DS3232RTC library of JChristensen and tested it with a DS3231 AT24C32 IIC module precision Real time clock module memory module Arduino. I only tested the SetSerial.ino example program.

The port can be found here: https://github.com/KenjutsuGH/DS3232RTC.git

Replies18

Tue Feb 16, 2016 9:48 am

Thanks

I’m not sure if you are aware but the STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog has its own internal real time clock which uses an external 32kHz crystal, I think @ahull is the expert in this, and some boards need modification to run from batteries in low power mode.

But its still worth pointing out this built in feature

Sat May 07, 2016 3:01 pm

Hi, I’ve taken this lib (I need a timestamp for the sdfat)
The port can be found here: https://github.com/KenjutsuGH/DS3232RTC.git
but I cannot get it compiled (Maple MiniMaple MiniDevelopment and computing boards…8MHz petertumler Thu Sep 24, 2015 10:58 am Hi, I’m trying to underclock a STM32F103 ( Maple Mini ) to 48MHz (for energy efficiency reasons). According to the datasheet .. The full…View in hardware catalog , 1.6.5), for example
#include <DS3232RTC.h>
#include <Time.h>
#include <Wire.h>  

Sat May 07, 2016 9:45 pm

post the errors

Sun May 08, 2016 6:58 am

In file included from C:\Users\pito\MyCode\Arduino\libraries\DS3232/DS3232RTC.h:40:0,
from STM_RDWR_1.ino:8:
C:\Users\pito\MyCode\Arduino\libraries\Time/Time.h:16:23: error: conflicting declaration 'typedef long unsigned int time_t'
typedef unsigned long time_t;
^
In file included from c:\users\pito\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdio.h:47:0,
from C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple/wirish.h:42,
from C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple/Arduino.h:30,
from STM_RDWR_1.ino:6:
c:\users\pito\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys\types.h:122:18: error: 'time_t' has a previous declaration as 'typedef long int time_t'
typedef _TIME_T_ time_t;
^
Multiple libraries were found for "Wire.h"
Used: C:\Users\pito\MyCode\Arduino\libraries\Wire
Not used: C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire
Error compiling.

Sun May 08, 2016 7:24 am

I recall there are issues with the various versions of time library

I think @ahull may have an STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog friendly version of that lib that he used for his PigOScope

Sun May 08, 2016 7:47 am

I’ve downloaded PaulS “Time” library and renamed the original Arduino one to “TimeAr”.
Now I get following error:
C:\Users\pito\AppData\Local\Temp\build68236732788381724.tmp\Wire\utility\twi.c.o
C:\Users\pito\MyCode\Arduino\libraries\Wire\utility\twi.c:25:20: fatal error: avr/io.h: No such file or directory
#include <avr/io.h>
^
compilation terminated.
Multiple libraries were found for "Wire.h"
Used: C:\Users\pito\MyCode\Arduino\libraries\Wire
Not used: C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire
Error compiling.

Sun May 08, 2016 8:44 am

Ok it seems it works (SDA1, SCL1)
Start
8:43:23 8 5 2016

Sun May 08, 2016 11:43 am

If you are interested in using the built in RTC on the STM32F103STM32F103Microcontrollers and processors…19.html . ag123 Sat Apr 28, 2018 5:54 pm come to think of it blue pill / maple mini ( stm32f103 ) is an *ideal* keyboard controller, the scanning can be done with assistance of sh…View in hardware catalog , you might like to take a look at this project.

More details here.

Code is here.

Image

Mon May 09, 2016 9:37 am

@ahull – nice project!
I like the DS3231DS3231Memory and real-time clocks…nctions not using that may reduce current draw before peripherals. I will be using a DS3231 . I assume that will mean the systick counter will not be needed? The design for the pe…View in hardware catalog module as it is precise – in 6months it did +6sec, so I added Aging reg writing to the lib and with +4 written into it may happen I will do a single second off per year :)
Oscillators with 32kHz fork resonator – you must tune them – a pF capacitance change does few seconds a day, moreover there is no temperature compensation. Of course, still ok for most apps.

Mon May 09, 2016 11:56 am

Pito wrote:@ahull – nice project!
I like the DS3231DS3231Memory and real-time clocks…nctions not using that may reduce current draw before peripherals. I will be using a DS3231 . I assume that will mean the systick counter will not be needed? The design for the pe…View in hardware catalog module as it is precise – in 6months it did +6sec, so I added Aging reg writing to the lib and with +4 written into it may happen I will do a single second off per year :)
Oscillators with 32kHz fork resonator – you must tune them – a pF capacitance change does few seconds a day, moreover there is no temperature compensation. Of course, still ok for most apps.

Tue May 10, 2016 3:08 pm

ahull wrote:For anything more precise, GPS or NTP (using an ESP8266ESP8266Microcontrollers and processors…working, on the Arduino.cc forum The ESP thing looks similar, but at the moment, www. esp8266 .com is not responding, so I’ll take a look later to see if it seems to be the same b…View in hardware catalog perhaps) or “mobile phone time” are probably the simplest options.

Fri Mar 17, 2017 7:20 am

Hello !

my project

#include <DS3232RTC.h>                   //http://github.com/JChristensen/DS3232RTC
#include "Time.h"
#include <TimeLib.h>
time_t t1;
time_t t2;
tmElements_t tm;
t1=RTC.get();
t2=now();

Fri Mar 17, 2017 2:58 pm

If you look at the DS3232RTC library code, it is returning 0 if it is not able to read the RTC on I2C bus.
So, you need to debug that … Maybe your wiring is wrong, maybe you forgot to have pull-ups, etc …

Sat Mar 18, 2017 12:31 am

No.
the clock is right.
if you disconnect the power wire from the clock module – clock-stop.
If you set a time and do not remove the battery from the module , the time is read correctly.
But if the battery is removed – the time is reset to 1970.
I think that the problem is to link new libraries<TimeLib.h> and <DS3232RTC.h> .
https://github.com/PaulStoffregen/Time

Sat Mar 18, 2017 1:33 am

I’ve created a very simple rtc library, uRTCLib. If your library is reading rtc correctly check math operations, probably there is a type problem (32 bits vs 8 bits operation).

Sat Jul 21, 2018 10:58 am

Just a quick note: Updated to the latest version of DS3232RTC library of JChristensen

Post a reply

Optional · up to 10 MiB