EM6640
03/02 REV. C/446
Copyright
2002, EM Microelectronic-Marin SA
13
www.emmicroelectronic.com
5. Oscillator and Prescaler
5.1 Oscillator
An RC oscillator generates the system operating clock for the CPU and peripheral circuits. The frequency can be
adjusted if necessary by
±32% in steps of 1% by writing bits OscAdj[5:0] in the registers OPTPaRST and
OPTOscAdj. The adjustable frequency range allowed is specified on page
55 (If you have a special request
please contact EM Microelectronic Marin SA).
At power up, the default frequency is the lowest. The frequency is stored by adjusting the 6 bits in the EEPROM
and transferring them to the registers OPTPaRST and OPTOscAdj. To increase frequency, put a higher
calibration values and to decrease it, put a lower calibration values.
The adjustment value of the oscillator is written at EM-Marin at the last address of the EEPROM. By reading these
6 EEPROM bits and writing the contents to the registers OPTOscAdj and OPTPaRST, the delivery state will be
Frequency adjustment procedure (example):
- 1st: selecting ck[20] output on PB[0] with the bit PB600kHzOut in register OPTFSelPB.
- 2nd: measure the output frequency with a frequency meter.
- 3rd: if it is not the desired frequency, modify the 6 bits dedicated to the RC oscillator in the registers OPTOscAdj
and OPTPaRST.
- 4th: return to the point 2 until desired frequency is obtained.
- 5th: write the contents of the registers OPTOscAdj and OPTPaRST (2 MSB) to the EEPROM.
- (6th:read these 6 EEPROM bits and write the contents to the registers OPTOscAdj and OPTPaRST.)
The above procedure should be followed for the initial adjustment (first POR). For subsequent initializations the
calibration values can be read from the EEPROM (start from point 6). It is not necessary to do this after any other
resets (The values of the Option Registers are set by initial reset on power up and through write operations only).
To guarantee the good functionality of the whole circuit, it is recommended to adjust operating clock at 600 kHz.
User can decide himself which EEPROM address to use for the RC oscillator data if the last EEPROM address
can not be kept.
Three different frequencies can be provided on the PortB[2:0] terminals (see section:
PWM and Frequencyoutput, on page
20). The highest is 600kHz which comes directly from the RC oscillator. The two others, 37.5kHz
and 2.3kHz, come from the prescaler.
The oscillator circuit is supplied by the regulated voltage, VregLogic. In SLEEP mode the oscillator is stopped.
No external components are necessary.
Table 5.1.1 register OPTPaRST
Bit
Name
power on
value
R/W
Description
3
OscAdj[5]
0
R/W
Adjustment of RC oscillator in EEPROM (MSB)
2
OscAdj[4]
0
R/W
Adjustment of RC oscillator in EEPROM
1
SelinpResMod
0
R/W
input reset mode (Or or AND logic)
0
NoInputReset
0
R/W
PortA input reset option
Default
″0″ is : no adjustment of the frequency
Table 5.1.2 register OPTOscAdj
Bit
Name
power on
value
R/W
Description
3
OscAdj[3]
0
R/W
Adjustment of RC oscillator in EEPROM
2
OscAdj[2]
0
R/W
Adjustment of RC oscillator in EEPROM
1
OscAdj[1]
0
R/W
Adjustment of RC oscillator in EEPROM
0
OscAdj[0]
0
R/W
Adjustment of RC oscillator in EEPROM (LSB)
Default
″0″ is : no adjustment of the frequency