Go Down

Topic: Arduino DUE Slow Clock Oscillator (SLCK) (Read 695 times) previous topic - next topic

danielciencia

Hi! I am using a DS3231 on a project, but I was informed which the DUE have an internal RTC (Pag. 242 SAM3A-Datasheet_23-Mar-15). This will simplify my board.
So I used this lib RTCDue, and use too the internal RC oscillator (SLCK).
But when I run the code, the time is slowest than the "official" clock, something about 3 min per half/hour.

I am read the section "27. Clock Generator" and not found something like a prescaller for the SLCK.
I am using the DUE on a plastic box and the temperature varies from 30 up to 45 ºC.
The Datasheet (45.4 Crystal Oscillators Characteristics) says +-11ºC from -40 up to 85ºC

Somebody have another opinion? Or maybe I must solder an 32kHz crystal and enable the SUPC_CR_XTALSEL?

ard_newbie

#1
Mar 14, 2018, 05:12 am Last Edit: Mar 14, 2018, 05:14 am by ard_newbie
Or maybe I must solder an 32kHz crystal
Yes

Some boards have the external 32 K Hz Crystal, others don't.

danielciencia

I did the job soldering two 22pF ceramic caps (following the DUE schematics) and a 32678Hz crystal.
Arduino Due "Power-Ups"
Using the lib RTCDue and the code has been running for 6 hours without any perceptible delay !

ard_newbie


danielciencia

Hi Ard! After 18h there is a difference of almost 3s. Maybe this is because the total capacitance of the cristal circuit. The correct method is to use the scope to verify the crystal signal and its frequency, and maybe use variable caps to adjust the values, right? I do not have an scope, you sugest something?

ard_newbie

#5
Mar 14, 2018, 08:35 pm Last Edit: Mar 14, 2018, 09:04 pm by ard_newbie
First off, I guess you have selected the external crystal as the slow clock.

I have never experimented soldering an external 32K crystal and its capacitors.

The crystal frequency may vary with external temperature (look at the datasheet) and the exact value of capacitors. If the room temperature is more or less constant, I would calibrate the "jitter" and add or subtract every 24 hours a few seconds (trial and error method).

If the room temperature vary, you will have to add an accurate external temperature sensor (there is a built-in internal temperature sensor, but useless in this case).

AFAIK, the best external crystals are temperature compensated, and much more expensive.

danielciencia


avr_fred

Two points:

32KHz crystals do not require load capacitors unless specifically specified by the crystal manufacturer. FWIW, I've never seen one need external caps.

The DS3231 will far outperform a 32KHz crystal since it is a temperature compensated device.

Go Up