![](http://datasheet.mmic.net.cn/Freescale-Semiconductor/MC68HC16Z1VEH16_datasheet_98737/MC68HC16Z1VEH16_27.png)
3 Establishing Communication
3.1 Communicating with the Target Board
After a target board has been built, it is generally necessary to communicate with it for debugging pur-
poses. Although a designer can write a ROM monitor to communicate with the MCU via the serial port,
it is simpler and often more effective to use an emulator or the CPU16 background debug mode (BDM)
for communication.
3.1.1 Using an Emulator
An emulator is a direct replacement for the chip that is used to evaluate both software and signals on
the target board. Emulators can be very sophisticated and costly, but are very useful in tracking down
design problems because they allow the designer to see exactly what the MCU is doing at every step
of operation. When both the board and code are fully debugged, the emulator is removed and the MCU
is placed on the board.
3.1.2 Using Background Debug Mode
Background debug mode is a special CPU operating mode that allows an external host to take control
of the MCU. BDM is a very useful tool for debugging. During BDM operation, normal instruction execu-
tion is suspended, and microcode executes built-in debugging instructions under external control. Since
BDM suspends processor execution, an external host can examine and change memory and registers.
BDM instructions and the protocol required to use them are described in detail in the
CPU16 Reference
Manual (CPU16RM/AD). AN1230/D, A BDM Driver Package for Modular Microcontrollers, shows how
to implement a BDM communication interface using C-language drivers.
While a BDM interface is relatively easy to implement, ready-made BDM interfaces are inexpensive and
reliable. Freescale sells the M68ICD16 BDM debugger made by P&E Microcomputer Systems. The
M68ICD16 consists of the necessary cable and software to implement BDM debugging on an IBM-com-
patible PC. All the discussions in this section assume that M68ICD16 is being used.
3.1.2.1 BDM Signals
To use BDM, simply connect ten MCU lines to pins on the development board that are spaced so that
a female Berg connector can plug into them. Figure 16 shows the pinouts for the recommended 10-pin
BDM connector. Table 4 describes the BDM signals.
Figure 16 10-Pin BDM Connector
332TUT BERG10
GND
RESET
VDD
2
4
6
8
10
DS
GND
1
3
5
7
9
BERR
BKPT/DSCLK
FREEZE
IPIPE1/DSI
IPIPE0/DS0
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.