Ported: JChristensen/DS3232RTC

Please do not post requests
User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

Ported: JChristensen/DS3232RTC

Post by Kenjutsu » Mon Feb 15, 2016 1:50 pm

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
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

User avatar
RogerClark
Posts: 7443
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Ported: JChristensen/DS3232RTC

Post by RogerClark » Tue Feb 16, 2016 9:48 am

Thanks

I'm not sure if you are aware but the STM32 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

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Ported: JChristensen/DS3232RTC

Post by Pito » Sat May 07, 2016 3:01 pm

Hi, I've taken this lib (I need a timestamp for the sdfat)
but I cannot get it compiled (Maple Mini, 1.6.5), for example

Code: Select all

#include <DS3232RTC.h>    
#include <Time.h>         
#include <Wire.h>  
shoots various errors depending what I do comment out..
Pukao Hats Cleaning Services Ltd.

User avatar
RogerClark
Posts: 7443
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Ported: JChristensen/DS3232RTC

Post by RogerClark » Sat May 07, 2016 9:45 pm

post the errors

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Ported: JChristensen/DS3232RTC

Post by Pito » Sun May 08, 2016 6:58 am

Code: Select all

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.
Pukao Hats Cleaning Services Ltd.

User avatar
RogerClark
Posts: 7443
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Ported: JChristensen/DS3232RTC

Post by RogerClark » 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 STM32 friendly version of that lib that he used for his PigOScope

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Ported: JChristensen/DS3232RTC

Post by Pito » 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:

Code: Select all

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.
So I have to rename the original Arduino one in /libraries/Wire to "WireAr"
Now it compiles, let us try it in hw..
Last edited by Pito on Sun May 08, 2016 8:45 am, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Ported: JChristensen/DS3232RTC

Post by Pito » Sun May 08, 2016 8:44 am

Ok it seems it works (SDA1, SCL1)

Code: Select all

Start
8:43:23 8 5 2016
Pukao Hats Cleaning Services Ltd.

User avatar
ahull
Posts: 1650
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Ported: JChristensen/DS3232RTC

Post by ahull » Sun May 08, 2016 11:43 am

If you are interested in using the built in RTC on the STM32F103, you might like to take a look at this project.

More details here.

Code is here.

Image
- Andy Hull -

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Ported: JChristensen/DS3232RTC

Post by Pito » Mon May 09, 2016 9:37 am

@ahull - nice project!
I like the DS3231 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.
Pukao Hats Cleaning Services Ltd.

Post Reply