Arduino Due RTC Library

Hi folks,

there are my first "final" release of the RTC Library for the Arduino Due.

2 examples included.

I would call it final for the moment.

And on github: GitHub - MarkusLange/Arduino-Due-RTC-Library: RTC Library for the Arduino Due

Have fun

Markus

Due_RTC.zip (4.13 KB)

Dear Markus,

I've tried to use the RTC library. At first I tried to check the examples to check them on my arduino, but when verifying, many errors came through. Is like most of the variables on rtc_clock.cpp are undeclared.

Did you had this problem?

Regards, Arodrisa

arodrisa:
Dear Markus,

I've tried to use the RTC library. At first I tried to check the examples to check them on my arduino, but when verifying, many errors came through. Is like most of the variables on rtc_clock.cpp are undeclared.

Did you had this problem?

Regards, Arodrisa

Sounds like you installed the library in the wrong location.

I haven't received my due yet but many thanks for the effort.

codlink:

arodrisa:
Dear Markus,

I've tried to use the RTC library. At first I tried to check the examples to check them on my arduino, but when verifying, many errors came through. Is like most of the variables on rtc_clock.cpp are undeclared.

Did you had this problem?

Regards, Arodrisa

Sounds like you installed the library in the wrong location.

Can you please tell me where is the right location in Windows? I tried installing it like I do with other arduino libraries, but to no avail I come up with a long list of "" not declared errors when I try to compile the examples. My friend running archlinux compiled the examples no problem.

My mind = boggled...

Well, there's 2 places you can install them:

In your sketchbook: C:\Users[your computer name]\Documents\Arduino\libraries
Arduino Install: C:[install path]\arduino-1.5.2\libraries

One thing I noticed when using this library: Instantiating the rtc object seems to hang the program for about 2 seconds. This didn't work for me in the project I'm working on because it needed to start processing input right away. I didn't trace down why it took so long. Is that normal to take 2 seconds?

Collin80:
One thing I noticed when using this library: Instantiating the rtc object seems to hang the program for about 2 seconds. This didn't work for me in the project I'm working on because it needed to start processing input right away. I didn't trace down why it took so long. Is that normal to take 2 seconds?

If you give me a hint may I can help is it this part?

// Select the Slowclock source
//RTC_clock rtc_clock(RC);
RTC_clock rtc_clock(XTAL);

or does it came from this line?

rtc_clock.init();

By the first part it happend about the external xtal to swing-in

It seems to happen at this line:

RTC_clock rtc_clock(XTAL);

You're saying that the delay is waiting for the crystal to settle? Shouldn't using the crystal take less than 2 seconds?

Collin80:
It seems to happen at this line:

RTC_clock rtc_clock(XTAL);

You're saying that the delay is waiting for the crystal to settle? Shouldn't using the crystal take less than 2 seconds?

In my words NOOOOOOOO!!!

The internal RC is extremly unstable about counting on time he is too slow. You will loose time.

May use the Teensy 3 who sets faster up in combination with the time lib

hai Markus_L811,,thanks you very much for your library..it more simple better than external RTC...i have tried it but makus
when i tried it the example "Due-RTC_SAMPLE "...first time set rtc_clock.set_time(10, 29, 49) and then the clock is turn on...but the problem when i close the "serial view/serial monitor" and open again serial "serial view/serial monitor" the time clock set again in 10, 29, 49...it does'nt continue with when we open the "serial view/serial monitor" first....in my research planning i will make this rtc library to schedule the sending data of sensor...
every 20 minute send data of accelerometer sensor
every 10 minute send data strain gauge sensor

plese help me for this research...
thank you very much for your attention and your library.. markus,,god bles you..

Opening the Serial Monitor resets the Due, which resets the uP
using both the Reset inputs, and one of these two inputs resets
the RTC and other (unknown by me) stuff.

So, powering on, uploading a Sketch, or opening the Serial Monitor
all cause the RTC to be reset. If the Due will run in a situation where
it is always on, the RTC could be useful, if your Due board has the 32 kHz
crystal installed. Mine have it, but some pictures of the board show it missing.

To be really good support, you need to be able to read and write
the whole RTC-seconds value in one read (or one write).
I am not sure that this RTC library does that.

Has anyone looked?

:slight_smile: hem,,,oh i see i see,,it is the reason why the time is reset again,,,so i have to make it always on,to solve this problem..Thank you very much..your information help me

Hi guys,
currently I'm tinkering with the ASF rtc example which I assume is possibly the origin of the sw of the Arduino Due RTC Library.
I have the prob that the rtc resets by the uC reset, so power-on resets it, too. At the moment I use the original due board by which V_DDBU and V_IN are hard wired on the pcb. SaintSmart has a improved version of the board with a external batt connector for the rtc, btw. Hrrmpff...

I cannot imagine this rtc issue is a Atmel SAM hardware architecture mistake since this behaviour renders the hole idea of a rtc useless.
Has anyone found out how to set up the Power Management Controller (PMC) which optimizes power consumption of the peripherals by controlling all system and user peripheral clocks which might solve the prob?

Or any other workarounds?

So you're using a board which doesn't support the RTC (wrong power connections and no 32KHz crystal) and you wonder why it doesn't work?

It doesn't work on the standard Due board. No fault of Atmel.

Can you show a link to the Sainsmart board? That sounds interesting.

MorganS - Today at 02:53 pm wrote:

So you're using a board which doesn't support the RTC (wrong power connections and no 32KHz crystal) and you
wonder why it doesn't work?

No, of course not. The example work fine. There is no issue with a wrong connectivity. Only V_DDBU and the V_DDIN for the core supply are connected together on the pcb.
I took myself the freedom and removed carefully the copper wire with a small drill-bit and my trusty Dremel and resoldered a thin wire to pin 52 which is the back-up supply. Powered with 2x 1.5V the beast devours 171uA on the back-up line. Huuh! Probably it is not very well configured. My RTC4513 only consumes 2.9uA.

Sorry, it wasn't Saintsmart as mentioned, it is this Taijiuino thing instead.

But I still have the same Prob as before:
Why do the rtc peripheral reset when the core is being reset?

how to assign different numbers of ports, and which it is configured initially?

My due is crashing ifI I select XTAL as source. Could anyone please tell me what is happening with my system and why? Thanks.

Hi phr3ak,

i have the same problem,

check this out (image of due (sainsmart)), it seems to be missing C23,C24,Y2 (sch attached (taken from eagle files)), we'll try soldering the missing parts and report back Q)

EDIT: Imgur: The magic of the Internet (image of due (sainsmart))
EDIT2: attached image of due

yep, problem solved,

many thanks for the library :slight_smile: