Page 1 of 1

VS1005 RTC Frequency tolerance

Posted: Tue 2019-03-26 19:57
by DavidMc
Hello!

In the VS1005 datasheet, page 10, Oscillator Specification table, it lists the RTC Frequency Tolerance as "±100ppm".

Questions:
Is this ±100ppm the range in which the VS1005 will work with a supplied clock (crystal, oscillator)? (i.e., if the supplied 32.768kHz clock is beyond ±100ppm, VS1005 will not work well or not meet spec)

or

Is this the tolerance of VS1005's internal frequency independent of the supplied clock? (i.e., a supplied clock with ±20ppm tolerance would then become ±120ppm)

Thanks!
David

Re: VS1005 RTC Frequency tolerance

Posted: Thu 2019-03-28 11:15
by Panu
Hi!

Ha! What an intriguing question! But out of your choices, #1 is closer to the truth. The RTC oscillator itself has a wide operating range, but the 100 ppm requirement for the crystal is just to get meaningful results when interpreting the frequency as a basis for calculating either time or lengths of time periods. If you put a 50 kHz crystal there, the VS1005 will still work but time calcuation software will give confusing results.
(would) a supplied clock with ±20ppm tolerance would then become ±120ppm?
No.

-Panu

Re: VS1005 RTC Frequency tolerance

Posted: Mon 2019-04-01 17:35
by DavidMc
Thank you Panu.

I was thinking the same, but had to ask to be sure I wasn't overlooking something.
Thanks!
DMc

Re: VS1005 RTC Frequency tolerance

Posted: Tue 2019-04-02 19:22
by DavidMc
Hello Panu,

A new, related question.

We need to consider a more accurate RTC clock. I'm wondering if it is possible to switch between two hardware 32.768kHz clocks (one is low accuracy, low power; other is high accuracy, high power) depending on whether the product is turned Off and running from limited battery, or turned ON and running from ample power supply.

Example procedure:
1) Vhigh power is turned Off, but RTC power is always ON via always-ready battery
2) Crystal is connected to VS1005
3) Vhigh power is turned ON
4) Crystal is disconnected from VS1005
5) XO (i.e., active component) is connected to VS1005 in place of the crystal
6) Go to step 1

It is assumed that the time between steps 1-2 and 3-5 is very small - probably less than a millisecond; while the time between steps 2-3 and 5-6 could be seconds/minutes/hours.

Setting aside, for a moment, capacitance and drive-level issues associated with inserting a silicon switch between the crystal and VS1005, will VS1005 be ok with a momentary pause or a non-periodic (but brief) glitch(es) during start-up and power-down?

This sequence here viewtopic.php?f=13&t=2349#p12443 suggests there is likely enough delay during start-up to transition hardware clocks.

David

Re: VS1005 RTC Frequency tolerance

Posted: Wed 2019-04-03 8:51
by Hannu
DavidMc wrote:
Tue 2019-04-02 19:22
Hello Panu,

A new, related question.

We need to consider a more accurate RTC clock. I'm wondering if it is possible to switch between two hardware 32.768kHz clocks (one is low accuracy, low power; other is high accuracy, high power) depending on whether the product is turned Off and running from limited battery, or turned ON and running from ample power supply.

Example procedure:
1) Vhigh power is turned Off, but RTC power is always ON via always-ready battery
2) Crystal is connected to VS1005
This is normal status. The RTC circuit keeps running and time is kept.
3) Vhigh power is turned ON
4) Crystal is disconnected from VS1005
5) XO (i.e., active component) is connected to VS1005 in place of the crystal
This is tricky part. How to switch the clock source? If the switching element is semiconductor, powering must thought carefully. If the switching is done with relay, it is much easier as it can take the power from the infinite power supply.
6) Go to step 1

It is assumed that the time between steps 1-2 and 3-5 is very small - probably less than a millisecond; while the time between steps 2-3 and 5-6 could be seconds/minutes/hours.

