Afterchoosing an external crystal for a C8051 MCU, there are several guidelines in the device datasheets for ensuring that you configure the MCU oscillator drive circuit correctly to match the specifications of your crystal. Specifically, it is best to configure the MCU to deliver drive current appropriate for the recommended drive level (generally expressed in µW) of the crystal without exceeding the maximum drive level. Overdriving a crystal resonator can have a number of negative effects, including reduced device operational lifetime, cracking of the crystal structure, and device failure. The image below shows an example of some crystal resonator specifications from a sample datasheet .
For this example, let's assume that we are working with a 24 MHz crystal. Additionally, we are using tables and information from the C8051F550 datasheet for this example.
The C8051 datasheets provide several methods for determining the correct External Oscillator Frequency Control Bits (XFCN) in the Oscillator Control Register (OSCXCN[2:0]). The datasheet register description contains the following table for determining the correct XFCN setting based on frequency:
Based on this table, for a 24 MHz crystal we would choose XFCN = 111b. Some C8051 datasheets, including the C8051F550 datasheet, have been updated to include a Crystal Drive Current specification in the Electrical Characteristics section:
The drive level (DL) of a crystal is given by the equation
DL = ESR * (I^2)
where DL is expressed in Watts, ESR is the crystal equivalent series resistance in Ohms, and I is the drive current, given in Amps. Using the drive currents for each XFCN value in Table 5.8 and the crystal device specifications, we can calculate the DL for this crystal at each XFCN setting:
Given that the target DL for the crystal is 10 µW and the max DL is 100 µW, this calculation tells us that the most appropriate XFCN setting for this application is in fact XFCN = 110b.
Using the Crystal Drive Current from the C8051 device Electrical Characteristics section, if available, to calculate drive level is the recommended method for determining the XFCN setting for a given crystal. While not all of the C8051 family device datasheets have been amended to include this specification table, the drive currents for all C8051 devices will be similar because the drive circuits are similar or the same. Variations in actual current levels will occur due to some factors, including different manufacturing process technologies. It is recommended that you consult the device datasheet for your particular device for the most accurate drive current specifications.