AN402 F-RAM RTC Oscillator Design Guide.pdf

AN402
F-RAM™ RTC Oscillator Design Guide
Author: Harsha Medu
Associated Part Family: FM31278, FM31276,
FM31L278, FM31L276, FM31256, FM3164, and FM33256B
Related Application Notes: click here
AN402 describes the real-time clock (RTC) oscillator and provides design considerations for using the RTC in the
F-RAM™ processor companions.
1
Overview
The FM31xxx and FM33xxx are integrated processor companion devices that feature a real-time clock or RTC. The
RTC provides the date and time information for the system. The RTC operates on VDD power and switches to a
backup supply when the VDD power is removed. Under backup power, the RTC draws very little current, which allows
a long operating time. The accuracy of the RTC is dependent mainly on the accuracy of the crystal oscillator. The
crystal frequency is affected by the capacitive rating of the crystal and the operating temperature. This application
note focuses on the RTC oscillator and provides design considerations for a system designer using these devices.
2
Oscillator and Crystals
The heart of the RTC is the oscillator, which uses a 32.768-kHz crystal. It provides an accurate, low-power time base
for the divide-by counters that generate seconds, minutes, hours, and more. The oscillator must work properly and be
undisturbed for the clock/time to be accurate over long periods of time. An F-RAM processor companion with crystal
is shown in Figure 1.
Figure 1. Crystal Hookup to F-RAM RTC
X1
32.768 kHz
Crystal
X2
F-RAM
Processor
Companion
with RTC
The RTC oscillator is designed to use a 32.768-kHz crystal (having 6 pF/12.5 pF load capacitance specification)
without the need for any external components. If additional components, such as capacitors or resistors, are
connected to the X1 or X2 pins, the oscillator will not operate properly because the DC operating point and the
oscillator frequency will be shifted. It is possible that the oscillator will not even start at power up. Passive 10X
oscilloscope probes with 10 pF and 10 MΩ impedance will also upset the oscillator.
The simplified schematic of the oscillator in Figure 2 shows a Pierce oscillator with C1 and C2 loading capacitors
inside the chip.
Figure 2. Simplified Oscillator Circuit
VBAK
150 nA
X1
32.768-kHz
Crystal
C1
X2
C2
www.cypress.com
Document No. 001-87418 Rev. *B
1
F-RAM™ RTC Oscillator Design Guide
The capacitors operate in series with the crystal, so the CLOAD is C1 * C2 / (C1 + C2). For all F-RAM parts, C1 and
C2 are 12 pF; hence, CLOAD is 6 pF. The F-RAM RTC oscillator is optimized for using the 6-pF crystal to achieve
the lowest operating current under backup power. A 12.5-pF crystal will also work equally well but draws almost twice
as much current. When using a 12.5-pF crystal, consider the loading mismatch and take appropriate measure to
offset the frequency shift.
Note: All 32.768-kHz crystals have a load capacitance specification. There are two common crystals in the market: a
“6 pF” type and a “12.5 pF” type. This is the recommended capacitive load that the crystal must see across the X1
and X2 pins while operating. That is, the X1/X2 pins must present a 6-pF load to a 6-pF crystal. The load capacitance
specification is not the actual capacitance of the crystal. The actual capacitance of the crystal (shunt capacitance) is
about 1 pF.
3
Oscillator Frequency Shift
Typically, RTC calibration is required primarily to compensate for the crystal tolerance, whether ±10 ppm, ±20 ppm,
or ±50 ppm. The use of a 12.5-pF crystal introduces a loading mismatch factor when calibrating the RTC. A 12.5-pF
crystal expects a capacitive load of 12.5 pF to ensure accurate frequency. However, because the F-RAM processor
companions are designed for 6-pF crystals, the load presented to the crystal is roughly half the rated value.
Therefore, this lighter load presented across the crystal shifts the oscillation frequency. The shift has been measured
and is typically about +90 ppm or 2.9 Hz. The actual crystal frequency will be 32.7709 kHz. In calibration mode, this
frequency shift can be measured directly on the CAL pin (ACS pin on FM33256B) as 512.046 Hz. Figure 3 shows the
parallel resonance area as the bold line where the RTC oscillator operates. A 12.5-pF crystal (with 6-pF load)
operates higher on the curve.
A +90 ppm error translates to nearly four minutes of clock deviation per month (the clock runs fast), so calibrating the
RTC is highly desirable to achieve clock accuracy. You must note that the effect of the calibration setting to minimize
the frequency error will not be observed on the CAL pin (ACS pin on FM33256B). The RTC applies a digital
correction to the counter logic downstream of the 512-Hz output.
Figure 3. Higher Oscillator Frequency for 12.5 pF Crystal
12.5 pF
+
reactance
6 pF
_
f
frequency
S
If you use a 12.5-pF crystal, Cypress recommends that the specified tolerance be ±20 ppm (or better) to ensure that
the total error (tolerance + mismatch) remains within the ±135 ppm calibration range. If you use a 6-pF crystal, the
tolerance can be as high as ±100 ppm, because this is well within the calibration range.
Precautionary note: The oscillator’s 32.768-kHz frequency cannot be monitored directly by probing the X1 and X2
pins. Do not attach a scope probe or meter to the X1 and X2 pins. In calibration mode, the CAL pin is used to check
the frequency. Moreover, the calibration code can be entered only in calibration mode.
4
Calibration Procedure
The following sequence shows how to measure the oscillator frequency and apply a calibration code. On two-wire
devices, remember to use the slave ID 1101b to access the RTC registers.
1.
Apply VDD.
2.
Apply VBAK.
3.
Cycle VDD off then on again.
4.
Turn on the oscillator by setting O C
RTC Register 00h).
www.cypress.com
bit low. Write 00h to RTC Register 01h (For FM33256B, write 00h to
Document No. 001-87418 Rev. *B
2
F-RAM™ RTC Oscillator Design Guide
5
5.
Set CAL bit high. Write 04h to RTC Register 00h.
6.
Measure the 512-Hz output on CAL pin (ACS pin on FM33256B) with a frequency counter.
7.
Determine the calibration code setting from the table in Calibration Table (This table is also available in the
device datasheet).
8.
Apply the calibration code. For example, a 12.5-pF crystal makes the oscillator run fast and the CAL output is
512.046 Hz. Write 16h to RTC Register 01h.
9.
Reset CAL bit. Write 00h to RTC Register 00h.
Temperature Effects
A key factor that contributes to timekeeping error is the crystal's temperature – even after the RTC is calibrated. A
calibration code can compensate for timekeeping errors due to capacitive load mismatch and crystal tolerance, but
not for temperature. Figure 4 shows a typical temperature curve for 32.768-kHz crystals. As temperature rises or
drops from +25 °C, the oscillation frequency shifts lower and therefore the clock slows down.
Figure 4. Crystal Frequency Change vs. Temperature
+25
-40
+85
Temp
(°C)
-50
-100
∆f/f
(ppm)
If your system is at room temperature most of the time and has few excursions above and below 25 °C, then you
should calibrate to “zero out” any frequency error by complying with the table in Calibration Table. On the other hand,
if the system frequently spends time above or below room temperature, you will achieve improved clock accuracy by
intentionally creating a slightly positive frequency error.
For example, assume the system spends half the time at 25 °C and half at 50 °C, and the frequency error at 50 °C is
-30 ppm. Applying a calibration code that will shift clock by +15 ppm will compensate for temperature changes.
Consult the crystal manufacturer for a temperature dependence curve.
6
External Oscillator
If a 32.768-kHz crystal is not used, an external oscillator may be connected to the F-RAM RTC oscillator. Apply the
oscillator to the X1 pin. Its high and low voltage levels can be driven rail-to-rail or to amplitudes as low as
approximately 500 mV p-p. To ensure proper operation, a DC bias must be applied to the X2 pin. It should be
centered between the high and low levels on the X1 pin. This can be accomplished with a voltage divider as shown in
Figure 5.
Figure 5. External Oscillator
www.cypress.com
Document No. 001-87418 Rev. *B
3
F-RAM™ RTC Oscillator Design Guide
In the above example, R1 and R2 are chosen such that the X2 voltage is centered on the X1 oscillator drive levels. If
you wish to avoid the DC current, you may choose to drive X1 with an external clock and X2 with an inverted clock
using a CMOS inverter.
7
Layout Recommendations
The X1 and X2 crystal pins are high-impedance pins, which must be treated with care:

Ensure that the crystal lead length to the X1 and X2 pins is short, less than 5 mm. Also the X1 and X2 trace
lengths should be less than 5 mm.




Ensure that the VDD pin has good decoupling (0.1 uF with return to ground plane).
Do not route other signals close to the X1/X2 pins, even if the signal is routed on an inner board layer.
Use a guard ring (ground) around the crystal pins.
Use a ground plane on the back or inner board layer.
An FM31xx device and SMD crystal are shown in the example layout shown in Figure 6. Note the plated-through
holes that tie the guard ring down to the ground plane.
Figure 6. Layout for Surface Mount Crystal
(red = top layer, green = bottom layer)
8
Summary
This application note described the oscillator selection, frequency shift, calibration procedure, and layout design
guidelines for F-RAM processor companion devices.
9
Related Application Notes
You can refer to the following application notes for better understanding of the F-RAM processor companion devices.

AN407 - A Design Guide to I2C F-RAM Processor Companions – FM31278, FM31276, FM31L278, and
FM31L276




AN408 - A Design Guide to SPI F-RAM Processor Companion - FM33256B
AN400 - Generating a Power-Fail Interrupt using the F-RAM Processor Companion
AN401 - Charging Methods for the F-RAM RTC Backup Capacitor
AN404 - F-RAM RTC Backup Supply (VBAK pin) and UL Compliance
www.cypress.com
Document No. 001-87418 Rev. *B
4
F-RAM™ RTC Oscillator Design Guide
A
Calibration Table
Positive Calibration for Slow Clocks (Calibration will achieve ±2.17 PPM after calibration)
Measured Frequency Range
Error Range (PPM)
Program Calibration Register to:
Min
Max
Min
Max
0
512.0000
511.9989
0
2.17
000000
1
511.9989
511.9967
2.18
6.51
100001
2
511.9967
511.9944
6.52
10.85
100010
3
511.9944
511.9922
10.86
15.19
100011
4
511.9922
511.9900
15.20
19.53
100100
5
511.9900
511.9878
19.54
23.87
100101
6
511.9878
511.9856
23.88
28.21
100110
7
511.9856
511.9833
28.22
32.55
100111
8
511.9833
511.9811
32.56
36.89
101000
9
511.9811
511.9789
36.90
41.23
101001
10
511.9789
511.9767
41.24
45.57
101010
11
511.9767
511.9744
45.58
49.91
101011
12
511.9744
511.9722
49.92
54.25
101100
13
511.9722
511.9700
54.26
58.59
101101
14
511.9700
511.9678
58.60
62.93
101110
15
511.9678
511.9656
62.94
67.27
101111
16
511.9656
511.9633
67.28
71.61
110000
17
511.9633
511.9611
71.62
75.95
110001
18
511.9611
511.9589
75.96
80.29
110010
19
511.9589
511.9567
80.30
84.63
110011
20
511.9567
511.9544
84.64
88.97
110100
21
511.9544
511.9522
88.98
93.31
110101
22
511.9522
511.9500
93.32
97.65
110110
23
511.9500
511.9478
97.66
101.99
110111
24
511.9478
511.9456
102.00
106.33
111000
25
511.9456
511.9433
106.34
110.67
111001
26
511.9433
511.9411
110.68
115.01
111010
27
511.9411
511.9389
115.02
119.35
111011
28
511.9389
511.9367
119.36
123.69
111100
29
511.9367
511.9344
123.70
128.03
111101
30
511.9344
511.9322
128.04
132.37
111110
31
511.9322
511.9300
132.38
136.71
111111
www.cypress.com
Document No. 001-87418 Rev. *B
5
F-RAM™ RTC Oscillator Design Guide
Negative Calibration for Fast Clocks (Calibration will achieve ±2.17 PPM after calibration)
Measured Frequency Range
Error Range (PPM)
Program Calibration Register to:
Min
Max
Min
Max
0
512.0000
512.0011
0
2.17
000000
1
512.0011
512.0033
2.18
6.51
000001
2
512.0033
512.0056
6.52
10.85
000010
3
512.0056
512.0078
10.86
15.19
000011
4
512.0078
512.0100
15.20
19.53
000100
5
512.0100
512.0122
19.54
23.87
000101
6
512.0122
512.0144
23.88
28.21
000110
7
512.0144
512.0167
28.22
32.55
000111
8
512.0167
512.0189
32.56
36.89
001000
9
512.0189
512.0211
36.90
41.23
001001
10
512.0211
512.0233
41.24
45.57
001010
11
512.0233
512.0256
45.58
49.91
001011
12
512.0256
512.0278
49.92
54.25
001100
13
512.0278
512.0300
54.26
58.59
001101
14
512.0300
512.0322
58.60
62.93
001110
15
512.0322
512.0344
62.94
67.27
001111
16
512.0344
512.0367
67.28
71.61
010000
17
512.0367
512.0389
71.62
75.95
010001
18
512.0389
512.0411
75.96
80.29
010010
19
512.0411
512.0433
80.30
84.63
010011
20
512.0433
512.0456
84.64
88.97
010100
21
512.0456
512.0478
88.98
93.31
010101
22
512.0478
512.0500
93.32
97.65
010110
23
512.0500
512.0522
97.66
101.99
010111
24
512.0522
512.0544
102.00
106.33
011000
25
512.0544
512.0567
106.34
110.67
011001
26
512.0567
512.0589
110.68
115.01
011010
27
512.0589
512.0611
115.02
119.35
011011
28
512.0611
512.0633
119.36
123.69
011100
29
512.0633
512.0656
123.70
128.03
011101
30
512.0656
512.0678
128.04
132.37
011110
31
512.0678
512.0700
132.38
136.71
011111
www.cypress.com
Document No. 001-87418 Rev. *B
6
F-RAM™ RTC Oscillator Design Guide
Document History
Document Title: AN402 – F-RAM™ RTC Oscillator Design Guide
Document Number: 001-87418
Revision
ECN
Orig. of
Change
Submission
Date
Description of Change
**
4018188
MEDU
06/07/2013
New Spec.
*A
4559478
MEDU
11/04/2014
Changed title from “F-RAM RTC Oscillator Guide” to “F-RAM RTC Oscillator
Design Guide”
Included content from AN403, “F-RAM RTC Crystals – 6 pF vs. 12.5 pF”
Updated 6-pF RTC oscillator load for all F-RAMs
Added the Related Application Notes section
Added Appendix A for the calibration table
*B
5293268
www.cypress.com
MEDU
06/02/2016
Updated template
Document No. 001-87418 Rev. *B
7
F-RAM™ RTC Oscillator Design Guide
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find
the office closest to you, visit us at Cypress Locations.
PSoC® Solutions
Products
®
®
ARM Cortex Microcontrollers
cypress.com/arm
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Automotive
cypress.com/automotive
Cypress Developer Community
Clocks & Buffers
cypress.com/clocks
Interface
cypress.com/interface
Lighting & Power Control
cypress.com/powerpsoc
Memory
cypress.com/memory
PSoC
cypress.com/psoc
Touch Sensing
cypress.com/touch
USB Controllers
cypress.com/usb
Wireless/RF
cypress.com/wireless
Forums | Projects | Videos | Blogs | Training | Components
Technical Support
cypress.com/support
PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corporation. All other trademarks or registered trademarks
referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone
Fax
Website
: 408-943-2600
: 408-943-4730
: www.cypress.com
© Cypress Semiconductor Corporation, 2013-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries,
including pansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“ oftware”), is owned
by Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such
laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other
intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to
sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of
Cypress’s patents that are infringed by the oftware (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for
use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or
circuit described in this document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and
safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as
critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances
management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A
critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or
system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim,
damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or
registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other
names and brands may be claimed as property of their respective owners.
www.cypress.com
Document No. 001-87418 Rev. *B
8