English
Language : 

MC9S12KG128 Datasheet, PDF (457/600 Pages) Freescale Semiconductor, Inc – Microcontrollers
Chapter 15 Background Debug Module (BDMV4)
firmware. The standard BDM firmware watches for serial commands and executes them as they are
received.
The firmware commands are shown in Table 15-6.
Table 15-6. Firmware Commands
Command1 Opcode (hex)
Data
Description
READ_NEXT
62
16-bit data out Increment X by 2 (X = X + 2), then read word X points to.
READ_PC
63
16-bit data out Read program counter.
READ_D
64
16-bit data out Read D accumulator.
READ_X
65
16-bit data out Read X index register.
READ_Y
66
16-bit data out Read Y index register.
READ_SP
67
16-bit data out Read stack pointer.
WRITE_NEXT
42
16-bit data in Increment X by 2 (X = X + 2), then write word to location pointed to by X.
WRITE_PC
43
16-bit data in Write program counter.
WRITE_D
44
16-bit data in Write D accumulator.
WRITE_X
45
16-bit data in Write X index register.
WRITE_Y
46
16-bit data in Write Y index register.
WRITE_SP
47
16-bit data in Write stack pointer.
GO
GO_UNTIL2
08
None
0C
None
Go to user program. If enabled, ACK will occur when leaving active
background mode.
Go to user program. If enabled, ACK will occur upon returning to active
background mode.
TRACE1
10
None
Execute one user instruction then return to active BDM. If enabled, ACK
will occur upon returning to active background mode.
TAGGO
18
None
Enable tagging and go to user program. There is no ACK pulse related to
this command.
1 If enabled, ACK will occur when data is ready for transmission for all BDM READ commands and will occur after the write is
complete for all BDM WRITE commands.
2 Both WAIT (with clocks to the S12 CPU core disabled) and STOP disable the ACK function. The GO_UNTIL command will not
get an Acknowledge if one of these two CPU instructions occurs before the “UNTIL” instruction. This can be a problem for any
instruction that uses ACK, but GO_UNTIL is a lot more difficult for the development tool to time-out.
15.4.5 BDM Command Structure
Hardware and firmware BDM commands start with an 8-bit opcode followed by a 16-bit address and/or a
16-bit data word depending on the command. All the read commands return 16 bits of data despite the byte
or word implication in the command name.
NOTE
8-bit reads return 16-bits of data, of which, only one byte will contain valid
data. If reading an even address, the valid data will appear in the MSB. If
reading an odd address, the valid data will appear in the LSB.
MC9S12KG128 Data Sheet, Rev. 1.15
Freescale Semiconductor
457