Tutorial: handling PLL frequency multipliers circuits in 18F2550 to generate maximum speed of 48 Mhz.



The 18F2550 microcontroller chip, has a sophisticated hardware to operate its circuits through a user selectable internal or external oscillator. This hardware also includes a frequency multiplier circuit PLL (Phase Locked Loop).

The speed of operation of the microcontroller 18F2550, is determined not only by the frequency of its oscillator (internal or external), but also by the configuration of the PLL (by initializing its configuration registers). This gives the user a great range of options.

In addition, the USB port can operate both at low speed (1.5 Mbps, with a clock of 6 MHz) or high speed (12 Mbps Mhz, with a clock of 48 Mhz.). At 48 MHz, which is the maximum speed at which the 18F2550 can operate, the period of execution of each instruction, is 83.3 nanoseconds, considering that each instruction is executed in four clock cycles.

Operation of 18F2550 with an external crystal of 20 Mhz:

Bolt 18F2550 system uses an external crystal 20 Mhz. However, due to its frequency multiplier circuit PLL (Phase Locked Loop), the effective rate is 48 Mhz and the speed of your USB port is 12 Mbps.

The figure below shows the block diagram of the clock generation system for both the CPU and to the USB port circuits.

In the particular case 18F2550 Bolt system, its configuration registers are already initialized via their bootloader firmware, so that the user will operate directly on the effective speed indicated above.

The 18F2550 receives the signal from the external crystal and use a prescaler that divides its frequency (depending on its configuration registers), from one of the following values: 1, 2, 3, 4, 5, 6, 10, or 12. The PLL circuit input must be consistently 4 Mhz. For operation at 20 MHz, the prescaler is dividing by 5.

These 4 MHz pass through the PLL and generates at its output 96 Mhz, which in turn are divided by 2 to give finally 48 MHz signal. This allows a speed of 12 Mhz in the USB port to communicate with any host computer.

Configuration registers for 48 Mhz operation:

300000H CONFIG1L= 24H

Bit 7=0

Bit 6=0 Bit 5=0 Bit 4=0 Bit 3=0 Bit 2=0 Bit 1=0 Bit 0=0




USBDIV=1: Clock of USB comes from 96 Mhz output divided by 2.

CPUDIV1=0,CPUDIV0=0: Principal oscilator (20 Mhz) is used as system clock.

PLLDIV2=1,PLLDIV1=0,PLLDIV0=0: Divides by 5 the frequency of external oscillator (20 Mhz)

300001H CONFIG1H=0EH

Bit 7=0

Bit 6=0 Bit 5=0 Bit 4=0 Bit 3=1 Bit 2=1 Bit 1=1 Bit 0=0

IESO=0: function of automatic switching of oscillator is disabled.

FCMEN=0: fuction of automatic monitoring of oscillator is disabled.

FOSC3=1,FOSC2=1,FOSC1=1,FOSC0=0: external high frequency (20 Mhz) oscillator and PLL activated.