Texas Instruments MSC1210 User Manual
Page 190
Breakpoint Generator
15-8
To configure a breakpoint, the following steps should be taken:
1) The BPSEL (MCON.7) bit must be set to either 0 (for Breakpoint 0) or 1
(for Breakpoint 1).
2) The Program Memory Select bit, PMSEL (BPCON.1), must be either
cleared if the breakpoint is to detect an access to data memory, or set if
the breakpoint is to detect an access to program memory.
3) BPL and BPH should be loaded with the low and high byte, respectively,
of the address at which the breakpoint should be triggered.
4) The Enable Breakpoint bit, EBP (BPCON.0), must then be set to activate
the interrupt.
15.3.2 Breakpoint Auxiliary Interrupt
Once a breakpoint interrupt has been configured, the BP (BPCON.7) interrupt
flag will be set and, if enabled and not masked, a breakpoint auxiliary interrupt
will be triggered whenever the specified memory address is accessed. The
program must write a 1 back to BPCON.7 in order to clear the interrupt after
processing it.
When a breakpoint interrupt occurs, the program may read the BPSEL
(MCON.7) bit to determine which breakpoint was triggered. If BPSEL is clear,
Breakpoint 0 triggered the interrupt. If BPSEL is set, Breakpoint 1 triggered the
interrupt.
When using breakpoints, notice that the actual breakpoint occurs after the se-
lected address. That is because of interrupt latency on the MSC1210. It takes
a few cycles for the interrupt to be recognized and serviced. During that time
the processor continues for two or three more instructions, which means that
the program counter will be offset from the address in the breakpoint.
Additionally, when placing a breakpoint after a jump or return instruction, the
breakpoint may be triggered even though the instruction was never executed.
This is because the processor pre-fetches the instructions. The breakpoint
hardware cannot distinguish between pre-fetched operations or those being
executed. This usually means that breakpoints should not be placed on the
first instruction of a routine, because just before that instruction is the jump or
return instruction from a previous routine. A workaround is to place two NOPs
at the beginning of the routine and then break after those NOPs.
15.3.3 Disabling a Breakpoint
To clear a previously set breakpoint, the following steps should be taken:
1) The BPSEL (MCON.7) bit must be set to either 0 (for breakpoint 0) or 1
(for breakpoint 1).
2) The Enable Breakpoint bit, EBP (BPCON.0), must be cleared to
deactivate the interrupt.