
Chapter 18 Background Debug Module (BDMV4)
MC9S12HZ256 Data Sheet, Rev. 2.04
Freescale Semiconductor
527
Figure 18-11
shows the ACK handshake protocol in a command level timing diagram. The READ_BYTE
instruction is used as an example. First, the 8-bit instruction opcode is sent by the host, followed by the
addressofthememorylocationtoberead.ThetargetBDMdecodestheinstruction.Abuscycleisgrabbed
(free or stolen) by the BDM and it executes the READ_BYTE operation. Having retrieved the data, the
BDMissuesanACKpulsetothehostcontroller,indicatingthattheaddressedbyteisreadytoberetrieved.
AfterdetectingtheACKpulse,thehostinitiatesthebyteretrievalprocess.Notethatdataissentintheform
of a word and the host needs to determine which is the appropriate byte based on whether the address was
odd or even.
Figure 18-11. Handshake Protocol at Command Level
Differentlyfromthenormalbittransfer(wherethehostinitiatesthetransmission),theserialinterfaceACK
handshake pulse is initiated by the target MCU by issuing a falling edge in the BKGD pin. The hardware
handshake protocol in
Figure 18-10
specifies the timing when the BKGD pin is being driven, so the host
should follow this timing constraint in order to avoid the risk of an electrical conflict in the BKGD pin.
NOTE
The only place the BKGD pin can have an electrical conflict is when one
sideisdrivinglowandtheothersideisissuingaspeeduppulse(high).Other
“highs” are pulled rather than driven. However, at low rates the time of the
speedup pulse can become lengthy and so the potential conflict time
becomes longer as well.
The ACK handshake protocol does not support nested ACK pulses. If a BDM command is not
acknowledge by an ACK pulse, the host needs to abort the pending command first in order to be able to
issue a new BDM command. When the CPU enters WAIT or STOP while the host issues a command that
requires CPU execution (e.g., WRITE_BYTE), the target discards the incoming command due to the
WAIT or STOP being detected. Therefore, the command is not acknowledged by the target, which means
that the ACK pulse will not be issued in this case. After a certain time the host should decide to abort the
ACK sequence in order to be free to issue a new command. Therefore, the protocol should provide a
mechanism in which a command, and therefore a pending ACK, could be aborted.
NOTE
DifferentlyfromaregularBDMcommand,theACKpulsedoesnotprovide
atimeout.ThismeansthatinthecaseofaWAITorSTOPinstructionbeing
executed,theACKwouldbepreventedfrombeingissued.Ifnotaborted,the
ACKwouldremainpendingindefinitely.Seethehandshakeabortprocedure
described in
Section 18.4.8, “Hardware Handshake Abort Procedure
.”
READ_BYTE
BDM ISSUES THE
ACK PULSE (OUT OF SCALE)
BKGD PIN
BYTE ADDRESS
BDM EXECUTES THE
READ_BYTE COMMAND
HOST
TARGET
HOST
TARGET
BDM DECODES
THE COMMAND
HOST
TARGET
(2) BYTES ARE
RETRIEVED
NEW BDM
COMMAND