Author Topic: Driving an RTC from clock other than 32.768kHz  (Read 936 times)

0 Members and 1 Guest are viewing this topic.

Offline bluespiderTopic starter

  • Newbie
  • Posts: 8
  • Country: gb
Driving an RTC from clock other than 32.768kHz
« on: April 20, 2024, 05:07:59 pm »
==Background==
I am just starting out on the process of redesigning the MCU part of a battery powered datalogger. One feature it needs to have is an RTC or counter so that in the event of a low battery the device can enter some sort of low power state but that an external clock and counter remains powered.
The device requires a highly accurate clock with a low drift, unless I find a better alternative I will reuse the clock in the new design (as it's on a separate PCB and also very expensive!).
The clock has 3x outputs: PPS, 125Hz, 8.192MHz. The 8.192MHz is used to generate a 2.048MHz clock that is required by the ADC, The PPS is used for syncing the ADCs, measuring clock drift, and driving a counter in a CPLD which acts as the RTC in the old system (The main function of the CPLD is no longer required in the new design). The 125Hz output is not used.
Ideally I'll just use a microcontroller with a built in RTC and Backup power input pin, however it seems that they expect a 32.768kHz clock or crystal, the same is true of the dedicated RTC chips and 32bit counters that I've found. Most of these devices internall divide down to PPS signals anyway so it would be really useful to be able to just supply the PPS directly.

==Question==
Is there an easy way to get a 32.768kHz clock from a PPS, 125Hz, or 8.192MHz signal? This would open up the most options for device selection.
Or
Is there a (popular) 32bit MCU (cortex-m0+ probably), RTC IC or 32bit Counter that will accept one of the clock speeds mentioned? Ideally any counter or rtc will be able to read/set via i2c.
I think the Atmel samd chips have an adjustable rtc scaler which if I can set that to '1' will probably work. But I haven't been able to confirm yet.
« Last Edit: April 22, 2024, 07:24:12 pm by bluespider »
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4468
  • Country: dk
Re: Driving an RTC from clock other than 32.768kHz
« Reply #1 on: April 20, 2024, 07:19:32 pm »
most MCU's will probably run from 8.192MHz in place of an xtal. I know the RTC in an STM32 will run of the main clock divided and has prescalers to work with most frequencies.

On I2C you can make it act like a standard RTC, I've done that so I didn't have to write a driver for linux to use it
 

Offline aliarifat794

  • Regular Contributor
  • *
  • Posts: 80
  • Country: bd
Re: Driving an RTC from clock other than 32.768kHz
« Reply #2 on: April 20, 2024, 07:39:34 pm »
You have to look at the datasheet of the particular RTC that you'll be using. Thus you will find out if the RTC has configurable prescalers or not.
 

Offline bluespiderTopic starter

  • Newbie
  • Posts: 8
  • Country: gb
Re: Driving an RTC from clock other than 32.768kHz
« Reply #3 on: April 21, 2024, 08:21:00 pm »
Thanks for the replies - I think I was getting really confused reading datasheets between /n and /2^n values for various pre-scalers. I think I just need to work out which clocks can be kept active in different power modes. Ideally I'll just try and use the PPS on a GPIO with a /1 prescaler so that there's no extra synchronization needed.

I didn't find any RTC/Counters that would accept a different clock input.

I probably should have also said - the main clocks I will be using have a draw of about 1.5mA at 3.3V so I don't really need 'really' low power.
« Last Edit: April 22, 2024, 06:40:34 pm by bluespider »
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3386
  • Country: us
Re: Driving an RTC from clock other than 32.768kHz
« Reply #4 on: April 21, 2024, 10:31:41 pm »
Why not divide the 8.192MHz by 250 to get 32768Hz?  You can do that with 2 74HC390s.
 
The following users thanked this post: bluespider

Offline bluespiderTopic starter

  • Newbie
  • Posts: 8
  • Country: gb
Re: Driving an RTC from clock other than 32.768kHz
« Reply #5 on: April 22, 2024, 08:02:44 am »
Quote
Why not divide the 8.192MHz by 250 to get 32768Hz?  You can do that with 2 74HC390s.
Because I didn't know they existed :palm:

I think I'd been assuming that I'd have to work with powers of 2.
 

Offline Ground_Loop

  • Frequent Contributor
  • **
  • Posts: 649
  • Country: us
Re: Driving an RTC from clock other than 32.768kHz
« Reply #6 on: April 22, 2024, 09:37:39 am »
Is a DS3231-based clock module an option?  No need to configure clocks, highly stable and accurate, communicates via I2C, has battery backup.
There's no point getting old if you don't have stories.
 
The following users thanked this post: BrokenYugo

Offline bluespiderTopic starter

  • Newbie
  • Posts: 8
  • Country: gb
Re: Driving an RTC from clock other than 32.768kHz
« Reply #7 on: April 22, 2024, 06:44:02 pm »
Unfortuantly not, the application requires a much lower drift. The clocks we use at the moment are usually better than 1.5s per year, and given the cost I'd rather reuse them. If there was a better performing alternative, then it may be worthwhile.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf