Hardware -- Clock source

A project log for Heartbeat Logger

A portable device that logs a snippet of your heart at the push of a button.

Ole Andreas UtstumoOle Andreas Utstumo 01/24/2016 at 19:560 Comments

The frequency of the RC-oscillator providing the 8 MHz system clock for the SAMD20 series is given in the datasheet with a tolerance of up to 6 percent. For many applications, this is more than adequate. For applications where timekeeping is crucial, such as data logging, a tolerance of 10 percent would be unacceptable. Did the user have a pulse of 90 or 110 bpm, 900 or 1100 seconds ago? Even though the SAMD20 provides a factory calibrated RC oscillator of 32.768kHz, changes in temperature and aging may still cause a noticable drift in the frequency due to the nature of RC oscillators.

To make sure our measurements are accurate, a crystal will be used in the clock generation
for the Real Time Counter module of the SAMD20. A crystal is a discrete component with a large Q factor, making a tolerance of fractions of a percent possible.

The system clock for the CPU and all other peripherals will generated by the internal 8 MHz
RC oscillator.

Image courtesy of Atmel, page 625 in the SAMD20 manual.

Normally, when crystals are connected to a microcontroller in parallel-resonance mode,
such as in this case, a set of load capacitors are needed to bring a known capacitance the LC
network that is formed with the inductance of the crystal. These load capacitors are for the
XIN32 and XOUT32 pins provided internally as long as the load capacitance for the crystal is 12.5 pF or below, so the crystal can be connected directly to the pins by it self. Recommended maximum series resistance of the crystal is given in the manual (p. 624) to be 313 kOhm. I settled on an Abracon 7pF crystal. Can't remember why 7 pF, though :)