Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:40 01 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : time ic’s eg 3231 / 3234 etc robust ?

Author Message
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 11:00pm 15 Mar 2016
Copy link to clipboard 
Print this post

How robust are the time chips ?
eg a ds3231 or the spi version ds3234, can they be used
for mobile applications like bumping around in a car, or
vibration near windmills or engines and so on ? Do they
still keep accurate time ?


ed - a quick slice of code to get the values -


Console output ( late February - a leap year ) :

29:02:16 23:34:28
29:02:16 23:34:29
29:02:16 23:34:30
29:02:16 23:34:31
29:02:16 23:34:32
29:02:16 23:34:33
29:02:16 23:34:34






CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
PROGRAM spbytercsl
C
C Reads spi RTC and displays on console
C
C Input :
C RTC time
C
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

INTEGER*1 secbyte, oldrec, outbyte, temp
INTEGER*1 sec, min, hour, day, mnth, year

outbyte = 0
secbyte = 0
oldrec = 0

DO WHILE ( 1 )

DO WHILE ( secbyte = oldrec )
SPSTRT
SPXWRD outbyte, temp
SPXWRD outbyte, secbyte
END DO
oldrec = secbyte

CALL gettime ( sec, min, hour, day, mnth, year )

FORMAT (I02,A,I02,A,I2,X)
WRITE (*,0) day, ":", mnth, ":", year
FORMAT (I02,A,I02,A,I02,/)
WRITE (*,0) hour, ":", min, ":", sec

END DO

END


CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

SUBROUTINE gettime ( sec, min, hour, day, mnth, year )
C
C Read rtc time registers via spi
C
INTEGER*1 recbyte, outbyte, temp
outbyte = 0
SPSTRT
SPXWRD outbyte, temp
SPXWRD outbyte, recbyte
sec = cdbcd(recbyte)
SPXWRD outbyte, recbyte
min = cdbcd(recbyte)
SPXWRD outbyte, recbyte
hour = cdbcd(recbyte)
SPXWRD outbyte, temp
SPXWRD outbyte, recbyte
day = cdbcd(recbyte)
SPXWRD outbyte, recbyte
mnth = cdbcd(recbyte)
SPXWRD outbyte, recbyte
year = cdbcd(recbyte)
RETURN
END


CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

INTEGER*1 FUNCTION cdbcd ( dbcd )
C
C Convert twin bcd to binary
C
cdbcd = 10 * ( dbcd >> 4 ) + ( dbcd & 15 )
RETURN
END

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Edited by chronic 2016-03-17
 
jwettroth

Regular Member

Joined: 02/08/2011
Location: United States
Posts: 75
Posted: 04:33am 16 Mar 2016
Copy link to clipboard 
Print this post

RTC's/Crystal Oscillators are pretty immune to shock and vibration. MEMS type oscillators like the DS3231 are even more immune due to their internal xtal construction and the small size and mass of their resonator. Discrete tuning fork crystals external to the RTC chip are very robust too. The rule is generally the smaller the better. Typical specs are 20g's (10-2000 Hz) for Vib and 50g for shock. All that being said, crystals are a high failure rate items in tough environments like automotive. (Flash memory is #2 for other reasons).

The biggest direct effect in RTC's by far is temperature. The unique feature of the DS3231 that accounts for its accuracy is active temperature compensation that holds drift to about a PPM (fractions of a second per month). They were designed initially for electric power meters (outdoors) with wide temp swings and very long periods of continuous operation- very low drift required.

Oscillators especially LF crystal oscillators with external crystals are notoriously layout sensitive. There is usually a data sheet section that is very specific about layout. Keep leads short and don't add any capacitance to the pierce oscillator circuit- load caps. The DS3231 avoids most of these layout pitfalls since the Xtal is internal. A traditional problem with discrete Xtal/RTC designs like the DS1307 can be electrical noise injection in the wiring between Xtal and RTC chip. This might be the bigger issue if an RTC is used in proximity to an electrically noisey emitter like an engine. The cheap boards with a DS1307 generally have a mediocre layout- look them over carefully or use a DS3231 board.

Wrist watches often had a silicone rubber shock absorber that isolated the PCB from the watch package to mitigate shock. This protected the crystal and likely the tiny, thin LCD in these devices. You'll sometimes see a crystal embedded in a dollup of silicone on PCB's in some consumer goods- this can't hurt though don't go overboard and keep the silicone off the leads, etc (capaciance).

Long winded answer but overall the answer is no- not very sensitive.

I was an FAE and product definer for Maxim/Dallas for many years and only ocassianally dealt with RTC issues- they're generally pretty trouble free.

John Wettroth
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 03:27pm 17 Mar 2016
Copy link to clipboard 
Print this post

Very useful ! thanks. The ds3234 I am using is spot-on but
it is a sparkfun module and they charged quite a mark-up,
I'll use the chips without the module now on.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025