18.3.5 Trigger modesThe trigger mode controls the overall behavior of a debug run. The 4-bit TRG field in theDBGT register selects one of nine trigger modes. When TRGSEL = 1 in the DBGTregister, the output of the comparator must propagate through an opcode tracking circuitbefore triggering FIFO actions. The BEGIN bit in DBGT chooses whether the FIFObegins storing data when the qualified trigger is detected (begin trace), or the FIFO storesdata in a circular fashion from the time it is armed until the qualified trigger is detected(end trigger).A debug run is started by writing a 1 to the ARM bit in the DBGC register, which sets theARMF flag and clears the AF and BF flags and the CNT bits in DBGS. A begin-tracedebug run ends when the FIFO gets full. An end-trace run ends when the selected triggerevent occurs. Any debug run can be stopped manually by writing a 0 to ARM or DBGENin DBGC.In all trigger modes except event-only modes, the FIFO stores change-of-flow addresses.In event-only trigger modes, the FIFO stores data in the low-order eight bits of the FIFO.The BEGIN control bit is ignored in event-only trigger modes and all such debug runs arebegin type traces. When TRGSEL = 1 to select opcode fetch triggers, it is not necessaryto use R/W in comparisons because opcode tags would apply only to opcode fetches thatare always read cycles. It would also be unusual to specify TRGSEL = 1 while using afull mode trigger because the opcode value is normally known at a particular address.The following trigger mode descriptions state only the primary comparator conditionsthat lead to a trigger. Either comparator can usually be further qualified with R/W bysetting RWAEN (RWBEN) and the corresponding RWA (RWB) value to be matchedagainst R/W. The signal from the comparator with optional R/W qualification is used torequest a CPU breakpoint if BRKEN = 1 and TAG determines whether the CPU requestwill be a tag request or a force request.A-Only ̶ Trigger when the address matches the value in comparator AA OR B ̶ Trigger when the address matches either the value in comparator A or the valuein comparator BA Then B ̶ Trigger when the address matches the value in comparator B but only afterthe address for another cycle matched the value in comparator A. There can be anynumber of cycles after the A match and before the B match.Chapter 18 Development supportMC9S08PA4 Reference Manual, Rev. 5, 08/2017NXP Semiconductors 363