and peripheral subsystems, the
MC68HC908MR16 is relatively easy
to bring up and use. With that, let’s
begin by building up a custom
MC68HC908MR16 MCU module.
ASSEMBLING AN
MC68HC908MR16
MCU MODULE
A custom printed circuit board
(PCB) would be the way to go
if we were designing the
MC68HC908MR16 into a dedicated
embedded application. However, the
object of this column is to introduce
you to the MC68HC908MR16 and all
of its major peripheral subsystem
modules.
Solderless breadboards are ideal
experimentation platforms, but the
.1-inch grid of a solderless breadboard is not at all friendly with the
sub-millimeter pitch of the
MC68HC908MR16’s pins. One
solution to this dilemma is to design
a custom PCB for the MCU and make
the custom MCU printed circuit board
compatible with a solderless breadboard grid. That’s exactly what I’ve
done.
The MC68HC908MR16 MCU
module you see in Photo 1 is an
independent MC68HC908MR16
microcontroller system complete with
CPU clock circuitry, reset circuitry, and
power rail bypassing that fits into a
standard 64-pin DIP socket footprint.
Applying + 5 VDC to the
MC68HC908MR16 module is all we
have to do to make it go. And, since
the MC68HC908MR16 MCU module
pins are on .1-inch centers, it is
solderless breadboard friendly.
As you can see from the
MC68HC908MR16 schematic, there
isn’t much needed in the way of
external components to clock and
reset the MC68HC908MR16. If you’re
wondering about how I came to select
a 4.9152 MHz crystal, it all has to do
with baud rates, some easy math, and
the MC68HC908MR16’s internal PLL
(Phase Locked Loop). Let’s take a
closer look at how I determined the
value of filter capacitor C7 and what
to put into the MC68HC908MR16’s
CGM (Clock Generator Module)
registers.
The MC68HC908MR16’s CGM
generates the crystal clock frequency, which is called CGMXCLK.
The frequency of CGMXCLK is equal
to the frequency of the crystal.
The base clock signal, CGMOUT,
is also a product of the CGM
clock generation process. The
MC68HC908MR16’s system and
peripheral clocks are fed by
CGMOUT. CGMOUT is based on
either the crystal clock divided by
two or the PLL clock divided by two.
The PLL clock is called CGMVCLK.
The maximum bus frequency that
can be safely dialed into the
MC68HC908MR16’s clocking scheme
is 8 MHz. The MC68HC908MR16’s bus
frequency is defined as CGMOUT
divided by 4 as the CGMOUT signal,
which is the CGMXCLK frequency
divided by 2, is divided by 2 again
after it reaches the SIM (System
Integration Module). The SIM distributes the clock signals to the various
MCU subsystems.
Let’s say that you want to run
the MC68HC908MR16 bus at 8 MHz.
The maximum crystal frequency allowed
across the MC68HC908MR16’s OSC1
and OSC2 pins is 8 MHz, which
means you can’t drive the
MC68HC908MR16’s crystal oscillator
with a 32 MHz crystal. So, you would
be forced to connect a 32 MHz
oscillator module to the
MC68HC908MR16’s OSC1 pin to
achieve the 8 MHz bus frequency.
An 8 MHz bus frequency is great
if all you want is speed. However,
what if you wanted to drive the
MC68HC908MR16’s SCI baud rate
generator to produce a reliable serial
baud rate of 115200 bps? If you do
the math, you’ll find
that the 115200 baud
rate error percentage
with an 8 MHz bus
clock is a little less
than 8%. Driving the
MC68HC908MR16’s
bus at 7.3728 MHz
will produce a rock-solid baud rate of
115200 bps from the
MC68HC908MR16’s
SCI baud rate generator with 0%
error.
A little high school math tells us
that the crystal frequency to achieve
the 7.3728 MHz bus frequency will be
29.4912 MHz ( 4 * 7.3728 MHz), which
is again too high for a crystal to
drive the MC68HC908MR16’s crystal
oscillator. Even though the oscillators are good clocking solutions in
some cases, a more flexible and cost
effective solution can be achieved
by using the MC68HC908MR16’s
PLL and a cheaper, lower frequency
crystal.
The MC68HC908MR16’s PLL is
composed of a VCO (Voltage
Controlled Oscillator), a modulo
VCO frequency divider, a phase
detector, a loop filter, and a lock
detector. The operating range of the
MC68HC908MR16’s PLL VCO is
approximately one-half to twice
the center-of-range frequency. The
frequency of the VCO is changed by
modulating the voltage on the
CGMXFC pin, which attaches to the
C7 filter capacitor I mentioned earlier. The nominal VCO center-of-range
frequency is equal to 4.9152 MHz.
DING!
Now that you know where my
crystal frequency value came from,
let’s put a pencil to the PLL calculations. To run as fast as possible and
■ PHOTO 2. The Cyclone PRO is able to
debug and program Freescale Semiconductor 68HC908 targets in-circuit via the
Monitor ROM (MON08 Port). This amazing box can communicate with a PC
through either RS-232, Ethernet, or USB
interfaces. Don’t want a PC in the mix —
the Cyclone PRO can be configured to
function as a stand-alone programmer
and program target HC08 devices independent of a PC. The neatest feature of
the Cyclone Pro is its ease of use.
February 2006 79