Setting aside, for a moment, capacitance and drive-level issues associated with inserting a silicon switch between the crystal and VS1005, will VS1005 be ok with a momentary pause or a non-periodic (but brief) glitch(es) during start-up and power-down?
The switching will probably generate some extra pulses and the time will advance in non-linear way. The tricky part is not go to overshoot with signal levels.

Another idea:
If you are using high quality clock to XTALI, you could use ReadTimeCount() and keep track of time through it. You get 1 ms resolution from it.
The ReadTimeCount uses HW timer. In the end this all depends on your requirement of high accuracy timing. However 1ppm in XTALI would be 12 Hz and 1 ppm in RTC would be 0.032 Hz

But this all depends on the stability, accuracy and resolution you want to achieve.
When thinking different clocking modes, have a look at setclock program. It is very capable small tool handling all kinds of clock and voltage stuff.

Re: VS1005 RTC Frequency tolerance

Posted: Wed 2019-04-03 16:34
by DavidMc
Hello Hannu,

Your other ideas are great food for thought. We will review.

Many thanks!

David

Re: VS1005 RTC Frequency tolerance

Posted: Wed 2019-04-03 19:36
by Panu
Hmm, I once did a tariffe clock design for an electricity metering company. You know, tariffe clocks have a very strict requirement for timekeeping accuracy. There I used the electric grid for the accuracy - the number of 50 Hz cycles per day is maintained by atomic clock each day: the Nordic Grid company allows it to drift a little during the daytime when the load is high, but they match it back to the exact cycle value during the night. So in that tariffe clock I had an optoisolator keeping track of the power grid cycles (very easy since the unit was powered by a transformer, I just put a diode, resistor and opto to the transformer secondary wiring). When the unit booted, it read the time from an RTC chip. Then it used an interrupt from the power grid optoisolator to increment a 50Hz counter and calculated hours, minutes, days, months, years by software. Each minute or so I updated the time in the RTC chip. So when a power outage came, the unit relied on the RTC crystal, but when it was running, it relied on the power grid for timekeeping.

-Panu

Re: VS1005 RTC Frequency tolerance

Posted: Mon 2019-04-08 17:37
by DavidMc
Hello Hannu and Panu,

I'm glad we are not making a tarriffe clock - way over my head. :)

I've been thinking about this issue backwards. We need very accurate audio clock, not ultra accurate file timestamp. (Duh, David! :roll: )

Does a ±10ppm 12.288MHz XO linearly result in a ±10ppm 48kHz sample rate?

sorry for my mistake. It seems I'm finally on the right track now.

David

Re: VS1005 RTC Frequency tolerance

Posted: Tue 2019-04-09 15:20
by pasi
If you have a ±10ppm 12.288MHz oscillator, that's also the accuracy of the samplerate. There's nothing inside vs1005 that would inherently lose clocks. The analog parts and certain peripherals get the clock from the pin directly.

If the oscillator is also impervious to temperature, then you have a very exact rate.

If you have a crystal rated at ±10ppm, you need to check that the value of the crystal capacitors have the correct value to not skew the absolute frequency of the oscillation circuit.

Edit: Where does the oscillator get power from? If you can use IOVDD (i.e. the oscillator works with 1.8V), you don't need to switch between a crystal and the oscillator.

Re: VS1005 RTC Frequency tolerance

Posted: Tue 2019-04-09 16:52
by DavidMc
Hello Pasi,
If you have a ±10ppm 12.288MHz oscillator, that's also the accuracy of the samplerate. There's nothing inside vs1005 that would inherently lose clocks
That is what I suspected; thank you for confirming.
If you can use IOVDD (i.e. the oscillator works with 1.8V), you don't need to switch between a crystal and the oscillator.
Agreed. My idea of switching clocks was poorly thought.

Thank you, Hannu, Panu, and Pasi for your help. Much appreciated.

David